source: xtideuniversalbios/trunk/Configurator/Src/MenuPageItem.asm@ 578

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