source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/ConfigurationMenu.asm@ 59

Last change on this file since 59 was 59, checked in by Tomi Tilli, 14 years ago

Changes to Configuration Program v2:

  • Menu structure should now be complete.
File size: 12.2 KB
Line 
1; File name : ConfigurationMenu.asm
2; Project name : XTIDE Universal BIOS Configurator v2
3; Created date : 24.10.2010
4; Last update : 18.11.2010
5; Author : Tomi Tilli
6; Description : "Configure XTIDE Universal BIOS" menu structs and functions.
7
8; Section containing initialized data
9SECTION .data
10
11ALIGN WORD_ALIGN
12g_MenupageForConfigurationMenu:
13istruc MENUPAGE
14 at MENUPAGE.fnEnter, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility
15 at MENUPAGE.fnBack, dw MainMenu_EnterMenuOrModifyItemVisibility
16 at MENUPAGE.wMenuitems, dw 11
17iend
18
19g_MenuitemConfigurationBackToMainMenu:
20istruc MENUITEM
21 at MENUITEM.fnActivate, dw MainMenu_EnterMenuOrModifyItemVisibility
22 at MENUITEM.szName, dw g_szItemCfgBackToMain
23 at MENUITEM.szQuickInfo, dw g_szItemCfgBackToMain
24 at MENUITEM.szHelp, dw g_szItemCfgBackToMain
25 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
26 at MENUITEM.bType, db TYPE_MENUITEM_PAGEBACK
27iend
28
29g_MenuitemConfigurationPrimaryIdeController:
30istruc MENUITEM
31 at MENUITEM.fnActivate, dw PrimaryIdeController
32 at MENUITEM.szName, dw g_szItemCfgIde1
33 at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
34 at MENUITEM.szHelp, dw g_szNfoCfgIde
35 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
36 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
37iend
38
39g_MenuitemConfigurationSecondaryIdeController:
40istruc MENUITEM
41 at MENUITEM.fnActivate, dw SecondaryIdeController
42 at MENUITEM.szName, dw g_szItemCfgIde2
43 at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
44 at MENUITEM.szHelp, dw g_szNfoCfgIde
45 at MENUITEM.bFlags, db NULL
46 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
47iend
48
49g_MenuitemConfigurationTertiaryIdeController:
50istruc MENUITEM
51 at MENUITEM.fnActivate, dw TertiaryIdeController
52 at MENUITEM.szName, dw g_szItemCfgIde3
53 at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
54 at MENUITEM.szHelp, dw g_szNfoCfgIde
55 at MENUITEM.bFlags, db NULL
56 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
57iend
58
59g_MenuitemConfigurationQuaternaryIdeController:
60istruc MENUITEM
61 at MENUITEM.fnActivate, dw QuaternaryIdeController
62 at MENUITEM.szName, dw g_szItemCfgIde4
63 at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
64 at MENUITEM.szHelp, dw g_szNfoCfgIde
65 at MENUITEM.bFlags, db NULL
66 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
67iend
68
69g_MenuitemConfigurationQuinaryIdeController:
70istruc MENUITEM
71 at MENUITEM.fnActivate, dw QuinaryIdeController
72 at MENUITEM.szName, dw g_szItemCfgIde5
73 at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
74 at MENUITEM.szHelp, dw g_szNfoCfgIde
75 at MENUITEM.bFlags, db NULL
76 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
77iend
78
79g_MenuitemConfigurationBootMenuSettings:
80istruc MENUITEM
81 at MENUITEM.fnActivate, dw BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility
82 at MENUITEM.szName, dw g_szItemCfgBootMenu
83 at MENUITEM.szQuickInfo, dw g_szNfoCfgBootMenu
84 at MENUITEM.szHelp, dw g_szNfoCfgBootMenu
85 at MENUITEM.bFlags, db NULL
86 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
87iend
88
89g_MenuitemConfigurationBootLoaderType:
90istruc MENUITEM
91 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiseSelectionForMenuitemInDSSI
92 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
93 at MENUITEM.szName, dw g_szItemCfgBootLoader
94 at MENUITEM.szQuickInfo, dw g_szNfoCfgBootLoader
95 at MENUITEM.szHelp, dw g_szNfoCfgBootLoader
96 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE
97 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOISE
98 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bBootLdrType
99 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szItemCfgBootLoader
100 at MENUITEM.itemValue + ITEM_VALUE.szMultichoise, dw g_szMultichoiseCfgBootLoader
101 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiseToValueLookup, dw g_rgwChoiseToValueLookupForBootLoaderType
102 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForBootLoaderType
103iend
104
105g_MenuitemConfigurationFullOperatingMode:
106istruc MENUITEM
107 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiseSelectionForMenuitemInDSSI
108 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
109 at MENUITEM.szName, dw g_szItemCfgFullMode
110 at MENUITEM.szQuickInfo, dw g_szNfoCfgFullMode
111 at MENUITEM.szHelp, dw g_szHelpCfgFullMode
112 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
113 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOISE
114 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wFlags
115 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgFullMode
116 at MENUITEM.itemValue + ITEM_VALUE.szMultichoise, dw g_szMultichoiseBooleanFlag
117 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
118 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_ROMVARS_FULLMODE
119iend
120
121g_MenuitemConfigurationKiBtoStealFromRAM:
122istruc MENUITEM
123 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
124 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
125 at MENUITEM.szName, dw g_szItemCfgStealSize
126 at MENUITEM.szQuickInfo, dw g_szNfoCfgStealSize
127 at MENUITEM.szHelp, dw g_szHelpCfgStealSize
128 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE
129 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
130 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bStealSize
131 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgStealSize
132 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
133 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 255
134iend
135
136g_MenuitemConfigurationIdeControllers:
137istruc MENUITEM
138 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
139 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
140 at MENUITEM.szName, dw g_szItemCfgIdeCnt
141 at MENUITEM.szQuickInfo, dw g_szNfoCfgIdeCnt
142 at MENUITEM.szHelp, dw g_szNfoCfgIdeCnt
143 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE
144 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
145 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bIdeCnt
146 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgIdeCnt
147 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
148 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 5
149iend
150
151
152g_rgwChoiseToValueLookupForBootLoaderType:
153 dw BOOTLOADER_TYPE_MENU
154 dw BOOTLOADER_TYPE_SIMPLE
155 dw BOOTLOADER_TYPE_NONE
156g_rgszValueToStringLookupForBootLoaderType:
157 dw g_szValueCfgBootLoaderMenu
158 dw g_szValueCfgBootLoaderAthenC
159 dw g_szUnidentified
160 dw g_szValueCfgBootLoaderSystem
161
162
163; Section containing code
164SECTION .text
165
166;--------------------------------------------------------------------
167; MainMenu_EnterMenuOrModifyItemVisibility
168; Parameters:
169; SS:BP: Menu handle
170; Returns:
171; Nothing
172; Corrupts registers:
173; All, except BP
174;--------------------------------------------------------------------
175ALIGN JUMP_ALIGN
176ConfigurationMenu_EnterMenuOrModifyItemVisibility:
177 push cs
178 pop ds
179 call .DisableAllIdeControllerMenuitems
180 call .EnableIdeControllerMenuitemsBasedOnConfiguration
181 call .EnableOrDisableBootMenuSettings
182 call .EnableOrDisableKiBtoStealFromRAM
183 call .EnableOrDisableIdeControllerCount
184 mov si, g_MenupageForConfigurationMenu
185 jmp Menupage_ChangeToNewMenupageInDSSI
186
187;--------------------------------------------------------------------
188; .DisableAllIdeControllerMenuitems
189; .EnableIdeControllerMenuitemsBasedOnConfiguration
190; Parameters:
191; SS:BP: Menu handle
192; Returns:
193; Nothing
194; Corrupts registers:
195; AX, BX, CX
196;--------------------------------------------------------------------
197ALIGN JUMP_ALIGN
198.DisableAllIdeControllerMenuitems:
199 mov cx, MAX_ALLOWED_IDE_CONTROLLERS-1
200 mov bx, g_MenuitemConfigurationSecondaryIdeController
201ALIGN JUMP_ALIGN
202.DisableNextIdeControllerMenuitem:
203 call .DisableMenuitemFromCSBX
204 add bx, BYTE MENUITEM_size
205 loop .DisableNextIdeControllerMenuitem
206 ret
207
208ALIGN JUMP_ALIGN
209.EnableIdeControllerMenuitemsBasedOnConfiguration:
210 call .GetIdeControllerCountToCX
211 dec cx ; Primary always enabled
212 jcxz .PrimaryControllerAlreadyEnabled
213 mov bx, g_MenuitemConfigurationSecondaryIdeController
214ALIGN JUMP_ALIGN
215.EnableNextIdeControllerMenuitem:
216 call .EnableMenuitemFromCSBX
217 add bx, BYTE MENUITEM_size
218 loop .EnableNextIdeControllerMenuitem
219.PrimaryControllerAlreadyEnabled:
220 ret
221
222;--------------------------------------------------------------------
223; .GetIdeControllerCountToCX
224; Parameters:
225; SS:BP: Menu handle
226; Returns:
227; CX: Number of IDE controllers to configure
228; Corrupts registers:
229; AX, BX
230;--------------------------------------------------------------------
231ALIGN JUMP_ALIGN
232.GetIdeControllerCountToCX:
233 call Buffers_GetRomvarsFlagsToAX
234 test ax, FLG_ROMVARS_FULLMODE
235 jz SHORT .AllowOnlyOneIdeControllerInLiteMode
236
237 mov bx, ROMVARS.bIdeCnt
238 call Buffers_GetRomvarsValueToAXfromOffsetInBX
239 eMOVZX cx, al
240 ret
241ALIGN JUMP_ALIGN
242.AllowOnlyOneIdeControllerInLiteMode:
243 mov cx, 1
244 ret
245
246
247;--------------------------------------------------------------------
248; .EnableOrDisableBootMenuSettings
249; Parameters:
250; SS:BP: Menu handle
251; Returns:
252; Nothing
253; Corrupts registers:
254; AX, BX, CX
255;--------------------------------------------------------------------
256ALIGN JUMP_ALIGN
257.EnableOrDisableBootMenuSettings:
258 mov bx, ROMVARS.bBootLdrType
259 call Buffers_GetRomvarsValueToAXfromOffsetInBX
260 mov bx, g_MenuitemConfigurationBootMenuSettings
261 cmp ax, BYTE BOOTLOADER_TYPE_MENU
262 jne SHORT .DisableMenuitemFromCSBX
263 jmp SHORT .EnableMenuitemFromCSBX
264
265
266;--------------------------------------------------------------------
267; .EnableOrDisableKiBtoStealFromRAM
268; Parameters:
269; SS:BP: Menu handle
270; Returns:
271; Nothing
272; Corrupts registers:
273; AX, BX, CX
274;--------------------------------------------------------------------
275ALIGN JUMP_ALIGN
276.EnableOrDisableKiBtoStealFromRAM:
277 call Buffers_GetRomvarsFlagsToAX
278 mov bx, g_MenuitemConfigurationKiBtoStealFromRAM
279 test ax, FLG_ROMVARS_FULLMODE
280 jz SHORT .DisableMenuitemFromCSBX
281 jmp SHORT .EnableMenuitemFromCSBX
282
283;--------------------------------------------------------------------
284; .EnableOrDisableKiBtoStealFromRAM
285; Parameters:
286; SS:BP: Menu handle
287; Returns:
288; Nothing
289; Corrupts registers:
290; AX, BX
291;--------------------------------------------------------------------
292ALIGN JUMP_ALIGN
293.EnableOrDisableIdeControllerCount:
294 call Buffers_GetRomvarsFlagsToAX
295 mov bx, g_MenuitemConfigurationIdeControllers
296 test ax, FLG_ROMVARS_FULLMODE
297 jz SHORT .DisableMenuitemFromCSBX
298 jmp SHORT .EnableMenuitemFromCSBX
299
300;--------------------------------------------------------------------
301; .EnableMenuitemFromCSBX
302; .DisableMenuitemFromCSBX
303; Parameters:
304; CS:BX: Ptr to MENUITEM
305; Returns:
306; Nothing
307; Corrupts registers:
308; Nothing
309;--------------------------------------------------------------------
310ALIGN JUMP_ALIGN
311.EnableMenuitemFromCSBX:
312 or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
313 ret
314
315ALIGN JUMP_ALIGN
316.DisableMenuitemFromCSBX:
317 and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
318 ret
319
320
321
322;--------------------------------------------------------------------
323; MENUITEM activation functions (.fnActivate)
324; Parameters:
325; SS:BP: Ptr to MENU
326; Returns:
327; Nothing
328; Corrupts registers:
329; All, except segments
330;--------------------------------------------------------------------
331ALIGN JUMP_ALIGN
332PrimaryIdeController:
333 mov bx, ROMVARS.ideVars0
334 jmp SHORT DisplayIdeControllerMenu
335
336ALIGN JUMP_ALIGN
337SecondaryIdeController:
338 mov bx, ROMVARS.ideVars1
339 jmp SHORT DisplayIdeControllerMenu
340
341ALIGN JUMP_ALIGN
342TertiaryIdeController:
343 mov bx, ROMVARS.ideVars2
344 jmp SHORT DisplayIdeControllerMenu
345
346ALIGN JUMP_ALIGN
347QuaternaryIdeController:
348 mov bx, ROMVARS.ideVars3
349 jmp SHORT DisplayIdeControllerMenu
350
351ALIGN JUMP_ALIGN
352QuinaryIdeController:
353 mov bx, ROMVARS.ideVars4
354 ; Fall to DisplayIdeControllerMenu
355
356ALIGN JUMP_ALIGN
357DisplayIdeControllerMenu:
358 call IdeControllerMenu_InitializeToIdevarsOffsetInBX
359 jmp IdeControllerMenu_EnterMenuOrModifyItemVisibility
Note: See TracBrowser for help on using the repository browser.