[54] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Functions for register operations.
|
---|
| 3 |
|
---|
[376] | 4 | ;
|
---|
| 5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
| 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
|
---|
| 7 | ;
|
---|
| 8 | ; This program is free software; you can redistribute it and/or modify
|
---|
| 9 | ; it under the terms of the GNU General Public License as published by
|
---|
| 10 | ; the Free Software Foundation; either version 2 of the License, or
|
---|
| 11 | ; (at your option) any later version.
|
---|
| 12 | ;
|
---|
| 13 | ; This program is distributed in the hope that it will be useful,
|
---|
| 14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 16 | ; GNU General Public License for more details.
|
---|
| 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
| 18 | ;
|
---|
| 19 |
|
---|
[54] | 20 | ; Section containing code
|
---|
| 21 | SECTION .text
|
---|
| 22 |
|
---|
| 23 | ;--------------------------------------------------------------------
|
---|
| 24 | ; Registers_ExchangeDSSIwithESDI
|
---|
| 25 | ; Parameters
|
---|
| 26 | ; Nothing
|
---|
| 27 | ; Returns:
|
---|
| 28 | ; DS:SI and ES:DI are exchanged.
|
---|
| 29 | ; Corrupts registers:
|
---|
| 30 | ; Nothing
|
---|
| 31 | ;--------------------------------------------------------------------
|
---|
| 32 | ALIGN JUMP_ALIGN
|
---|
| 33 | Registers_ExchangeDSSIwithESDI:
|
---|
| 34 | push ds
|
---|
| 35 | push es
|
---|
| 36 | pop ds
|
---|
| 37 | pop es
|
---|
| 38 | xchg si, di
|
---|
| 39 | ret
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | ;--------------------------------------------------------------------
|
---|
| 43 | ; Registers_CopySSBPtoESDI
|
---|
[106] | 44 | ; Registers_CopySSBPtoDSSI
|
---|
| 45 | ; Registers_CopyDSSItoESDI
|
---|
| 46 | ; Registers_CopyESDItoDSSI
|
---|
[54] | 47 | ; Parameters
|
---|
| 48 | ; Nothing
|
---|
| 49 | ; Returns:
|
---|
| 50 | ; Copies farm pointer to different segment/pointer register pair
|
---|
| 51 | ; Corrupts registers:
|
---|
| 52 | ; Nothing
|
---|
| 53 | ;--------------------------------------------------------------------
|
---|
[105] | 54 | ALIGN JUMP_ALIGN
|
---|
| 55 | Registers_CopySSBPtoESDI:
|
---|
| 56 | COPY_SSBP_TO_ESDI
|
---|
| 57 | ret
|
---|
[54] | 58 |
|
---|
[131] | 59 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
[106] | 60 | ALIGN JUMP_ALIGN
|
---|
| 61 | Registers_CopySSBPtoDSSI:
|
---|
| 62 | COPY_SSBP_TO_DSSI
|
---|
| 63 | ret
|
---|
[54] | 64 |
|
---|
[106] | 65 | ALIGN JUMP_ALIGN
|
---|
| 66 | Registers_CopyDSSItoESDI:
|
---|
| 67 | COPY_DSSI_TO_ESDI
|
---|
| 68 | ret
|
---|
[54] | 69 |
|
---|
[106] | 70 | ALIGN JUMP_ALIGN
|
---|
| 71 | Registers_CopyESDItoDSSI:
|
---|
| 72 | COPY_ESDI_to_DSSI
|
---|
| 73 | ret
|
---|
| 74 | %endif
|
---|
| 75 |
|
---|
| 76 |
|
---|
[54] | 77 | ;--------------------------------------------------------------------
|
---|
[149] | 78 | ; Registers_NormalizeESSI
|
---|
| 79 | ; Registers_NormalizeESDI
|
---|
| 80 | ; Parameters
|
---|
| 81 | ; DS:SI or ES:DI: Ptr to normalize
|
---|
| 82 | ; Returns:
|
---|
| 83 | ; DS:SI or ES:DI: Normalized pointer
|
---|
| 84 | ; Corrupts registers:
|
---|
| 85 | ; AX, CX
|
---|
[370] | 86 | ;
|
---|
| 87 | ; Inline of NORMALIZE_FAR_POINTER so that we can share the last 2/3 of the
|
---|
[207] | 88 | ; routine with Registers_NormalizeFinish.
|
---|
[370] | 89 | ;
|
---|
[149] | 90 | ;--------------------------------------------------------------------
|
---|
[370] | 91 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
|
---|
[149] | 92 | ALIGN JUMP_ALIGN
|
---|
| 93 | Registers_NormalizeESSI:
|
---|
[207] | 94 | mov cx, si
|
---|
| 95 | and si, byte 0fh
|
---|
| 96 | jmp Registers_NormalizeFinish
|
---|
[149] | 97 |
|
---|
| 98 | ALIGN JUMP_ALIGN
|
---|
| 99 | Registers_NormalizeESDI:
|
---|
[207] | 100 | mov cx, di
|
---|
| 101 | and di, byte 0fh
|
---|
| 102 | ;;; fall-through
|
---|
| 103 |
|
---|
[370] | 104 | ALIGN JUMP_ALIGN
|
---|
| 105 | Registers_NormalizeFinish:
|
---|
[207] | 106 | eSHR_IM cx, 4
|
---|
| 107 | mov ax, es
|
---|
| 108 | add ax, cx
|
---|
| 109 | mov es, ax
|
---|
[149] | 110 | ret
|
---|
[222] | 111 | %endif
|
---|
[149] | 112 |
|
---|
[222] | 113 |
|
---|
[149] | 114 | ;--------------------------------------------------------------------
|
---|
[106] | 115 | ; Registers_SetZFifNullPointerInDSSI (commented to save bytes)
|
---|
[54] | 116 | ; Parameters
|
---|
| 117 | ; DS:SI: Far pointer
|
---|
| 118 | ; Returns:
|
---|
| 119 | ; ZF: Set if NULL pointer in DS:SI
|
---|
| 120 | ; Corrupts registers:
|
---|
| 121 | ; Nothing
|
---|
| 122 | ;--------------------------------------------------------------------
|
---|
[105] | 123 | ;ALIGN JUMP_ALIGN
|
---|
| 124 | ;Registers_SetZFifNullPointerInDSSI:
|
---|
| 125 | ; push ax
|
---|
| 126 | ; mov ax, ds
|
---|
| 127 | ; or ax, si
|
---|
| 128 | ; pop ax
|
---|
| 129 | ; ret
|
---|