source: xtideuniversalbios/trunk/Configurator/Src/MenuPageItemFormat.asm@ 616

Last change on this file since 616 was 293, checked in by krille_n_@…, 13 years ago

Commit 1/2 (Library, Configurators and Serial Server):

  • Changed Emulate.inc so that making 286 and 386 versions now works. Additionally, only one processor type define is needed in the makefile.
  • Minor optimizations.
  • Fixed spelling and did some cleaning.
File size: 7.6 KB
Line 
1; Project name : XTIDE Universal BIOS Configurator
2; Description : Functions for formatting
3; menuitem names from MENUPAGEITEM.
4
5; Section containing code
6SECTION .text
7
8;--------------------------------------------------------------------
9; Prints lookup string for index values.
10;
11; MenuPageItemFormat_LookupString
12; Parameters:
13; DS:DI: Ptr to MENUPAGEITEM
14; Returns:
15; Nothing
16; Corrupts registers:
17; AX, BX, DX, SI
18;--------------------------------------------------------------------
19ALIGN JUMP_ALIGN
20MenuPageItemFormat_LookupString:
21 mov si, [di+MENUPAGEITEM.rgszLookup] ; Load offset to string lookup table
22 mov bx, [di+MENUPAGEITEM.pValue] ; Ptr to value containing lookup index
23 eMOVZX bx, [bx] ; BX=lookup index (values are already shifted for WORD lookup)
24 push WORD [bx+si] ; Push offset to string to print
25 mov dh, 4 ; Total of 4 bytes for formatting params
26 mov si, .szStringName ; Offset to format string
27 jmp MenuPageItemFormat_NameWithParamsPushed
28.szStringName: db "+%22s[%7s]",STOP
29
30
31;--------------------------------------------------------------------
32; Prints menuitem name for any MENUPAGEITEM.
33;
34; MenuPageItemFormat_NameForAnyType
35; Parameters:
36; DS:DI: Ptr to MENUPAGEITEM
37; Returns:
38; Nothing
39; Corrupts registers:
40; AX, BX, DX, SI
41;--------------------------------------------------------------------
42ALIGN JUMP_ALIGN
43MenuPageItemFormat_NameForAnyType:
44 eMOVZX bx, [di+MENUPAGEITEM.bType] ; Load menuitem type
45 jmp [cs:bx+.rgfnPrintBasedOnType]
46ALIGN WORD_ALIGN
47.rgfnPrintBasedOnType:
48 dw MenuPageItemFormat_NameForBackToPreviousSubmenu ; TYPE_MENUPAGEITEM_BACK
49 dw MenuPageItemFormat_NameForNextSubmenu ; TYPE_MENUPAGEITEM_NEXT
50 dw MenuPageItemFormat_NameForSpecialFunction ; TYPE_MENUPAGEITEM_SPECIAL
51 dw MenuPageItemFormat_NameWithUnsignedByteValue ; TYPE_MENUPAGEITEM_UNSIGNED_BYTE
52 dw MenuPageItemFormat_NameWithUnsignedWordValue ; TYPE_MENUPAGEITEM_UNSIGNED_WORD
53 dw MenuPageItemFormat_NameWithByteHexadecimalValue ; TYPE_MENUPAGEITEM_HEX_BYTE
54 dw MenuPageItemFormat_NameWithWordHexadecimalValue ; TYPE_MENUPAGEITEM_HEX_WORD
55 dw MenuPageItemFormat_NameWithFlagValue ; TYPE_MENUPAGEITEM_FLAG
56
57
58;--------------------------------------------------------------------
59; Prints "Back to previous menu" menuitem.
60;
61; MenuPageItemFormat_NameForBackToPreviousSubmenu
62; Parameters:
63; DS:DI: Ptr to MENUPAGEITEM
64; Returns:
65; Nothing
66; Corrupts registers:
67; AX, BX, DX
68;--------------------------------------------------------------------
69ALIGN JUMP_ALIGN
70MenuPageItemFormat_NameForBackToPreviousSubmenu:
71 mov dh, 2 ; Total of 2 bytes for formatting params
72 mov si, .szPrevMenu ; Offset to format string
73 jmp MenuPageItemFormat_NameWithParamsPushed
74.szPrevMenu: db "-%32s",STOP
75
76
77;--------------------------------------------------------------------
78; Prints menuitem name for menuitem that opens new submenu.
79;
80; MenuPageItemFormat_NameForNextSubmenu
81; Parameters:
82; DS:DI: Ptr to MENUPAGEITEM
83; Returns:
84; Nothing
85; Corrupts registers:
86; AX, DX, SI
87;--------------------------------------------------------------------
88ALIGN JUMP_ALIGN
89MenuPageItemFormat_NameForNextSubmenu:
90 mov dh, 2 ; Total of 2 bytes for formatting params
91 mov si, .szNextMenu ; Offset to format string
92 jmp MenuPageItemFormat_NameWithParamsPushed
93.szNextMenu: db "+%32s",STOP
94
95
96;--------------------------------------------------------------------
97; Prints menuitem name for menuitem with special function.
98;
99; MenuPageItemFormat_NameForSpecialFunction
100; Parameters:
101; DS:DI: Ptr to MENUPAGEITEM
102; Returns:
103; Nothing
104; Corrupts registers:
105; AX, DX, SI
106;--------------------------------------------------------------------
107ALIGN JUMP_ALIGN
108MenuPageItemFormat_NameForSpecialFunction:
109 mov dh, 2 ; Total of 2 bytes for formatting params
110 mov si, .szSpecial ; Offset to format string
111 jmp MenuPageItemFormat_NameWithParamsPushed
112.szSpecial: db "*%32s",STOP
113
114
115;--------------------------------------------------------------------
116; Prints menuitem name with unsigned integer value.
117;
118; MenuPageItemFormat_NameWithUnsignedByteValue
119; MenuPageItemFormat_NameWithUnsignedWordValue
120; Parameters:
121; DS:DI: Ptr to MENUPAGEITEM
122; Returns:
123; Nothing
124; Corrupts registers:
125; AX, DX, SI
126;--------------------------------------------------------------------
127ALIGN JUMP_ALIGN
128MenuPageItemFormat_NameWithUnsignedByteValue:
129 mov si, [di+MENUPAGEITEM.pValue] ; DS:SI points to value
130 eMOVZX ax, [si] ; Load byte to AX
131 push ax ; Push byte
132 jmp SHORT MenuPageItemFormat_NameWithUnsignedValuePushed
133ALIGN JUMP_ALIGN
134MenuPageItemFormat_NameWithUnsignedWordValue:
135 mov si, [di+MENUPAGEITEM.pValue] ; DS:SI points to value
136 push WORD [si] ; Push integer value
137MenuPageItemFormat_NameWithUnsignedValuePushed:
138 mov dh, 4 ; Total of 4 bytes for formatting params
139 mov si, .szIntegerName ; Offset to format string
140 jmp SHORT MenuPageItemFormat_NameWithParamsPushed
141.szIntegerName: db "%25s[%5u]",STOP
142
143
144;--------------------------------------------------------------------
145; Prints menuitem name with hexadecimal value.
146;
147; MenuPageItemFormat_NameWithByteHexadecimalValue
148; MenuPageItemFormat_NameWithWordHexadecimalValue
149; Parameters:
150; DS:DI: Ptr to MENUPAGEITEM
151; Returns:
152; Nothing
153; Corrupts registers:
154; AX, DX, SI
155;--------------------------------------------------------------------
156ALIGN JUMP_ALIGN
157MenuPageItemFormat_NameWithByteHexadecimalValue:
158 mov si, [di+MENUPAGEITEM.pValue] ; DS:SI points to value
159 eMOVZX ax, [si] ; Load byte to AX
160 push ax ; Push byte
161 jmp SHORT MenuPageItemFormat_NameWithHexadecimalValuePushed
162ALIGN JUMP_ALIGN
163MenuPageItemFormat_NameWithWordHexadecimalValue:
164 mov si, [di+MENUPAGEITEM.pValue] ; DS:SI points to value
165 push WORD [si] ; Push hexadecimal value
166MenuPageItemFormat_NameWithHexadecimalValuePushed:
167 mov dh, 4 ; Total of 4 bytes for formatting params
168 mov si, .szHexName ; Offset to format string
169 jmp SHORT MenuPageItemFormat_NameWithParamsPushed
170.szHexName: db "%25s[%5x]",STOP
171
172
173;--------------------------------------------------------------------
174; Prints menuitem name with Y/N flag value.
175;
176; MenuPageItemFormat_NameWithFlagValue
177; Parameters:
178; DS:DI: Ptr to MENUPAGEITEM
179; Returns:
180; Nothing
181; Corrupts registers:
182; AX, DX, SI
183;--------------------------------------------------------------------
184ALIGN JUMP_ALIGN
185MenuPageItemFormat_NameWithFlagValue:
186 mov dx, 044Eh ; DH=4 bytes in stack, DL='N'
187 mov si, [di+MENUPAGEITEM.pValue] ; DS:SI points to value
188 mov ax, [si] ; Load value
189 test ax, [di+MENUPAGEITEM.wValueMask] ; Flag set?
190 jz SHORT .PushFlagValueChar
191 mov dl, 'Y'
192.PushFlagValueChar:
193 push dx
194 mov si, .szFlagName ; Offset to format string
195 jmp SHORT MenuPageItemFormat_NameWithParamsPushed
196.szFlagName: db "%25s[%5c]",STOP
197
198
199;--------------------------------------------------------------------
200; Prints formatted menuitem name.
201;
202; MenuPageItemFormat_NameWithParamsPushed
203; Parameters:
204; DH: Number of bytes pushed to stack + 2 for name string
205; SI: Offset to formatting string
206; DS:DI: Ptr to MENUPAGEITEM
207; DS: String segment
208; Stack: Formatting parameters except menuitem name
209; Returns:
210; Nothing
211; Corrupts registers:
212; AX, SI
213;--------------------------------------------------------------------
214ALIGN JUMP_ALIGN
215MenuPageItemFormat_NameWithParamsPushed:
216 push WORD [di+MENUPAGEITEM.szName]
217 mov dl, ' ' ; Min length character
218 call Print_Format
219 eMOVZX ax, dh
220 add sp, ax ; Clear format parameters from stack
221 ret
Note: See TracBrowser for help on using the repository browser.