source: xtideuniversalbios/trunk/Configurator/Src/Menupages/ConfigurationMenu.asm@ 49

Last change on this file since 49 was 2, checked in by Tomi Tilli, 15 years ago
File size: 14.4 KB
RevLine 
[2]1; File name : ConfigurationMenu.asm
2; Project name : XTIDE Univeral BIOS Configurator
3; Created date : 21.4.2010
4; Last update : 2.5.2010
5; Author : Tomi Tilli
6; Description : XTIDE Universal BIOS configuration menu.
7
8; Section containing initialized data
9SECTION .data
10
11; -Back to previous menu
12; +Primary IDE
13; ...
14; +Last IDE
15; +Boot Menu settings
16; Boot loader type (None, Simple, Menu)
17; Late Initialization (N)
18; Maximize Disk Size (Y)
19; Full Operating Mode (Y)
20; KiB to steal from base RAM (1)
21; Number of IDE controllers (5)
22
23ALIGN WORD_ALIGN
24g_MenuPageCfg:
25istruc MENUPAGE
26 at MENUPAGE.bItemCnt, db 13
27iend
28istruc MENUPAGEITEM ; Back to previous menu
29 at MENUPAGEITEM.fnActivate, dw MainPageItem_ActivateLeaveSubmenu
30 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
31 at MENUPAGEITEM.szName, dw g_szPreviousMenu
32 at MENUPAGEITEM.szInfo, dw g_szNfoCfgBack
33 at MENUPAGEITEM.szHelp, dw g_szNfoCfgBack
34 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
35 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_BACK
36iend
37g_MenuPageItemCfgIde1:
38istruc MENUPAGEITEM ; Primary IDE
39 at MENUPAGEITEM.fnActivate, dw ConfigurationMenu_ActivateIdeController
40 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
41 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.ideVars0
42 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageIdeVars
43 at MENUPAGEITEM.szName, dw g_szItemCfgIde1
44 at MENUPAGEITEM.szInfo, dw g_szNfoCfgIde
45 at MENUPAGEITEM.szHelp, dw g_szNfoCfgIde
46 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
47 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
48iend
49g_MenuPageItemCfgIde2:
50istruc MENUPAGEITEM
51 at MENUPAGEITEM.fnActivate, dw ConfigurationMenu_ActivateIdeController
52 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
53 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.ideVars1
54 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageIdeVars
55 at MENUPAGEITEM.szName, dw g_szItemCfgIde2
56 at MENUPAGEITEM.szInfo, dw g_szNfoCfgIde
57 at MENUPAGEITEM.szHelp, dw g_szNfoCfgIde
58 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
59iend
60g_MenuPageItemCfgIde3:
61istruc MENUPAGEITEM
62 at MENUPAGEITEM.fnActivate, dw ConfigurationMenu_ActivateIdeController
63 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
64 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.ideVars2
65 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageIdeVars
66 at MENUPAGEITEM.szName, dw g_szItemCfgIde3
67 at MENUPAGEITEM.szInfo, dw g_szNfoCfgIde
68 at MENUPAGEITEM.szHelp, dw g_szNfoCfgIde
69 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
70iend
71g_MenuPageItemCfgIde4:
72istruc MENUPAGEITEM
73 at MENUPAGEITEM.fnActivate, dw ConfigurationMenu_ActivateIdeController
74 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
75 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.ideVars3
76 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageIdeVars
77 at MENUPAGEITEM.szName, dw g_szItemCfgIde4
78 at MENUPAGEITEM.szInfo, dw g_szNfoCfgIde
79 at MENUPAGEITEM.szHelp, dw g_szNfoCfgIde
80 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
81iend
82g_MenuPageItemCfgIde5:
83istruc MENUPAGEITEM
84 at MENUPAGEITEM.fnActivate, dw ConfigurationMenu_ActivateIdeController
85 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
86 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.ideVars4
87 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageIdeVars
88 at MENUPAGEITEM.szName, dw g_szItemCfgIde5
89 at MENUPAGEITEM.szInfo, dw g_szNfoCfgIde
90 at MENUPAGEITEM.szHelp, dw g_szNfoCfgIde
91 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
92iend
93g_MenuPageItemCfgBootMenu:
94istruc MENUPAGEITEM ; Boot menu settings
95 at MENUPAGEITEM.fnActivate, dw MainPageItem_ActivateSubmenu
96 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
97 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageBootMenu
98 at MENUPAGEITEM.szName, dw g_szItemCfgBootMenu
99 at MENUPAGEITEM.szInfo, dw g_szNfoCfgBootMenu
100 at MENUPAGEITEM.szHelp, dw g_szNfoCfgBootMenu
101 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
102iend
103istruc MENUPAGEITEM ; Boot Loader type
104 at MENUPAGEITEM.fnActivate, dw ConfigurationMenu_ActivateBootLoaderType
105 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_LookupString
106 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.bBootLdrType
107 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageBootLoaderType
108 at MENUPAGEITEM.rgszLookup, dw g_rgszBootLoaderValueToString
109 at MENUPAGEITEM.szName, dw g_szItemCfgBootLoader
110 at MENUPAGEITEM.szInfo, dw g_szNfoCfgBootLoader
111 at MENUPAGEITEM.szHelp, dw g_szNfoCfgBootLoader
112 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
113 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
114iend
115istruc MENUPAGEITEM ; Late initialization
116 at MENUPAGEITEM.fnActivate, dw MenuPageItem_GetBoolFromUser
117 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
118 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.wFlags
119 at MENUPAGEITEM.wValueMask, dw FLG_ROMVARS_LATE
120 at MENUPAGEITEM.szName, dw g_szItemCfgLateInit
121 at MENUPAGEITEM.szInfo, dw g_szNfoCfgLateInit
122 at MENUPAGEITEM.szHelp, dw g_szHelpCfgLateInit
123 at MENUPAGEITEM.szDialog, dw g_szDlgCfgLateInit
124 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
125 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_FLAG
126iend
127istruc MENUPAGEITEM ; Maximize disk size
128 at MENUPAGEITEM.fnActivate, dw MenuPageItem_GetBoolFromUser
129 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
130 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.wFlags
131 at MENUPAGEITEM.wValueMask, dw FLG_ROMVARS_MAXSIZE
132 at MENUPAGEITEM.szName, dw g_szItemCfgMaxSize
133 at MENUPAGEITEM.szInfo, dw g_szNfoCfgMaxSize
134 at MENUPAGEITEM.szHelp, dw g_szHelpCfgMaxSize
135 at MENUPAGEITEM.szDialog, dw g_szDlgCfgMaxSize
136 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
137 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_FLAG
138iend
139istruc MENUPAGEITEM ; Full operating mode
140 at MENUPAGEITEM.fnActivate, dw ConfigurationMenu_ActivateFullMode
141 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
142 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.wFlags
143 at MENUPAGEITEM.wValueMask, dw FLG_ROMVARS_FULLMODE
144 at MENUPAGEITEM.szName, dw g_szItemCfgFullMode
145 at MENUPAGEITEM.szInfo, dw g_szNfoCfgFullMode
146 at MENUPAGEITEM.szHelp, dw g_szHelpCfgFullMode
147 at MENUPAGEITEM.szDialog, dw g_szDlgCfgFullMode
148 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
149 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_FLAG
150iend
151g_MenuPageItemCfgStealRam:
152istruc MENUPAGEITEM ; kiB to steal from base RAM
153 at MENUPAGEITEM.fnActivate, dw MenuPageItem_GetByteFromUser
154 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
155 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.bStealSize
156 at MENUPAGEITEM.wValueMin, dw 1
157 at MENUPAGEITEM.wValueMax, dw 255
158 at MENUPAGEITEM.szName, dw g_szItemCfgStealSize
159 at MENUPAGEITEM.szInfo, dw g_szNfoCfgStealSize
160 at MENUPAGEITEM.szHelp, dw g_szHelpCfgStealSize
161 at MENUPAGEITEM.szDialog, dw g_szDlgCfgStealSize
162 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_UNSIGNED_BYTE
163iend
164g_MenuPageItemCfgIdeCnt:
165istruc MENUPAGEITEM ; Number of IDE controllers
166 at MENUPAGEITEM.fnActivate, dw ConfigurationMenu_ActivateControllerCount
167 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
168 at MENUPAGEITEM.pValue, dw g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.bIdeCnt
169 at MENUPAGEITEM.wValueMin, dw 1
170 at MENUPAGEITEM.wValueMax, dw 5
171 at MENUPAGEITEM.szName, dw g_szItemCfgIdeCnt
172 at MENUPAGEITEM.szInfo, dw g_szNfoCfgIdeCnt
173 at MENUPAGEITEM.szHelp, dw g_szNfoCfgIdeCnt
174 at MENUPAGEITEM.szDialog, dw g_szDlgCfgIdeCnt
175 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_UNSIGNED_BYTE
176iend
177
178
179; Section containing code
180SECTION .text
181
182;--------------------------------------------------------------------
183; ConfigurationMenu_ActivateIdeController
184; Parameters:
185; DS:SI Ptr to MENUPAGE
186; DS:DI Ptr to MENUPAGEITEM
187; SS:BP: Ptr to MENUVARS
188; Returns:
189; CF: Set if menuitem changed
190; Cleared if no changes
191; Corrupts registers:
192; AX, BX, CX, DX
193;--------------------------------------------------------------------
194ALIGN JUMP_ALIGN
195ConfigurationMenu_ActivateIdeController:
196 mov ax, [di+MENUPAGEITEM.pValue] ; AX=Offset to IDEVARS
197 call IdeControllerMenu_SetIdevarsOffset
198 call IdeControllerMenu_SetMenuitemVisibility
199 jmp MainPageItem_ActivateSubmenu
200
201
202;--------------------------------------------------------------------
203; ConfigurationMenu_ActivateFullMode
204; Parameters:
205; DS:SI Ptr to MENUPAGE
206; DS:DI Ptr to MENUPAGEITEM
207; SS:BP: Ptr to MENUVARS
208; Returns:
209; CF: Set if menuitem changed
210; Cleared if no changes
211; Corrupts registers:
212; AX, BX, CX, DX
213;--------------------------------------------------------------------
214ALIGN JUMP_ALIGN
215ConfigurationMenu_ActivateFullMode:
216 call MenuPageItem_GetBoolFromUser
217 jc SHORT ConfigurationMenu_SetMenuitemVisibilityAndDrawChanges
218 ret
219
220
221;--------------------------------------------------------------------
222; ConfigurationMenu_ActivateControllerCount
223; Parameters:
224; DS:SI Ptr to MENUPAGE
225; DS:DI Ptr to MENUPAGEITEM
226; SS:BP: Ptr to MENUVARS
227; Returns:
228; CF: Set if user data inputted succesfully
229; Cleared if cancel
230; Corrupts registers:
231; AX, BX, CX, DX
232;--------------------------------------------------------------------
233ALIGN JUMP_ALIGN
234ConfigurationMenu_ActivateControllerCount:
235 call MenuPageItem_GetByteFromUser
236 jc SHORT ConfigurationMenu_SetMenuitemVisibilityAndDrawChanges
237 ret
238
239
240;--------------------------------------------------------------------
241; ConfigurationMenu_ActivateBootLoaderType
242; Parameters:
243; DS:SI Ptr to MENUPAGE
244; DS:DI Ptr to MENUPAGEITEM
245; SS:BP: Ptr to MENUVARS
246; Returns:
247; CF: Set if user data inputted succesfully
248; Cleared if cancel
249; Corrupts registers:
250; AX, BX, CX, DX
251;--------------------------------------------------------------------
252ALIGN JUMP_ALIGN
253ConfigurationMenu_ActivateBootLoaderType:
254 call MainPageItem_ActivateSubmenuForGettingLookupValue
255 jc SHORT ConfigurationMenu_SetMenuitemVisibilityAndDrawChanges
256 ret
257
258
259;--------------------------------------------------------------------
260; ConfigurationMenu_SetMenuitemVisibilityAndDrawChanges
261; Parameters:
262; DS:SI: Ptr to MENUPAGE
263; SS:BP: Ptr to MENUVARS
264; Returns:
265; CF: Cleared since no need to draw changes
266; Corrupts registers:
267; AX, BX, CX, DX
268;--------------------------------------------------------------------
269ALIGN JUMP_ALIGN
270ConfigurationMenu_SetMenuitemVisibilityAndDrawChanges:
271 call ConfigurationMenu_SetMenuitemVisibility
272 call MenuPage_InvalidateItemCount
273 clc ; No need to redraw Full Mode menuitem
274 ret
275
276
277;--------------------------------------------------------------------
278; Enables or disables menuitems based on current configuration.
279;
280; ConfigurationMenu_SetMenuitemVisibility
281; Parameters:
282; DS: CS
283; Returns:
284; Nothing
285; Corrupts registers:
286; BX, CX
287;--------------------------------------------------------------------
288ALIGN JUMP_ALIGN
289ConfigurationMenu_SetMenuitemVisibility:
290 call ConfigurationMenu_SetBootMenuVisibility
291 call ConfigurationMenu_SetFullModeVisibility
292 jmp SHORT ConfigurationMenu_SetControllerCountVisibility
293
294ALIGN JUMP_ALIGN
295ConfigurationMenu_SetBootMenuVisibility:
296 cmp BYTE [g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.bBootLdrType], BOOTLOADER_TYPE_MENU
297 jne SHORT .DisableBootMenuSettings
298 or BYTE [g_MenuPageItemCfgBootMenu+MENUPAGEITEM.bFlags], FLG_MENUPAGEITEM_VISIBLE
299 ret
300ALIGN JUMP_ALIGN
301.DisableBootMenuSettings:
302 and BYTE [g_MenuPageItemCfgBootMenu+MENUPAGEITEM.bFlags], ~FLG_MENUPAGEITEM_VISIBLE
303 ret
304
305ALIGN JUMP_ALIGN
306ConfigurationMenu_SetFullModeVisibility:
307 test WORD [g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
308 jz SHORT .DisableFullModeMenuitems
309 or BYTE [g_MenuPageItemCfgStealRam+MENUPAGEITEM.bFlags], FLG_MENUPAGEITEM_VISIBLE
310 or BYTE [g_MenuPageItemCfgIdeCnt+MENUPAGEITEM.bFlags], FLG_MENUPAGEITEM_VISIBLE
311 ret
312ALIGN JUMP_ALIGN
313.DisableFullModeMenuitems:
314 and BYTE [g_MenuPageItemCfgStealRam+MENUPAGEITEM.bFlags], ~FLG_MENUPAGEITEM_VISIBLE
315 and BYTE [g_MenuPageItemCfgIdeCnt+MENUPAGEITEM.bFlags], ~FLG_MENUPAGEITEM_VISIBLE
316 ret
317
318ALIGN JUMP_ALIGN
319ConfigurationMenu_SetControllerCountVisibility:
320 call ConfigurationMenu_HideAdditionalIdeControllers
321 jmp SHORT ConfigurationMenu_ShowAdditionalIdeControllers
322
323;--------------------------------------------------------------------
324; Hides all additional (not primary) IDE controller menuitems.
325;
326; ConfigurationMenu_HideAdditionalIdeControllers
327; Parameters:
328; DS: CS
329; Returns:
330; Nothing
331; Corrupts registers:
332; BX, CX
333;--------------------------------------------------------------------
334ALIGN JUMP_ALIGN
335ConfigurationMenu_HideAdditionalIdeControllers:
336 mov bx, g_MenuPageItemCfgIde2+MENUPAGEITEM.bFlags
337 mov cx, CNT_MAX_CTRLS-1
338ALIGN JUMP_ALIGN
339.FlagLoop:
340 and BYTE [bx], ~FLG_MENUPAGEITEM_VISIBLE
341 add bx, MENUPAGEITEM_size
342 loop .FlagLoop
343 ret
344
345;--------------------------------------------------------------------
346; Sets all additional (after primary) IDE controller menuitems visible.
347;
348; ConfigurationMenu_ShowAdditionalIdeControllers
349; Parameters:
350; DS: CS
351; Returns:
352; Nothing
353; Corrupts registers:
354; BX, CX
355;--------------------------------------------------------------------
356ALIGN JUMP_ALIGN
357ConfigurationMenu_ShowAdditionalIdeControllers:
358 call ConfigurationMenu_GetNumberOfIdeControllers
359 dec cx ; First always visible
360 jcxz .Return
361 mov bx, g_MenuPageItemCfgIde2+MENUPAGEITEM.bFlags
362ALIGN JUMP_ALIGN
363.FlagLoop:
364 or BYTE [bx], FLG_MENUPAGEITEM_VISIBLE
365 add bx, MENUPAGEITEM_size
366 loop .FlagLoop
367.Return:
368 ret
369
370;--------------------------------------------------------------------
371; Returns number of IDE controllers to set visible.
372;
373; ConfigurationMenu_GetNumberOfIdeControllers
374; Parameters:
375; DS: CS
376; Returns:
377; CX: Number of selected IDE controllers
378; Corrupts registers:
379; Nothing
380;--------------------------------------------------------------------
381ALIGN JUMP_ALIGN
382ConfigurationMenu_GetNumberOfIdeControllers:
383 test WORD [g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
384 jz SHORT .ReturnOneControllerForLiteMode
385 eMOVZX cx, BYTE [g_cfgVars+CFGVARS.rgbEepromBuffers+ROMVARS.bIdeCnt]
386 ret
387ALIGN JUMP_ALIGN
388.ReturnOneControllerForLiteMode:
389 mov cx, 1
390 ret
Note: See TracBrowser for help on using the repository browser.