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

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