source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/MenuitemPrint.asm@ 155

Last change on this file since 155 was 107, checked in by krille_n_@…, 14 years ago

Changes to the XTIDE Universal BIOS Configurator v2:

*Reverted my previous change. WTH was I thinking?

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