[54] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Functions for register operations.
|
---|
| 3 |
|
---|
[376] | 4 | ;
|
---|
[491] | 5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
[526] | 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
|
---|
[376] | 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.
|
---|
[491] | 12 | ;
|
---|
[376] | 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
|
---|
[491] | 16 | ; GNU General Public License for more details.
|
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
| 18 | ;
|
---|
[491] | 19 |
|
---|
[54] | 20 | ; Section containing code
|
---|
| 21 | SECTION .text
|
---|
| 22 |
|
---|
[596] | 23 | %ifdef EXCLUDE_FROM_XUB
|
---|
| 24 | %ifndef MODULE_EBIOS
|
---|
| 25 | %define EXCLUDE
|
---|
| 26 | %endif
|
---|
| 27 | %endif
|
---|
[54] | 28 | ;--------------------------------------------------------------------
|
---|
| 29 | ; Registers_ExchangeDSSIwithESDI
|
---|
| 30 | ; Parameters
|
---|
| 31 | ; Nothing
|
---|
| 32 | ; Returns:
|
---|
| 33 | ; DS:SI and ES:DI are exchanged.
|
---|
| 34 | ; Corrupts registers:
|
---|
| 35 | ; Nothing
|
---|
| 36 | ;--------------------------------------------------------------------
|
---|
[596] | 37 | %ifndef EXCLUDE
|
---|
[54] | 38 | ALIGN JUMP_ALIGN
|
---|
| 39 | Registers_ExchangeDSSIwithESDI:
|
---|
| 40 | push ds
|
---|
| 41 | push es
|
---|
| 42 | pop ds
|
---|
| 43 | pop es
|
---|
| 44 | xchg si, di
|
---|
| 45 | ret
|
---|
[596] | 46 | %endif
|
---|
| 47 | %undef EXCLUDE
|
---|
[54] | 48 |
|
---|
| 49 |
|
---|
| 50 | ;--------------------------------------------------------------------
|
---|
| 51 | ; Registers_CopySSBPtoESDI
|
---|
[106] | 52 | ; Registers_CopySSBPtoDSSI
|
---|
| 53 | ; Registers_CopyDSSItoESDI
|
---|
| 54 | ; Registers_CopyESDItoDSSI
|
---|
[54] | 55 | ; Parameters
|
---|
| 56 | ; Nothing
|
---|
| 57 | ; Returns:
|
---|
[596] | 58 | ; Copies far pointer to different segment/pointer register pair
|
---|
[54] | 59 | ; Corrupts registers:
|
---|
| 60 | ; Nothing
|
---|
| 61 | ;--------------------------------------------------------------------
|
---|
[491] | 62 | %ifdef INCLUDE_MENU_LIBRARY
|
---|
[105] | 63 | ALIGN JUMP_ALIGN
|
---|
| 64 | Registers_CopySSBPtoESDI:
|
---|
| 65 | COPY_SSBP_TO_ESDI
|
---|
| 66 | ret
|
---|
[489] | 67 | %endif
|
---|
[54] | 68 |
|
---|
[592] | 69 | %ifndef EXCLUDE_FROM_XUB
|
---|
[106] | 70 | ALIGN JUMP_ALIGN
|
---|
| 71 | Registers_CopySSBPtoDSSI:
|
---|
| 72 | COPY_SSBP_TO_DSSI
|
---|
| 73 | ret
|
---|
[54] | 74 |
|
---|
[106] | 75 | ALIGN JUMP_ALIGN
|
---|
| 76 | Registers_CopyDSSItoESDI:
|
---|
| 77 | COPY_DSSI_TO_ESDI
|
---|
| 78 | ret
|
---|
[54] | 79 |
|
---|
[106] | 80 | ALIGN JUMP_ALIGN
|
---|
| 81 | Registers_CopyESDItoDSSI:
|
---|
| 82 | COPY_ESDI_to_DSSI
|
---|
| 83 | ret
|
---|
| 84 | %endif
|
---|
| 85 |
|
---|
| 86 |
|
---|
[54] | 87 | ;--------------------------------------------------------------------
|
---|
[149] | 88 | ; Registers_NormalizeESSI
|
---|
| 89 | ; Registers_NormalizeESDI
|
---|
| 90 | ; Parameters
|
---|
| 91 | ; DS:SI or ES:DI: Ptr to normalize
|
---|
| 92 | ; Returns:
|
---|
| 93 | ; DS:SI or ES:DI: Normalized pointer
|
---|
| 94 | ; Corrupts registers:
|
---|
| 95 | ; AX, CX
|
---|
[370] | 96 | ;
|
---|
| 97 | ; Inline of NORMALIZE_FAR_POINTER so that we can share the last 2/3 of the
|
---|
[207] | 98 | ; routine with Registers_NormalizeFinish.
|
---|
[370] | 99 | ;
|
---|
[149] | 100 | ;--------------------------------------------------------------------
|
---|
[592] | 101 | %ifndef EXCLUDE_FROM_XUB OR EXCLUDE_FROM_XTIDECFG
|
---|
[149] | 102 | ALIGN JUMP_ALIGN
|
---|
| 103 | Registers_NormalizeESSI:
|
---|
[207] | 104 | mov cx, si
|
---|
[592] | 105 | and si, BYTE 0Fh
|
---|
| 106 | jmp SHORT Registers_NormalizeFinish
|
---|
[149] | 107 |
|
---|
| 108 | ALIGN JUMP_ALIGN
|
---|
| 109 | Registers_NormalizeESDI:
|
---|
[207] | 110 | mov cx, di
|
---|
[592] | 111 | and di, BYTE 0Fh
|
---|
[207] | 112 | ;;; fall-through
|
---|
| 113 |
|
---|
[370] | 114 | ALIGN JUMP_ALIGN
|
---|
| 115 | Registers_NormalizeFinish:
|
---|
[207] | 116 | eSHR_IM cx, 4
|
---|
| 117 | mov ax, es
|
---|
| 118 | add ax, cx
|
---|
| 119 | mov es, ax
|
---|
[149] | 120 | ret
|
---|
[222] | 121 | %endif
|
---|
[149] | 122 |
|
---|
[222] | 123 |
|
---|
[149] | 124 | ;--------------------------------------------------------------------
|
---|
[106] | 125 | ; Registers_SetZFifNullPointerInDSSI (commented to save bytes)
|
---|
[54] | 126 | ; Parameters
|
---|
| 127 | ; DS:SI: Far pointer
|
---|
| 128 | ; Returns:
|
---|
| 129 | ; ZF: Set if NULL pointer in DS:SI
|
---|
| 130 | ; Corrupts registers:
|
---|
| 131 | ; Nothing
|
---|
| 132 | ;--------------------------------------------------------------------
|
---|
[105] | 133 | ;ALIGN JUMP_ALIGN
|
---|
| 134 | ;Registers_SetZFifNullPointerInDSSI:
|
---|
| 135 | ; push ax
|
---|
| 136 | ; mov ax, ds
|
---|
| 137 | ; or ax, si
|
---|
| 138 | ; pop ax
|
---|
| 139 | ; ret
|
---|