[54] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Functions for register operations.
|
---|
| 3 |
|
---|
[66] | 4 |
|
---|
[54] | 5 | ; Section containing code
|
---|
| 6 | SECTION .text
|
---|
| 7 |
|
---|
| 8 | ;--------------------------------------------------------------------
|
---|
| 9 | ; Registers_ExchangeDSSIwithESDI
|
---|
| 10 | ; Parameters
|
---|
| 11 | ; Nothing
|
---|
| 12 | ; Returns:
|
---|
| 13 | ; DS:SI and ES:DI are exchanged.
|
---|
| 14 | ; Corrupts registers:
|
---|
| 15 | ; Nothing
|
---|
| 16 | ;--------------------------------------------------------------------
|
---|
| 17 | ALIGN JUMP_ALIGN
|
---|
| 18 | Registers_ExchangeDSSIwithESDI:
|
---|
| 19 | push ds
|
---|
| 20 | push es
|
---|
| 21 | pop ds
|
---|
| 22 | pop es
|
---|
| 23 | xchg si, di
|
---|
| 24 | ret
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | ;--------------------------------------------------------------------
|
---|
| 28 | ; Registers_CopySSBPtoESDI
|
---|
[106] | 29 | ; Registers_CopySSBPtoDSSI
|
---|
| 30 | ; Registers_CopyDSSItoESDI
|
---|
| 31 | ; Registers_CopyESDItoDSSI
|
---|
[54] | 32 | ; Parameters
|
---|
| 33 | ; Nothing
|
---|
| 34 | ; Returns:
|
---|
| 35 | ; Copies farm pointer to different segment/pointer register pair
|
---|
| 36 | ; Corrupts registers:
|
---|
| 37 | ; Nothing
|
---|
| 38 | ;--------------------------------------------------------------------
|
---|
[105] | 39 | ALIGN JUMP_ALIGN
|
---|
| 40 | Registers_CopySSBPtoESDI:
|
---|
| 41 | COPY_SSBP_TO_ESDI
|
---|
| 42 | ret
|
---|
[54] | 43 |
|
---|
[131] | 44 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
[106] | 45 | ALIGN JUMP_ALIGN
|
---|
| 46 | Registers_CopySSBPtoDSSI:
|
---|
| 47 | COPY_SSBP_TO_DSSI
|
---|
| 48 | ret
|
---|
[54] | 49 |
|
---|
[106] | 50 | ALIGN JUMP_ALIGN
|
---|
| 51 | Registers_CopyDSSItoESDI:
|
---|
| 52 | COPY_DSSI_TO_ESDI
|
---|
| 53 | ret
|
---|
[54] | 54 |
|
---|
[106] | 55 | ALIGN JUMP_ALIGN
|
---|
| 56 | Registers_CopyESDItoDSSI:
|
---|
| 57 | COPY_ESDI_to_DSSI
|
---|
| 58 | ret
|
---|
| 59 | %endif
|
---|
| 60 |
|
---|
| 61 |
|
---|
[54] | 62 | ;--------------------------------------------------------------------
|
---|
[149] | 63 | ; Registers_NormalizeESSI
|
---|
| 64 | ; Registers_NormalizeESDI
|
---|
| 65 | ; Parameters
|
---|
| 66 | ; DS:SI or ES:DI: Ptr to normalize
|
---|
| 67 | ; Returns:
|
---|
| 68 | ; DS:SI or ES:DI: Normalized pointer
|
---|
| 69 | ; Corrupts registers:
|
---|
| 70 | ; AX, CX
|
---|
[370] | 71 | ;
|
---|
| 72 | ; Inline of NORMALIZE_FAR_POINTER so that we can share the last 2/3 of the
|
---|
[207] | 73 | ; routine with Registers_NormalizeFinish.
|
---|
[370] | 74 | ;
|
---|
[149] | 75 | ;--------------------------------------------------------------------
|
---|
[370] | 76 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
|
---|
[149] | 77 | ALIGN JUMP_ALIGN
|
---|
| 78 | Registers_NormalizeESSI:
|
---|
[207] | 79 | mov cx, si
|
---|
| 80 | and si, byte 0fh
|
---|
| 81 | jmp Registers_NormalizeFinish
|
---|
[149] | 82 |
|
---|
| 83 | ALIGN JUMP_ALIGN
|
---|
| 84 | Registers_NormalizeESDI:
|
---|
[207] | 85 | mov cx, di
|
---|
| 86 | and di, byte 0fh
|
---|
| 87 | ;;; fall-through
|
---|
| 88 |
|
---|
[370] | 89 | ALIGN JUMP_ALIGN
|
---|
| 90 | Registers_NormalizeFinish:
|
---|
[207] | 91 | eSHR_IM cx, 4
|
---|
| 92 | mov ax, es
|
---|
| 93 | add ax, cx
|
---|
| 94 | mov es, ax
|
---|
[149] | 95 | ret
|
---|
[222] | 96 | %endif
|
---|
[149] | 97 |
|
---|
[222] | 98 |
|
---|
[149] | 99 | ;--------------------------------------------------------------------
|
---|
[106] | 100 | ; Registers_SetZFifNullPointerInDSSI (commented to save bytes)
|
---|
[54] | 101 | ; Parameters
|
---|
| 102 | ; DS:SI: Far pointer
|
---|
| 103 | ; Returns:
|
---|
| 104 | ; ZF: Set if NULL pointer in DS:SI
|
---|
| 105 | ; Corrupts registers:
|
---|
| 106 | ; Nothing
|
---|
| 107 | ;--------------------------------------------------------------------
|
---|
[105] | 108 | ;ALIGN JUMP_ALIGN
|
---|
| 109 | ;Registers_SetZFifNullPointerInDSSI:
|
---|
| 110 | ; push ax
|
---|
| 111 | ; mov ax, ds
|
---|
| 112 | ; or ax, si
|
---|
| 113 | ; pop ax
|
---|
| 114 | ; ret
|
---|