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

Last change on this file since 58 was 57, checked in by Tomi Tilli, 14 years ago

Initial commit (Work in progress).

File size: 6.0 KB
Line 
1; File name : MenuitemPrint.asm
2; Project name : XTIDE Universal BIOS Configurator v2
3; Created date : 5.10.2010
4; Last update : 2.11.2010
5; Author : Tomi Tilli
6; Description : Functions for printing MENUITEM name and value.
7
8; Section containing code
9SECTION .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;--------------------------------------------------------------------
20ALIGN JUMP_ALIGN
21MenuitemPrint_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;--------------------------------------------------------------------
40ALIGN JUMP_ALIGN
41MenuitemPrint_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;--------------------------------------------------------------------
86ALIGN 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;--------------------------------------------------------------------
104ALIGN 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;--------------------------------------------------------------------
126ALIGN 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_WriteLookupValueStringToBufferInESDIfromItemInDSSI
145; Parameters:
146; DS:SI: Ptr to MENUITEM
147; ES:DI: Ptr to destination buffer
148; Returns:
149; DI: Updated
150; Corrupts registers:
151; AX, BX, CX
152;--------------------------------------------------------------------
153ALIGN JUMP_ALIGN
154MenuitemPrint_WriteLookupValueStringToBufferInESDIfromItemInDSSI:
155 push si
156
157 call Menuitem_GetValueToAXfromMenuitemInDSSI
158 add ax, [si+MENUITEM.itemValue+ITEM_VALUE.rgszValueToStringLookup]
159 xchg bx, ax
160 mov si, [bx]
161 call String_CopyDSSItoESDIandGetLengthToCX
162
163 pop si
164 ret
165
166
167;--------------------------------------------------------------------
168; MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
169; Parameters:
170; DS:SI: Ptr to MENUITEM
171; ES:DI: Ptr to destination buffer
172; Returns:
173; DI: Updated
174; Corrupts registers:
175; AX, BX, CX
176;--------------------------------------------------------------------
177ALIGN JUMP_ALIGN
178MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI:
179 mov bx, di
180 mov cx, MAX_VALUE_STRING_LENGTH
181 CALL_DISPLAY_LIBRARY PushDisplayContext
182 CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXwithLengthInCX
183
184 mov bx, 10
185 jmp SHORT PrintByteOrWordValue
186
187;--------------------------------------------------------------------
188; MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
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;--------------------------------------------------------------------
197ALIGN JUMP_ALIGN
198MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI:
199 mov bx, di
200 mov cx, MAX_VALUE_STRING_LENGTH
201 CALL_DISPLAY_LIBRARY PushDisplayContext
202 CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXwithLengthInCX
203
204 mov bx, 16
205PrintByteOrWordValue:
206 push bx
207 call Menuitem_GetValueToAXfromMenuitemInDSSI
208 pop bx
209
210 CALL_DISPLAY_LIBRARY PrintWordFromAXwithBaseInBX
211 CALL_DISPLAY_LIBRARY GetCharacterPointerToBXAX
212 xchg bx, ax
213
214 CALL_DISPLAY_LIBRARY PopDisplayContext
215 mov di, bx
216 ret
217
218
219; Section containing initialized data
220SECTION .data
221
222ALIGN WORD_ALIGN
223g_rgszValueToStringLookupForFlagBooleans:
224 dw g_szNo
225 dw g_szYes
Note: See TracBrowser for help on using the repository browser.