1 | ; File name : MenuitemPrint.asm
|
---|
2 | ; Project name : XTIDE Universal BIOS Configurator v2
|
---|
3 | ; Created date : 5.10.2010
|
---|
4 | ; Last update : 5.12.2010
|
---|
5 | ; Author : Tomi Tilli
|
---|
6 | ; Description : Functions for printing MENUITEM name and value.
|
---|
7 |
|
---|
8 | ; Section containing code
|
---|
9 | SECTION .text
|
---|
10 |
|
---|
11 | ;--------------------------------------------------------------------
|
---|
12 | ; MenuitemPrint_PrintQuickInfoFromDSSI
|
---|
13 | ; Parameters:
|
---|
14 | ; DS:SI: Ptr to MENUITEM
|
---|
15 | ; Returns:
|
---|
16 | ; Nothing
|
---|
17 | ; Corrupts registers:
|
---|
18 | ; AX, DI
|
---|
19 | ;--------------------------------------------------------------------
|
---|
20 | ALIGN JUMP_ALIGN
|
---|
21 | MenuitemPrint_PrintQuickInfoFromDSSI:
|
---|
22 | push si
|
---|
23 |
|
---|
24 | mov si, [si+MENUITEM.szQuickInfo]
|
---|
25 | CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
|
---|
26 |
|
---|
27 | pop si
|
---|
28 | ret
|
---|
29 |
|
---|
30 |
|
---|
31 | ;--------------------------------------------------------------------
|
---|
32 | ; MenuitemPrint_NameWithPossibleValueFromDSSI
|
---|
33 | ; Parameters:
|
---|
34 | ; DS:SI: Ptr to MENUITEM
|
---|
35 | ; Returns:
|
---|
36 | ; Nothing
|
---|
37 | ; Corrupts registers:
|
---|
38 | ; AX, BX, DX, DI
|
---|
39 | ;--------------------------------------------------------------------
|
---|
40 | ALIGN JUMP_ALIGN
|
---|
41 | MenuitemPrint_NameWithPossibleValueFromDSSI:
|
---|
42 | eMOVZX bx, BYTE [si+MENUITEM.bType]
|
---|
43 | cmp bl, TYPE_MENUITEM_ACTION
|
---|
44 | ja SHORT .PrintNameAndValueFromDSSI
|
---|
45 | ; Fall to .PrintNameWithoutValueFromDSSI
|
---|
46 |
|
---|
47 | ;--------------------------------------------------------------------
|
---|
48 | ; .PrintNameWithoutValueFromDSSI
|
---|
49 | ; Parameters:
|
---|
50 | ; BX: Menuitem type (MENUITEM.bType)
|
---|
51 | ; DS:SI: Ptr to MENUITEM
|
---|
52 | ; Returns:
|
---|
53 | ; Nothing
|
---|
54 | ; Corrupts registers:
|
---|
55 | ; AX, DI
|
---|
56 | ;--------------------------------------------------------------------
|
---|
57 | .PrintNameWithoutValueFromDSSI:
|
---|
58 | push bp
|
---|
59 | push si
|
---|
60 |
|
---|
61 | mov bp, sp ; BP = SP before pushing parameters
|
---|
62 | push WORD [cs:bx+.rgwMenuitemTypeCharacter]
|
---|
63 | push WORD [si+MENUITEM.szName]
|
---|
64 | mov si, g_szFormatItemWithoutValue
|
---|
65 | CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
|
---|
66 |
|
---|
67 | pop si
|
---|
68 | pop bp
|
---|
69 | ret
|
---|
70 | .rgwMenuitemTypeCharacter:
|
---|
71 | dw '-' ; TYPE_MENUITEM_PAGEBACK
|
---|
72 | dw '+' ; TYPE_MENUITEM_PAGENEXT
|
---|
73 | dw '*' ; TYPE_MENUITEM_ACTION
|
---|
74 |
|
---|
75 |
|
---|
76 | ;--------------------------------------------------------------------
|
---|
77 | ; .PrintNameAndValueFromDSSI
|
---|
78 | ; Parameters:
|
---|
79 | ; DS:SI: Ptr to MENUITEM
|
---|
80 | ; SS:BP: Ptr to buffer for item value
|
---|
81 | ; Returns:
|
---|
82 | ; Nothing
|
---|
83 | ; Corrupts registers:
|
---|
84 | ; AX, BX, DX, DI
|
---|
85 | ;--------------------------------------------------------------------
|
---|
86 | ALIGN JUMP_ALIGN
|
---|
87 | .PrintNameAndValueFromDSSI:
|
---|
88 | eENTER_STRUCT MAX_VALUE_STRING_LENGTH+2 ; +2 for NULL and alignment
|
---|
89 | call .FormatValueStringFromItemInDSSItoBufferInSSBP
|
---|
90 | call .FormatNameFromItemInDSSIandValueFromSSBP
|
---|
91 | eLEAVE_STRUCT MAX_VALUE_STRING_LENGTH+2
|
---|
92 | ret
|
---|
93 |
|
---|
94 | ;--------------------------------------------------------------------
|
---|
95 | ; .FormatValueStringFromItemInDSSItoBufferInSSBP
|
---|
96 | ; Parameters:
|
---|
97 | ; DS:SI: Ptr to MENUITEM
|
---|
98 | ; SS:BP: Ptr to buffer for item value
|
---|
99 | ; Returns:
|
---|
100 | ; Nothing
|
---|
101 | ; Corrupts registers:
|
---|
102 | ; AX, BX, DX, DI
|
---|
103 | ;--------------------------------------------------------------------
|
---|
104 | ALIGN JUMP_ALIGN
|
---|
105 | .FormatValueStringFromItemInDSSItoBufferInSSBP:
|
---|
106 | push es
|
---|
107 | call Registers_CopySSBPtoESDI
|
---|
108 | mov al, '['
|
---|
109 | stosb
|
---|
110 | call [si+MENUITEM.fnFormatValue]
|
---|
111 | mov ax, ']'
|
---|
112 | stosw ; Also terminate with NULL
|
---|
113 | pop es
|
---|
114 | ret
|
---|
115 |
|
---|
116 | ;--------------------------------------------------------------------
|
---|
117 | ; .FormatNameFromItemInDSSIandValueFromSSBP
|
---|
118 | ; Parameters:
|
---|
119 | ; DS:SI: Ptr to MENUITEM
|
---|
120 | ; SS:BP: Ptr to value string
|
---|
121 | ; Returns:
|
---|
122 | ; Nothing
|
---|
123 | ; Corrupts registers:
|
---|
124 | ; AX, BX, DX
|
---|
125 | ;--------------------------------------------------------------------
|
---|
126 | ALIGN JUMP_ALIGN
|
---|
127 | .FormatNameFromItemInDSSIandValueFromSSBP:
|
---|
128 | push si
|
---|
129 |
|
---|
130 | mov bx, bp
|
---|
131 | mov bp, sp ; BP = SP before pushing parameters
|
---|
132 | push WORD [si+MENUITEM.szName]
|
---|
133 | push bx
|
---|
134 | push ss
|
---|
135 | mov si, g_szFormatItemNameWithValue
|
---|
136 | CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
|
---|
137 |
|
---|
138 | mov bp, bx
|
---|
139 | pop si
|
---|
140 | ret
|
---|
141 |
|
---|
142 |
|
---|
143 | ;--------------------------------------------------------------------
|
---|
144 | ; MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
|
---|
145 | ; MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
|
---|
146 | ; Parameters:
|
---|
147 | ; DS:SI: Ptr to MENUITEM
|
---|
148 | ; ES:DI: Ptr to destination buffer
|
---|
149 | ; Returns:
|
---|
150 | ; DI: Updated
|
---|
151 | ; Corrupts registers:
|
---|
152 | ; AX, BX, CX
|
---|
153 | ;--------------------------------------------------------------------
|
---|
154 | ALIGN JUMP_ALIGN
|
---|
155 | MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI:
|
---|
156 | call Menuitem_GetValueToAXfromMenuitemInDSSI
|
---|
157 | shl ax, 1
|
---|
158 | jmp SHORT PrintLookupValueFromAXtoBufferInESDI
|
---|
159 |
|
---|
160 | ALIGN JUMP_ALIGN
|
---|
161 | MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI:
|
---|
162 | call Menuitem_GetValueToAXfromMenuitemInDSSI
|
---|
163 | ; Fall to PrintLookupValueFromAXtoBufferInESDI
|
---|
164 |
|
---|
165 | ;--------------------------------------------------------------------
|
---|
166 | ; MenuitemPrint_WriteLookupValueStringToBufferInESDIfromItemInDSSI
|
---|
167 | ; Parameters:
|
---|
168 | ; AX: Value to print
|
---|
169 | ; DS:SI: Ptr to MENUITEM
|
---|
170 | ; ES:DI: Ptr to destination buffer
|
---|
171 | ; Returns:
|
---|
172 | ; DI: Updated
|
---|
173 | ; Corrupts registers:
|
---|
174 | ; AX, BX, CX
|
---|
175 | ;--------------------------------------------------------------------
|
---|
176 | ALIGN JUMP_ALIGN
|
---|
177 | PrintLookupValueFromAXtoBufferInESDI:
|
---|
178 | push si
|
---|
179 | add ax, [si+MENUITEM.itemValue+ITEM_VALUE.rgszValueToStringLookup]
|
---|
180 | xchg bx, ax
|
---|
181 | mov si, [bx]
|
---|
182 | call String_CopyDSSItoESDIandGetLengthToCX
|
---|
183 | pop si
|
---|
184 | ret
|
---|
185 |
|
---|
186 |
|
---|
187 | ;--------------------------------------------------------------------
|
---|
188 | ; MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
|
---|
189 | ; Parameters:
|
---|
190 | ; DS:SI: Ptr to MENUITEM
|
---|
191 | ; ES:DI: Ptr to destination buffer
|
---|
192 | ; Returns:
|
---|
193 | ; DI: Updated
|
---|
194 | ; Corrupts registers:
|
---|
195 | ; AX, BX, CX
|
---|
196 | ;--------------------------------------------------------------------
|
---|
197 | ALIGN JUMP_ALIGN
|
---|
198 | MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI:
|
---|
199 | mov bx, di
|
---|
200 | mov cx, MAX_VALUE_STRING_LENGTH
|
---|
201 | CALL_DISPLAY_LIBRARY PushDisplayContext
|
---|
202 | CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXwithLengthInCX
|
---|
203 |
|
---|
204 | call Menuitem_GetValueToAXfromMenuitemInDSSI
|
---|
205 | mov bx, 10
|
---|
206 | CALL_DISPLAY_LIBRARY PrintWordFromAXwithBaseInBX
|
---|
207 | jmp SHORT FinishPrintingUnsignedOrHexValue
|
---|
208 |
|
---|
209 | ;--------------------------------------------------------------------
|
---|
210 | ; MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
|
---|
211 | ; Parameters:
|
---|
212 | ; DS:SI: Ptr to MENUITEM
|
---|
213 | ; ES:DI: Ptr to destination buffer
|
---|
214 | ; Returns:
|
---|
215 | ; DI: Updated
|
---|
216 | ; Corrupts registers:
|
---|
217 | ; AX, BX, CX
|
---|
218 | ;--------------------------------------------------------------------
|
---|
219 | ALIGN JUMP_ALIGN
|
---|
220 | MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI:
|
---|
221 | mov bx, di
|
---|
222 | mov cx, MAX_VALUE_STRING_LENGTH
|
---|
223 | CALL_DISPLAY_LIBRARY PushDisplayContext
|
---|
224 | CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXwithLengthInCX
|
---|
225 |
|
---|
226 | call Menuitem_GetValueToAXfromMenuitemInDSSI
|
---|
227 | mov bx, 16
|
---|
228 | CALL_DISPLAY_LIBRARY PrintWordFromAXwithBaseInBX
|
---|
229 | mov al, 'h'
|
---|
230 | CALL_DISPLAY_LIBRARY PrintCharacterFromAL
|
---|
231 | ALIGN JUMP_ALIGN
|
---|
232 | FinishPrintingUnsignedOrHexValue:
|
---|
233 | CALL_DISPLAY_LIBRARY GetCharacterPointerToBXAX
|
---|
234 | xchg bx, ax
|
---|
235 |
|
---|
236 | CALL_DISPLAY_LIBRARY PopDisplayContext
|
---|
237 | mov di, bx
|
---|
238 | ret
|
---|
239 |
|
---|
240 |
|
---|
241 | ; Section containing initialized data
|
---|
242 | SECTION .data
|
---|
243 |
|
---|
244 | ALIGN WORD_ALIGN
|
---|
245 | g_rgszValueToStringLookupForFlagBooleans:
|
---|
246 | dw g_szNo
|
---|
247 | dw g_szYes
|
---|