1 | ; File name : MenuPageItem.asm |
---|
2 | ; Project name : XTIDE Univeral BIOS Configurator |
---|
3 | ; Created date : 15.4.2010 |
---|
4 | ; Last update : 1.5.2010 |
---|
5 | ; Author : Tomi Tilli |
---|
6 | ; Description : Functions to access MENUPAGEITEM structs. |
---|
7 | |
---|
8 | ; Section containing code |
---|
9 | SECTION .text |
---|
10 | |
---|
11 | ;-------------------------------------------------------------------- |
---|
12 | ; Prints MenuPageItem information string to bottom of menu window. |
---|
13 | ; |
---|
14 | ; MenuPageItem_PrintInfo |
---|
15 | ; Parameters: |
---|
16 | ; DS:DI: Ptr to MENUPAGEITEM |
---|
17 | ; SS:BP: Ptr to MENUVARS |
---|
18 | ; Returns: |
---|
19 | ; Nothing |
---|
20 | ; Corrupts registers: |
---|
21 | ; AX, BX, CX, DX, DI, ES |
---|
22 | ;-------------------------------------------------------------------- |
---|
23 | ALIGN JUMP_ALIGN |
---|
24 | MenuPageItem_PrintInfo: |
---|
25 | push cs |
---|
26 | pop es |
---|
27 | eMOVZX cx, BYTE [bp+MENUVARS.bInfoH] ; Info line count to CX |
---|
28 | call MenuPageItem_PrintCommonInfoLines |
---|
29 | mov di, [di+MENUPAGEITEM.szInfo] ; ES:DI now points to info string |
---|
30 | jmp MenuDraw_MultilineStr |
---|
31 | |
---|
32 | ;-------------------------------------------------------------------- |
---|
33 | ; Prints information lines that are common for all menuitems. |
---|
34 | ; |
---|
35 | ; MenuPageItem_PrintCommonInfoLines |
---|
36 | ; Parameters: |
---|
37 | ; ES: String segment |
---|
38 | ; SS:BP: Ptr to MENUVARS |
---|
39 | ; Returns: |
---|
40 | ; Nothing |
---|
41 | ; Corrupts registers: |
---|
42 | ; AX, BX, DX |
---|
43 | ;-------------------------------------------------------------------- |
---|
44 | ALIGN JUMP_ALIGN |
---|
45 | MenuPageItem_PrintCommonInfoLines: |
---|
46 | push di |
---|
47 | push cx |
---|
48 | mov di, g_szCommonInfo ; ES:DI now points common info string |
---|
49 | call MenuDraw_MultilineStr ; Draw title string |
---|
50 | call MenuDraw_NewlineStr ; Next line |
---|
51 | call MenuDraw_NewlineStr ; Next line |
---|
52 | pop cx |
---|
53 | pop di |
---|
54 | ret |
---|
55 | |
---|
56 | |
---|
57 | ;-------------------------------------------------------------------- |
---|
58 | ; Displays MenuPageItem help dialog. |
---|
59 | ; |
---|
60 | ; MenuPageItem_DisplayHelpDialog |
---|
61 | ; Parameters: |
---|
62 | ; DS:DI: Ptr to MENUPAGEITEM |
---|
63 | ; SS:BP: Ptr to MENUVARS |
---|
64 | ; Returns: |
---|
65 | ; Nothing |
---|
66 | ; Corrupts registers: |
---|
67 | ; AX, BX, CX, DX, DI, ES |
---|
68 | ;-------------------------------------------------------------------- |
---|
69 | ALIGN JUMP_ALIGN |
---|
70 | MenuPageItem_DisplayHelpDialog: |
---|
71 | mov di, [di+MENUPAGEITEM.szHelp] ; ES:DI now points to help string |
---|
72 | push cs |
---|
73 | pop es |
---|
74 | mov bl, WIDTH_DLG ; Dialog width |
---|
75 | jmp Menu_ShowMsgDlg |
---|
76 | |
---|
77 | |
---|
78 | ;-------------------------------------------------------------------- |
---|
79 | ; Displays message for special function menupageitem. |
---|
80 | ; |
---|
81 | ; MenuPageItem_DisplaySpecialFunctionDialog |
---|
82 | ; Parameters: |
---|
83 | ; DS:DI: Ptr to MENUPAGEITEM |
---|
84 | ; SS:BP: Ptr to MENUVARS |
---|
85 | ; Returns: |
---|
86 | ; Nothing |
---|
87 | ; Corrupts registers: |
---|
88 | ; AX, BX, DX |
---|
89 | ;-------------------------------------------------------------------- |
---|
90 | ALIGN JUMP_ALIGN |
---|
91 | MenuPageItem_DisplaySpecialFunctionDialog: |
---|
92 | push es |
---|
93 | push di |
---|
94 | push cx |
---|
95 | |
---|
96 | mov di, [di+MENUPAGEITEM.szDialog] |
---|
97 | push cs |
---|
98 | pop es |
---|
99 | mov bl, WIDTH_DLG ; Dialog width |
---|
100 | call Menu_ShowMsgDlg |
---|
101 | |
---|
102 | pop cx |
---|
103 | pop di |
---|
104 | pop es |
---|
105 | ret |
---|
106 | |
---|
107 | |
---|
108 | ;-------------------------------------------------------------------- |
---|
109 | ; Asks unsigned byte from user. |
---|
110 | ; |
---|
111 | ; MenuPageItem_GetByteFromUser |
---|
112 | ; MenuPageItem_GetByteFromUserWithoutMarkingUnsaved |
---|
113 | ; Parameters: |
---|
114 | ; DS:DI: Ptr to MENUPAGEITEM |
---|
115 | ; SS:BP: Ptr to MENUVARS |
---|
116 | ; Returns: |
---|
117 | ; CF: Set if user data inputted succesfully |
---|
118 | ; Cleared if cancel |
---|
119 | ; Corrupts registers: |
---|
120 | ; AX, BX, CX, DX, ES |
---|
121 | ;-------------------------------------------------------------------- |
---|
122 | ALIGN JUMP_ALIGN |
---|
123 | MenuPageItem_GetByteFromUser: |
---|
124 | call MenuPageItem_GetByteFromUserWithoutMarkingUnsaved |
---|
125 | jc SHORT MenuPageItem_MarkSettingsAsUnsaved |
---|
126 | ret |
---|
127 | ALIGN JUMP_ALIGN |
---|
128 | MenuPageItem_GetByteFromUserWithoutMarkingUnsaved: |
---|
129 | mov cx, 10 ; Numeric base |
---|
130 | mov bx, [di+MENUPAGEITEM.szDialog] ; Dialog string |
---|
131 | call MenuPageItem_ShowWordDialog |
---|
132 | jnc SHORT .Return ; Return if cancel |
---|
133 | |
---|
134 | ; Limit to min or max and store value |
---|
135 | MAX_U ax, [di+MENUPAGEITEM.wValueMin] |
---|
136 | MIN_U ax, [di+MENUPAGEITEM.wValueMax] |
---|
137 | mov bx, [di+MENUPAGEITEM.pValue] |
---|
138 | mov [bx], al |
---|
139 | stc |
---|
140 | .Return: |
---|
141 | ret |
---|
142 | |
---|
143 | |
---|
144 | ;-------------------------------------------------------------------- |
---|
145 | ; Asks unsigned word from user. |
---|
146 | ; |
---|
147 | ; MenuPageItem_GetWordFromUser |
---|
148 | ; MenuPageItem_GetWordFromUserWithoutMarkingUnsaved |
---|
149 | ; Parameters: |
---|
150 | ; DS:DI: Ptr to MENUPAGEITEM |
---|
151 | ; SS:BP: Ptr to MENUVARS |
---|
152 | ; Returns: |
---|
153 | ; CF: Set if user data inputted succesfully |
---|
154 | ; Cleared if cancel |
---|
155 | ; Corrupts registers: |
---|
156 | ; AX, BX, CX, DX, ES |
---|
157 | ;-------------------------------------------------------------------- |
---|
158 | ALIGN JUMP_ALIGN |
---|
159 | MenuPageItem_GetWordFromUser: |
---|
160 | call MenuPageItem_GetWordFromUserWithoutMarkingUnsaved |
---|
161 | jc SHORT MenuPageItem_MarkSettingsAsUnsaved |
---|
162 | ret |
---|
163 | ALIGN JUMP_ALIGN |
---|
164 | MenuPageItem_GetWordFromUserWithoutMarkingUnsaved: |
---|
165 | mov cx, 10 ; Numeric base |
---|
166 | mov bx, [di+MENUPAGEITEM.szDialog] ; Dialog string |
---|
167 | call MenuPageItem_ShowWordDialog |
---|
168 | jnc SHORT .Return ; Return if cancel |
---|
169 | |
---|
170 | ; Limit to min or max and store value |
---|
171 | MAX_U ax, [di+MENUPAGEITEM.wValueMin] |
---|
172 | MIN_U ax, [di+MENUPAGEITEM.wValueMax] |
---|
173 | mov bx, [di+MENUPAGEITEM.pValue] |
---|
174 | mov [bx], ax |
---|
175 | stc |
---|
176 | .Return: |
---|
177 | ret |
---|
178 | |
---|
179 | |
---|
180 | ;-------------------------------------------------------------------- |
---|
181 | ; Asks hexadecimal byte from user. |
---|
182 | ; |
---|
183 | ; MenuPageItem_GetHexByteFromUser |
---|
184 | ; MenuPageItem_GetHexByteFromUserWithoutMarkingUnsaved |
---|
185 | ; Parameters: |
---|
186 | ; DS:DI: Ptr to MENUPAGEITEM |
---|
187 | ; SS:BP: Ptr to MENUVARS |
---|
188 | ; Returns: |
---|
189 | ; CF: Set if user data inputted succesfully |
---|
190 | ; Cleared if cancel |
---|
191 | ; Corrupts registers: |
---|
192 | ; AX, BX, CX, DX, ES |
---|
193 | ;-------------------------------------------------------------------- |
---|
194 | ALIGN JUMP_ALIGN |
---|
195 | MenuPageItem_GetHexByteFromUser: |
---|
196 | call MenuPageItem_GetHexByteFromUserWithoutMarkingUnsaved |
---|
197 | jc SHORT MenuPageItem_MarkSettingsAsUnsaved |
---|
198 | ret |
---|
199 | ALIGN JUMP_ALIGN |
---|
200 | MenuPageItem_GetHexByteFromUserWithoutMarkingUnsaved: |
---|
201 | mov cx, 16 ; Numeric base |
---|
202 | mov bx, [di+MENUPAGEITEM.szDialog] ; Dialog string |
---|
203 | call MenuPageItem_ShowWordDialog |
---|
204 | jnc SHORT .Return ; Return if cancel |
---|
205 | |
---|
206 | ; Store value |
---|
207 | mov bx, [di+MENUPAGEITEM.pValue] |
---|
208 | mov [bx], al |
---|
209 | .Return: |
---|
210 | ret |
---|
211 | |
---|
212 | |
---|
213 | ;-------------------------------------------------------------------- |
---|
214 | ; Asks hexadecimal word from user. |
---|
215 | ; |
---|
216 | ; MenuPageItem_GetHexWordFromUser |
---|
217 | ; MenuPageItem_GetHexWordFromUserWithoutMarkingUnsaved |
---|
218 | ; Parameters: |
---|
219 | ; DS:DI: Ptr to MENUPAGEITEM |
---|
220 | ; SS:BP: Ptr to MENUVARS |
---|
221 | ; Returns: |
---|
222 | ; CF: Set if user data inputted succesfully |
---|
223 | ; Cleared if cancel |
---|
224 | ; Corrupts registers: |
---|
225 | ; AX, BX, CX, DX, ES |
---|
226 | ;-------------------------------------------------------------------- |
---|
227 | ALIGN JUMP_ALIGN |
---|
228 | MenuPageItem_GetHexWordFromUser: |
---|
229 | call MenuPageItem_GetHexWordFromUserWithoutMarkingUnsaved |
---|
230 | jc SHORT MenuPageItem_MarkSettingsAsUnsaved |
---|
231 | ret |
---|
232 | ALIGN JUMP_ALIGN |
---|
233 | MenuPageItem_GetHexWordFromUserWithoutMarkingUnsaved: |
---|
234 | mov cx, 16 ; Numeric base |
---|
235 | mov bx, [di+MENUPAGEITEM.szDialog] ; Dialog string |
---|
236 | call MenuPageItem_ShowWordDialog |
---|
237 | jnc SHORT .Return ; Return if cancel |
---|
238 | |
---|
239 | ; Store value |
---|
240 | mov bx, [di+MENUPAGEITEM.pValue] |
---|
241 | mov [bx], ax |
---|
242 | .Return: |
---|
243 | ret |
---|
244 | |
---|
245 | |
---|
246 | ;-------------------------------------------------------------------- |
---|
247 | ; Called when any BIOS setting is modified. |
---|
248 | ; |
---|
249 | ; MenuPageItem_MarkSettingsAsUnsaved |
---|
250 | ; Parameters: |
---|
251 | ; SS:BP: Ptr to MENUVARS |
---|
252 | ; Returns: |
---|
253 | ; CF: Set since user data inputted succesfully |
---|
254 | ; Corrupts registers: |
---|
255 | ; AX, BX, CX, DX |
---|
256 | ;-------------------------------------------------------------------- |
---|
257 | ALIGN JUMP_ALIGN |
---|
258 | MenuPageItem_MarkSettingsAsUnsaved: |
---|
259 | or WORD [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_UNSAVED |
---|
260 | call FormatTitle_RedrawMenuTitle |
---|
261 | stc |
---|
262 | ret |
---|
263 | |
---|
264 | |
---|
265 | ;-------------------------------------------------------------------- |
---|
266 | ; Shows dialog that asks WORD from user. |
---|
267 | ; |
---|
268 | ; MenuPageItem_ShowWordDialog |
---|
269 | ; Parameters: |
---|
270 | ; CX: Numberic base (10=dec, 16=hex) |
---|
271 | ; DS:BX: Ptr to dialog string |
---|
272 | ; SS:BP: Ptr to MENUVARS |
---|
273 | ; Returns: |
---|
274 | ; AX: 16-bit unsigned word inputted by user |
---|
275 | ; CF: Set if user data inputted succesfully |
---|
276 | ; Cleared if cancel |
---|
277 | ; Corrupts registers: |
---|
278 | ; BX, CX, DX, ES |
---|
279 | ;-------------------------------------------------------------------- |
---|
280 | ALIGN JUMP_ALIGN |
---|
281 | MenuPageItem_ShowWordDialog: |
---|
282 | push di |
---|
283 | |
---|
284 | push cs |
---|
285 | pop es |
---|
286 | mov di, bx ; Dialog string now in ES:DI |
---|
287 | mov bl, WIDTH_DLG ; Dialog width |
---|
288 | call Menu_ShowDWDlg |
---|
289 | |
---|
290 | pop di |
---|
291 | ret |
---|
292 | |
---|
293 | |
---|
294 | ;-------------------------------------------------------------------- |
---|
295 | ; Asks boolean value (Y/N) from user. |
---|
296 | ; |
---|
297 | ; MenuPageItem_GetBoolFromUser |
---|
298 | ; MenuPageItem_GetBoolFromUserWithoutMarkingUnsaved |
---|
299 | ; Parameters: |
---|
300 | ; DS:DI: Ptr to MENUPAGEITEM |
---|
301 | ; SS:BP: Ptr to MENUVARS |
---|
302 | ; Returns: |
---|
303 | ; CF: Set if user data inputted succesfully |
---|
304 | ; Cleared if cancel |
---|
305 | ; Corrupts registers: |
---|
306 | ; AX, BX, CX, DX, ES |
---|
307 | ;-------------------------------------------------------------------- |
---|
308 | ALIGN JUMP_ALIGN |
---|
309 | MenuPageItem_GetBoolFromUser: |
---|
310 | call MenuPageItem_GetBoolFromUserWithoutMarkingUnsaved |
---|
311 | jc SHORT MenuPageItem_MarkSettingsAsUnsaved |
---|
312 | ret |
---|
313 | ALIGN JUMP_ALIGN |
---|
314 | MenuPageItem_GetBoolFromUserWithoutMarkingUnsaved: |
---|
315 | push di |
---|
316 | push cs |
---|
317 | pop es |
---|
318 | mov di, [di+MENUPAGEITEM.szDialog] ; Dialog string |
---|
319 | mov bl, WIDTH_DLG ; Dialog width |
---|
320 | call Menu_ShowYNDlg |
---|
321 | pop di |
---|
322 | jz SHORT .Cancelled ; Return if cancelled |
---|
323 | mov bx, [di+MENUPAGEITEM.pValue] |
---|
324 | mov ax, [di+MENUPAGEITEM.wValueMask] |
---|
325 | jc SHORT .UserSelectedY |
---|
326 | |
---|
327 | ; User selected 'N' |
---|
328 | not ax |
---|
329 | and [bx], ax |
---|
330 | stc |
---|
331 | ret |
---|
332 | ALIGN JUMP_ALIGN |
---|
333 | .UserSelectedY: |
---|
334 | or [bx], ax |
---|
335 | stc |
---|
336 | ret |
---|
337 | .Cancelled: |
---|
338 | clc |
---|
339 | ret |
---|
340 | |
---|
341 | |
---|
342 | ;-------------------------------------------------------------------- |
---|
343 | ; Activates new submenu for getting lookup value selected by user. |
---|
344 | ; |
---|
345 | ; MainPageItem_ActivateSubmenuForGettingLookupValue |
---|
346 | ; MainPageItem_ActivateSubmenuForGettingLookupValueWithoutMarkingUnsaved |
---|
347 | ; Parameters: |
---|
348 | ; DS:SI Ptr to MENUPAGE |
---|
349 | ; DS:DI Ptr to MENUPAGEITEM |
---|
350 | ; SS:BP: Ptr to MENUVARS |
---|
351 | ; Returns: |
---|
352 | ; CF: Set if menuitem changed |
---|
353 | ; Cleared if no changes |
---|
354 | ; Corrupts registers: |
---|
355 | ; AX, BX, CX, DX |
---|
356 | ;-------------------------------------------------------------------- |
---|
357 | ALIGN JUMP_ALIGN |
---|
358 | MainPageItem_ActivateSubmenuForGettingLookupValue: |
---|
359 | call MainPageItem_ActivateSubmenuForGettingLookupValueWithoutMarkingUnsaved |
---|
360 | jc SHORT MenuPageItem_MarkSettingsAsUnsaved |
---|
361 | ret |
---|
362 | ALIGN JUMP_ALIGN |
---|
363 | MainPageItem_ActivateSubmenuForGettingLookupValueWithoutMarkingUnsaved: |
---|
364 | call MainPageItem_ActivateSubmenu |
---|
365 | cmp cx, BYTE 0 |
---|
366 | jl SHORT .Return ; User cancellation |
---|
367 | push si |
---|
368 | mov si, [di+MENUPAGEITEM.pSubMenuPage] ; DS:SI points to value MENUPAGE |
---|
369 | mov bx, [si+MENUPAGE.prgbItemToVal] ; Load offset to lookup table |
---|
370 | add bx, cx ; Add menuitem index |
---|
371 | mov al, [bx] ; Load value |
---|
372 | mov bx, [di+MENUPAGEITEM.pValue] ; Load pointer to value |
---|
373 | mov [bx], al ; Store value |
---|
374 | pop si |
---|
375 | stc ; Changes so redraw |
---|
376 | ret |
---|
377 | .Return: |
---|
378 | clc |
---|
379 | ret |
---|
380 | |
---|
381 | |
---|
382 | ;-------------------------------------------------------------------- |
---|
383 | ; Activates new submenu. |
---|
384 | ; |
---|
385 | ; MainPageItem_ActivateSubmenu |
---|
386 | ; Parameters: |
---|
387 | ; DS:SI Ptr to MENUPAGE |
---|
388 | ; DS:DI Ptr to MENUPAGEITEM |
---|
389 | ; SS:BP: Ptr to MENUVARS |
---|
390 | ; Returns: |
---|
391 | ; CX: Index of last pointed Menuitem (not necessary selected with ENTER) |
---|
392 | ; FFFFh if cancelled with ESC |
---|
393 | ; CF: Set if menuitem changed |
---|
394 | ; Cleared if no changes |
---|
395 | ; Corrupts registers: |
---|
396 | ; AX, BX, CX, DX |
---|
397 | ;-------------------------------------------------------------------- |
---|
398 | ALIGN JUMP_ALIGN |
---|
399 | MainPageItem_ActivateSubmenu: |
---|
400 | push di |
---|
401 | push si |
---|
402 | mov si, [di+MENUPAGEITEM.pSubMenuPage] ; DS:SI points to new MENUPAGE |
---|
403 | call Main_EnterMenu |
---|
404 | call Menu_RefreshMenu |
---|
405 | pop si |
---|
406 | pop di |
---|
407 | clc |
---|
408 | ret |
---|
409 | |
---|
410 | |
---|
411 | ;-------------------------------------------------------------------- |
---|
412 | ; Leaves submenu. |
---|
413 | ; |
---|
414 | ; MainPageItem_ActivateLeaveSubmenu |
---|
415 | ; Parameters: |
---|
416 | ; DS:SI Ptr to MENUPAGE |
---|
417 | ; DS:DI Ptr to MENUPAGEITEM |
---|
418 | ; SS:BP: Ptr to MENUVARS |
---|
419 | ; Returns: |
---|
420 | ; CF: Cleared since no need to redraw |
---|
421 | ; Corrupts registers: |
---|
422 | ; AX, BX, CX, DX |
---|
423 | ;-------------------------------------------------------------------- |
---|
424 | ALIGN JUMP_ALIGN |
---|
425 | MainPageItem_ActivateLeaveSubmenu: |
---|
426 | call Menu_Exit |
---|
427 | clc |
---|
428 | ret |
---|