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