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