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