[54] | 1 | ; File name : Registers.asm
|
---|
| 2 | ; Project name : Assembly Library
|
---|
| 3 | ; Created date : 24.10.2010
|
---|
| 4 | ; Last update : 24.10.2010
|
---|
| 5 | ; Author : Tomi Tilli
|
---|
| 6 | ; Description : Functions for register operations.
|
---|
| 7 |
|
---|
| 8 | ; Section containing code
|
---|
| 9 | SECTION .text
|
---|
| 10 |
|
---|
| 11 | ;--------------------------------------------------------------------
|
---|
| 12 | ; Registers_ExchangeDSSIwithESDI
|
---|
| 13 | ; Parameters
|
---|
| 14 | ; Nothing
|
---|
| 15 | ; Returns:
|
---|
| 16 | ; DS:SI and ES:DI are exchanged.
|
---|
| 17 | ; Corrupts registers:
|
---|
| 18 | ; Nothing
|
---|
| 19 | ;--------------------------------------------------------------------
|
---|
| 20 | ALIGN JUMP_ALIGN
|
---|
| 21 | Registers_ExchangeDSSIwithESDI:
|
---|
| 22 | push ds
|
---|
| 23 | push es
|
---|
| 24 | pop ds
|
---|
| 25 | pop es
|
---|
| 26 | xchg si, di
|
---|
| 27 | ret
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | ;--------------------------------------------------------------------
|
---|
| 31 | ; Registers_CopySSBPtoESDI
|
---|
| 32 | ; Registers_CopySSBPtoDSSI
|
---|
| 33 | ; Registers_CopyDSSItoESDI
|
---|
| 34 | ; Registers_CopyESDItoDSSI
|
---|
| 35 | ; Parameters
|
---|
| 36 | ; Nothing
|
---|
| 37 | ; Returns:
|
---|
| 38 | ; Copies farm pointer to different segment/pointer register pair
|
---|
| 39 | ; Corrupts registers:
|
---|
| 40 | ; Nothing
|
---|
| 41 | ;--------------------------------------------------------------------
|
---|
| 42 | ALIGN JUMP_ALIGN
|
---|
| 43 | Registers_CopySSBPtoESDI:
|
---|
| 44 | push ss
|
---|
| 45 | pop es
|
---|
| 46 | mov di, bp
|
---|
| 47 | ret
|
---|
| 48 |
|
---|
| 49 | ALIGN JUMP_ALIGN
|
---|
| 50 | Registers_CopySSBPtoDSSI:
|
---|
| 51 | push ss
|
---|
| 52 | pop ds
|
---|
| 53 | mov si, bp
|
---|
| 54 | ret
|
---|
| 55 |
|
---|
| 56 | ALIGN JUMP_ALIGN
|
---|
| 57 | Registers_CopyDSSItoESDI:
|
---|
| 58 | push ds
|
---|
| 59 | pop es
|
---|
| 60 | mov di, si
|
---|
| 61 | ret
|
---|
| 62 |
|
---|
| 63 | ALIGN JUMP_ALIGN
|
---|
| 64 | Registers_CopyESDItoDSSI:
|
---|
| 65 | push es
|
---|
| 66 | pop ds
|
---|
| 67 | mov si, di
|
---|
| 68 | ret
|
---|
| 69 |
|
---|
| 70 |
|
---|
| 71 | ;--------------------------------------------------------------------
|
---|
| 72 | ; Registers_SetZFifNullPointerInDSSI
|
---|
| 73 | ; Parameters
|
---|
| 74 | ; DS:SI: Far pointer
|
---|
| 75 | ; Returns:
|
---|
| 76 | ; ZF: Set if NULL pointer in DS:SI
|
---|
| 77 | ; Corrupts registers:
|
---|
| 78 | ; Nothing
|
---|
| 79 | ;--------------------------------------------------------------------
|
---|
| 80 | ALIGN JUMP_ALIGN
|
---|
| 81 | Registers_SetZFifNullPointerInDSSI:
|
---|
| 82 | push ax
|
---|
| 83 | mov ax, ds
|
---|
| 84 | or ax, si
|
---|
| 85 | pop ax
|
---|
| 86 | ret
|
---|