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 9
|
---|
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_MenuitemConfigurationBootMenuSettings:
|
---|
66 | istruc MENUITEM
|
---|
67 | at MENUITEM.fnActivate, dw BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility
|
---|
68 | at MENUITEM.szName, dw g_szItemCfgBootMenu
|
---|
69 | at MENUITEM.szQuickInfo, dw g_szNfoCfgBootMenu
|
---|
70 | at MENUITEM.szHelp, dw g_szNfoCfgBootMenu
|
---|
71 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
|
---|
72 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
|
---|
73 | iend
|
---|
74 |
|
---|
75 | g_MenuitemConfigurationFullOperatingMode:
|
---|
76 | istruc MENUITEM
|
---|
77 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
|
---|
78 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
|
---|
79 | at MENUITEM.szName, dw g_szItemCfgFullMode
|
---|
80 | at MENUITEM.szQuickInfo, dw g_szNfoCfgFullMode
|
---|
81 | at MENUITEM.szHelp, dw g_szHelpCfgFullMode
|
---|
82 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
|
---|
83 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
|
---|
84 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wFlags
|
---|
85 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgFullMode
|
---|
86 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
|
---|
87 | at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
|
---|
88 | at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_ROMVARS_FULLMODE
|
---|
89 | iend
|
---|
90 |
|
---|
91 | g_MenuitemConfigurationKiBtoStealFromRAM:
|
---|
92 | istruc MENUITEM
|
---|
93 | at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
|
---|
94 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
|
---|
95 | at MENUITEM.szName, dw g_szItemCfgStealSize
|
---|
96 | at MENUITEM.szQuickInfo, dw g_szNfoCfgStealSize
|
---|
97 | at MENUITEM.szHelp, dw g_szHelpCfgStealSize
|
---|
98 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE
|
---|
99 | at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
|
---|
100 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bStealSize
|
---|
101 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgStealSize
|
---|
102 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
|
---|
103 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 255
|
---|
104 | iend
|
---|
105 |
|
---|
106 | g_MenuitemConfigurationIdeControllers:
|
---|
107 | istruc MENUITEM
|
---|
108 | at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
|
---|
109 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
|
---|
110 | at MENUITEM.szName, dw g_szItemCfgIdeCnt
|
---|
111 | at MENUITEM.szQuickInfo, dw g_szNfoCfgIdeCnt
|
---|
112 | at MENUITEM.szHelp, dw g_szNfoCfgIdeCnt
|
---|
113 | at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE
|
---|
114 | at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
|
---|
115 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bIdeCnt
|
---|
116 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgIdeCnt
|
---|
117 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
|
---|
118 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 4
|
---|
119 | iend
|
---|
120 |
|
---|
121 |
|
---|
122 | ; Section containing code
|
---|
123 | SECTION .text
|
---|
124 |
|
---|
125 | ;--------------------------------------------------------------------
|
---|
126 | ; MainMenu_EnterMenuOrModifyItemVisibility
|
---|
127 | ; Parameters:
|
---|
128 | ; SS:BP: Menu handle
|
---|
129 | ; Returns:
|
---|
130 | ; Nothing
|
---|
131 | ; Corrupts registers:
|
---|
132 | ; All, except BP
|
---|
133 | ;--------------------------------------------------------------------
|
---|
134 | ALIGN JUMP_ALIGN
|
---|
135 | ConfigurationMenu_EnterMenuOrModifyItemVisibility:
|
---|
136 | push cs
|
---|
137 | pop ds
|
---|
138 | call .DisableAllIdeControllerMenuitems
|
---|
139 | call .EnableIdeControllerMenuitemsBasedOnConfiguration
|
---|
140 | call .EnableOrDisableKiBtoStealFromRAM
|
---|
141 | call .EnableOrDisableIdeControllerCount
|
---|
142 | mov si, g_MenupageForConfigurationMenu
|
---|
143 | jmp Menupage_ChangeToNewMenupageInDSSI
|
---|
144 |
|
---|
145 | ;--------------------------------------------------------------------
|
---|
146 | ; .DisableAllIdeControllerMenuitems
|
---|
147 | ; .EnableIdeControllerMenuitemsBasedOnConfiguration
|
---|
148 | ; Parameters:
|
---|
149 | ; SS:BP: Menu handle
|
---|
150 | ; Returns:
|
---|
151 | ; Nothing
|
---|
152 | ; Corrupts registers:
|
---|
153 | ; AX, BX, CX
|
---|
154 | ;--------------------------------------------------------------------
|
---|
155 | ALIGN JUMP_ALIGN
|
---|
156 | .DisableAllIdeControllerMenuitems:
|
---|
157 | mov cx, MAX_ALLOWED_IDE_CONTROLLERS-1
|
---|
158 | mov bx, g_MenuitemConfigurationSecondaryIdeController
|
---|
159 | ALIGN JUMP_ALIGN
|
---|
160 | .DisableNextIdeControllerMenuitem:
|
---|
161 | call .DisableMenuitemFromCSBX
|
---|
162 | add bx, BYTE MENUITEM_size
|
---|
163 | loop .DisableNextIdeControllerMenuitem
|
---|
164 | ret
|
---|
165 |
|
---|
166 | ALIGN JUMP_ALIGN
|
---|
167 | .EnableIdeControllerMenuitemsBasedOnConfiguration:
|
---|
168 | call .GetIdeControllerCountToCX
|
---|
169 | dec cx ; Primary always enabled
|
---|
170 | jcxz .PrimaryControllerAlreadyEnabled
|
---|
171 | mov bx, g_MenuitemConfigurationSecondaryIdeController
|
---|
172 | ALIGN JUMP_ALIGN
|
---|
173 | .EnableNextIdeControllerMenuitem:
|
---|
174 | call .EnableMenuitemFromCSBX
|
---|
175 | add bx, BYTE MENUITEM_size
|
---|
176 | loop .EnableNextIdeControllerMenuitem
|
---|
177 | .PrimaryControllerAlreadyEnabled:
|
---|
178 | ret
|
---|
179 |
|
---|
180 | ;--------------------------------------------------------------------
|
---|
181 | ; .GetIdeControllerCountToCX
|
---|
182 | ; Parameters:
|
---|
183 | ; SS:BP: Menu handle
|
---|
184 | ; Returns:
|
---|
185 | ; CX: Number of IDE controllers to configure
|
---|
186 | ; Corrupts registers:
|
---|
187 | ; AX, BX
|
---|
188 | ;--------------------------------------------------------------------
|
---|
189 | ALIGN JUMP_ALIGN
|
---|
190 | .GetIdeControllerCountToCX:
|
---|
191 | call Buffers_GetRomvarsFlagsToAX
|
---|
192 | test ax, FLG_ROMVARS_FULLMODE
|
---|
193 | jz SHORT .AllowOnlyOneIdeControllerInLiteMode
|
---|
194 |
|
---|
195 | mov bx, ROMVARS.bIdeCnt
|
---|
196 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
197 | eMOVZX cx, al
|
---|
198 | ret
|
---|
199 | ALIGN JUMP_ALIGN
|
---|
200 | .AllowOnlyOneIdeControllerInLiteMode:
|
---|
201 | mov cx, 1
|
---|
202 | ret
|
---|
203 |
|
---|
204 | ;--------------------------------------------------------------------
|
---|
205 | ; .EnableOrDisableKiBtoStealFromRAM
|
---|
206 | ; Parameters:
|
---|
207 | ; SS:BP: Menu handle
|
---|
208 | ; Returns:
|
---|
209 | ; Nothing
|
---|
210 | ; Corrupts registers:
|
---|
211 | ; AX, BX, CX
|
---|
212 | ;--------------------------------------------------------------------
|
---|
213 | ALIGN JUMP_ALIGN
|
---|
214 | .EnableOrDisableKiBtoStealFromRAM:
|
---|
215 | call Buffers_GetRomvarsFlagsToAX
|
---|
216 | mov bx, g_MenuitemConfigurationKiBtoStealFromRAM
|
---|
217 | test ax, FLG_ROMVARS_FULLMODE
|
---|
218 | jz SHORT .DisableMenuitemFromCSBX
|
---|
219 | jmp SHORT .EnableMenuitemFromCSBX
|
---|
220 |
|
---|
221 | ;--------------------------------------------------------------------
|
---|
222 | ; .EnableOrDisableKiBtoStealFromRAM
|
---|
223 | ; Parameters:
|
---|
224 | ; SS:BP: Menu handle
|
---|
225 | ; Returns:
|
---|
226 | ; Nothing
|
---|
227 | ; Corrupts registers:
|
---|
228 | ; AX, BX
|
---|
229 | ;--------------------------------------------------------------------
|
---|
230 | ALIGN JUMP_ALIGN
|
---|
231 | .EnableOrDisableIdeControllerCount:
|
---|
232 | call Buffers_GetRomvarsFlagsToAX
|
---|
233 | mov bx, g_MenuitemConfigurationIdeControllers
|
---|
234 | test ax, FLG_ROMVARS_FULLMODE
|
---|
235 | jnz SHORT .EnableMenuitemFromCSBX
|
---|
236 | .LimitIdeControllerCountToOneForLiteMode:
|
---|
237 | call Buffers_GetFileBufferToESDI
|
---|
238 | mov BYTE [es:di+ROMVARS.bIdeCnt], 1
|
---|
239 | jmp SHORT .DisableMenuitemFromCSBX
|
---|
240 |
|
---|
241 | ;--------------------------------------------------------------------
|
---|
242 | ; .EnableMenuitemFromCSBX
|
---|
243 | ; .DisableMenuitemFromCSBX
|
---|
244 | ; Parameters:
|
---|
245 | ; CS:BX: Ptr to MENUITEM
|
---|
246 | ; Returns:
|
---|
247 | ; Nothing
|
---|
248 | ; Corrupts registers:
|
---|
249 | ; Nothing
|
---|
250 | ;--------------------------------------------------------------------
|
---|
251 | ALIGN JUMP_ALIGN
|
---|
252 | .EnableMenuitemFromCSBX:
|
---|
253 | or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
254 | ret
|
---|
255 |
|
---|
256 | ALIGN JUMP_ALIGN
|
---|
257 | .DisableMenuitemFromCSBX:
|
---|
258 | and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
|
---|
259 | ret
|
---|
260 |
|
---|
261 |
|
---|
262 |
|
---|
263 | ;--------------------------------------------------------------------
|
---|
264 | ; MENUITEM activation functions (.fnActivate)
|
---|
265 | ; Parameters:
|
---|
266 | ; SS:BP: Ptr to MENU
|
---|
267 | ; Returns:
|
---|
268 | ; Nothing
|
---|
269 | ; Corrupts registers:
|
---|
270 | ; All, except segments
|
---|
271 | ;--------------------------------------------------------------------
|
---|
272 | ALIGN JUMP_ALIGN
|
---|
273 | PrimaryIdeController:
|
---|
274 | mov bx, ROMVARS.ideVars0
|
---|
275 | jmp SHORT DisplayIdeControllerMenu
|
---|
276 |
|
---|
277 | ALIGN JUMP_ALIGN
|
---|
278 | SecondaryIdeController:
|
---|
279 | mov bx, ROMVARS.ideVars1
|
---|
280 | jmp SHORT DisplayIdeControllerMenu
|
---|
281 |
|
---|
282 | ALIGN JUMP_ALIGN
|
---|
283 | TertiaryIdeController:
|
---|
284 | mov bx, ROMVARS.ideVars2
|
---|
285 | jmp SHORT DisplayIdeControllerMenu
|
---|
286 |
|
---|
287 | ALIGN JUMP_ALIGN
|
---|
288 | QuaternaryIdeController:
|
---|
289 | mov bx, ROMVARS.ideVars3
|
---|
290 | ; Fall to DisplayIdeControllerMenu
|
---|
291 |
|
---|
292 | ALIGN JUMP_ALIGN
|
---|
293 | DisplayIdeControllerMenu:
|
---|
294 | call IdeControllerMenu_InitializeToIdevarsOffsetInBX
|
---|
295 | jmp IdeControllerMenu_EnterMenuOrModifyItemVisibility
|
---|