1 | ; Project name : XTIDE Universal BIOS Configurator v2
|
---|
2 | ; Description : "Configure XTIDE Universal BIOS" menu structs and functions.
|
---|
3 |
|
---|
4 | ;
|
---|
5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2023 by XTIDE Universal BIOS Team.
|
---|
7 | ;
|
---|
8 | ; This program is free software; you can redistribute it and/or modify
|
---|
9 | ; it under the terms of the GNU General Public License as published by
|
---|
10 | ; the Free Software Foundation; either version 2 of the License, or
|
---|
11 | ; (at your option) any later version.
|
---|
12 | ;
|
---|
13 | ; This program is distributed in the hope that it will be useful,
|
---|
14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | ; GNU General Public License for more details.
|
---|
17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
18 | ;
|
---|
19 |
|
---|
20 | ; Section containing initialized data
|
---|
21 | SECTION .data
|
---|
22 |
|
---|
23 | ALIGN WORD_ALIGN
|
---|
24 | g_MenupageForConfigurationMenu:
|
---|
25 | istruc MENUPAGE
|
---|
26 | at MENUPAGE.fnEnter, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility
|
---|
27 | at MENUPAGE.fnBack, dw MainMenu_EnterMenuOrModifyItemVisibility
|
---|
28 | at MENUPAGE.wMenuitems, dw 12
|
---|
29 | iend
|
---|
30 |
|
---|
31 | g_MenuitemConfigurationBackToMainMenu:
|
---|
32 | istruc MENUITEM
|
---|
33 | at MENUITEM.fnActivate, dw MainMenu_EnterMenuOrModifyItemVisibility
|
---|
34 | at MENUITEM.szName, dw g_szItemCfgBackToMain
|
---|
35 | at MENUITEM.szQuickInfo, dw g_szItemCfgBackToMain
|
---|
36 | at MENUITEM.szHelp, dw g_szItemCfgBackToMain
|
---|
37 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
|
---|
38 | at MENUITEM.bType, db TYPE_MENUITEM_PAGEBACK
|
---|
39 | iend
|
---|
40 |
|
---|
41 | g_MenuitemConfigurationPrimaryIdeController:
|
---|
42 | istruc MENUITEM
|
---|
43 | at MENUITEM.fnActivate, dw PrimaryIdeController
|
---|
44 | at MENUITEM.szName, dw g_szItemCfgIde1
|
---|
45 | at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
|
---|
46 | at MENUITEM.szHelp, dw g_szNfoCfgIde
|
---|
47 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
|
---|
48 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
|
---|
49 | iend
|
---|
50 |
|
---|
51 | g_MenuitemConfigurationSecondaryIdeController:
|
---|
52 | istruc MENUITEM
|
---|
53 | at MENUITEM.fnActivate, dw SecondaryIdeController
|
---|
54 | at MENUITEM.szName, dw g_szItemCfgIde2
|
---|
55 | at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
|
---|
56 | at MENUITEM.szHelp, dw g_szNfoCfgIde
|
---|
57 | at MENUITEM.bFlags, db NULL
|
---|
58 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
|
---|
59 | iend
|
---|
60 |
|
---|
61 | g_MenuitemConfigurationTertiaryIdeController:
|
---|
62 | istruc MENUITEM
|
---|
63 | at MENUITEM.fnActivate, dw TertiaryIdeController
|
---|
64 | at MENUITEM.szName, dw g_szItemCfgIde3
|
---|
65 | at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
|
---|
66 | at MENUITEM.szHelp, dw g_szNfoCfgIde
|
---|
67 | at MENUITEM.bFlags, db NULL
|
---|
68 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
|
---|
69 | iend
|
---|
70 |
|
---|
71 | g_MenuitemConfigurationQuaternaryIdeController:
|
---|
72 | istruc MENUITEM
|
---|
73 | at MENUITEM.fnActivate, dw QuaternaryIdeController
|
---|
74 | at MENUITEM.szName, dw g_szItemCfgIde4
|
---|
75 | at MENUITEM.szQuickInfo, dw g_szNfoCfgIde
|
---|
76 | at MENUITEM.szHelp, dw g_szNfoCfgIde
|
---|
77 | at MENUITEM.bFlags, db NULL
|
---|
78 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
|
---|
79 | iend
|
---|
80 |
|
---|
81 | g_MenuitemConfigurationBootMenuSettings:
|
---|
82 | istruc MENUITEM
|
---|
83 | at MENUITEM.fnActivate, dw BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility
|
---|
84 | at MENUITEM.szName, dw g_szItemCfgBootMenu
|
---|
85 | at MENUITEM.szQuickInfo, dw g_szNfoCfgBootMenu
|
---|
86 | at MENUITEM.szHelp, dw g_szNfoCfgBootMenu
|
---|
87 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
|
---|
88 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
|
---|
89 | iend
|
---|
90 |
|
---|
91 | g_MenuitemAutoConfigure:
|
---|
92 | istruc MENUITEM
|
---|
93 | at MENUITEM.fnActivate, dw AutoConfigure_ForThisSystem
|
---|
94 | at MENUITEM.szName, dw g_szItemAutoConfigure
|
---|
95 | at MENUITEM.szQuickInfo, dw g_szNfoAutoConfigure
|
---|
96 | at MENUITEM.szHelp, dw g_szNfoAutoConfigure
|
---|
97 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU
|
---|
98 | at MENUITEM.bType, db TYPE_MENUITEM_ACTION
|
---|
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_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 | at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw WriteFullOperatingMode
|
---|
116 | iend
|
---|
117 |
|
---|
118 | g_MenuitemConfigurationRamVars:
|
---|
119 | istruc MENUITEM
|
---|
120 | at MENUITEM.fnActivate, dw Menuitem_ActivateHexInputForMenuitemInDSSI
|
---|
121 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
|
---|
122 | at MENUITEM.szName, dw g_szItemCfgRamVars
|
---|
123 | at MENUITEM.szQuickInfo, dw g_szNfoCfgRamVars
|
---|
124 | at MENUITEM.szHelp, dw g_szHelpCfgRamVars
|
---|
125 | at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU
|
---|
126 | at MENUITEM.bType, db TYPE_MENUITEM_HEX
|
---|
127 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wRamVars
|
---|
128 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgRamVars
|
---|
129 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 0A000h
|
---|
130 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 0FFFFh ; Disables use of UMB
|
---|
131 | at MENUITEM.itemValue + ITEM_VALUE.fnValueReader, dw ReadRamVars
|
---|
132 | at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw WriteRamVars
|
---|
133 | iend
|
---|
134 |
|
---|
135 | g_MenuitemConfigurationKiBtoStealFromRAM:
|
---|
136 | istruc MENUITEM
|
---|
137 | at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
|
---|
138 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
|
---|
139 | at MENUITEM.szName, dw g_szItemCfgStealSize
|
---|
140 | at MENUITEM.szQuickInfo, dw g_szNfoCfgStealSize
|
---|
141 | at MENUITEM.szHelp, dw g_szHelpCfgStealSize
|
---|
142 | at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE
|
---|
143 | at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
|
---|
144 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bStealSize
|
---|
145 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgStealSize
|
---|
146 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
|
---|
147 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 255
|
---|
148 | iend
|
---|
149 |
|
---|
150 | g_MenuitemConfigurationIdeControllers:
|
---|
151 | istruc MENUITEM
|
---|
152 | at MENUITEM.fnActivate, dw ActivateInputForNumberOfIdeControllersMenuitemInDSSI
|
---|
153 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
|
---|
154 | at MENUITEM.szName, dw g_szItemCfgIdeCnt
|
---|
155 | at MENUITEM.szQuickInfo, dw g_szNfoCfgIdeCnt
|
---|
156 | at MENUITEM.szHelp, dw g_szNfoCfgIdeCnt
|
---|
157 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE
|
---|
158 | at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
|
---|
159 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bIdeCnt
|
---|
160 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgIdeCnt
|
---|
161 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
|
---|
162 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw MAX_ALLOWED_IDE_CONTROLLERS
|
---|
163 | iend
|
---|
164 |
|
---|
165 | g_MenuitemConfigurationIdleTimeout:
|
---|
166 | istruc MENUITEM
|
---|
167 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
|
---|
168 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI
|
---|
169 | at MENUITEM.szName, dw g_szItemCfgIdleTimeout
|
---|
170 | at MENUITEM.szQuickInfo, dw g_szNfoCfgIdleTimeout
|
---|
171 | at MENUITEM.szHelp, dw g_szHelpCfgIdleTimeout
|
---|
172 | at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS
|
---|
173 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
|
---|
174 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bIdleTimeout
|
---|
175 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgIdleTimeout
|
---|
176 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceIdleTimeout
|
---|
177 | at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForIdleTimeout
|
---|
178 | at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForIdleTimeout
|
---|
179 | iend
|
---|
180 |
|
---|
181 | g_rgwChoiceToValueLookupForIdleTimeout:
|
---|
182 | %assign i -12
|
---|
183 | %rep 21
|
---|
184 | %assign i i+12
|
---|
185 | dw i ; i / 12 = 0 (disabled) or 1...20 minutes
|
---|
186 | %endrep
|
---|
187 | %rep 4
|
---|
188 | %assign i i+1
|
---|
189 | dw i ; 241...244 = (i - 240) * 30 minutes
|
---|
190 | %endrep
|
---|
191 | g_rgszChoiceToStringLookupForIdleTimeout:
|
---|
192 | %assign i 0
|
---|
193 | %rep 25
|
---|
194 | dw g_szIdleTimeoutChoice%[i]
|
---|
195 | %assign i i+1
|
---|
196 | %endrep
|
---|
197 | dw NULL
|
---|
198 |
|
---|
199 |
|
---|
200 | ; Section containing code
|
---|
201 | SECTION .text
|
---|
202 |
|
---|
203 | ;--------------------------------------------------------------------
|
---|
204 | ; MainMenu_EnterMenuOrModifyItemVisibility
|
---|
205 | ; Parameters:
|
---|
206 | ; SS:BP: Menu handle
|
---|
207 | ; Returns:
|
---|
208 | ; Nothing
|
---|
209 | ; Corrupts registers:
|
---|
210 | ; All, except BP
|
---|
211 | ;--------------------------------------------------------------------
|
---|
212 | ALIGN JUMP_ALIGN
|
---|
213 | ConfigurationMenu_EnterMenuOrModifyItemVisibility:
|
---|
214 | push cs
|
---|
215 | pop ds
|
---|
216 | call .DisableAllIdeControllerMenuitems
|
---|
217 | call .EnableIdeControllerMenuitemsBasedOnConfiguration
|
---|
218 | call .EnableOrDisableOperatingModeSelection
|
---|
219 | call Buffers_GetRomvarsFlagsToAX
|
---|
220 | call .EnableOrDisableRamVarsSegmentSelection
|
---|
221 | call .EnableOrDisableKiBtoStealFromRAM
|
---|
222 | call .EnableOrDisableIdleTimeout
|
---|
223 | call LimitIdeControllersForLiteMode
|
---|
224 | mov si, g_MenupageForConfigurationMenu
|
---|
225 | jmp Menupage_ChangeToNewMenupageInDSSI
|
---|
226 |
|
---|
227 | ;--------------------------------------------------------------------
|
---|
228 | ; .DisableAllIdeControllerMenuitems
|
---|
229 | ; .EnableIdeControllerMenuitemsBasedOnConfiguration
|
---|
230 | ; Parameters:
|
---|
231 | ; SS:BP: Menu handle
|
---|
232 | ; Returns:
|
---|
233 | ; Nothing
|
---|
234 | ; Corrupts registers:
|
---|
235 | ; AX, BX, CX, DI, ES
|
---|
236 | ;--------------------------------------------------------------------
|
---|
237 | ALIGN JUMP_ALIGN
|
---|
238 | .DisableAllIdeControllerMenuitems:
|
---|
239 | mov cx, MAX_ALLOWED_IDE_CONTROLLERS-1
|
---|
240 | mov ax, DisableMenuitemFromCSBX
|
---|
241 | jmp SHORT .Go
|
---|
242 |
|
---|
243 | ALIGN JUMP_ALIGN
|
---|
244 | .EnableIdeControllerMenuitemsBasedOnConfiguration:
|
---|
245 | call Buffers_GetIdeControllerCountToCX
|
---|
246 | dec cx ; Primary always enabled
|
---|
247 | jz SHORT .PrimaryControllerAlreadyEnabled
|
---|
248 | mov ax, EnableMenuitemFromCSBX
|
---|
249 | .Go:
|
---|
250 | mov bx, g_MenuitemConfigurationSecondaryIdeController
|
---|
251 | ALIGN JUMP_ALIGN
|
---|
252 | .EnableOrDisableNextIdeControllerMenuitem:
|
---|
253 | call ax
|
---|
254 | add bx, BYTE MENUITEM_size
|
---|
255 | loop .EnableOrDisableNextIdeControllerMenuitem
|
---|
256 | .PrimaryControllerAlreadyEnabled:
|
---|
257 | ret
|
---|
258 |
|
---|
259 |
|
---|
260 | ;--------------------------------------------------------------------
|
---|
261 | ; .EnableOrDisableOperatingModeSelection
|
---|
262 | ; Parameters:
|
---|
263 | ; SS:BP: Menu handle
|
---|
264 | ; Returns:
|
---|
265 | ; Nothing
|
---|
266 | ; Corrupts registers:
|
---|
267 | ; BX
|
---|
268 | ;--------------------------------------------------------------------
|
---|
269 | ALIGN JUMP_ALIGN
|
---|
270 | .EnableOrDisableOperatingModeSelection:
|
---|
271 | mov bx, g_MenuitemConfigurationFullOperatingMode
|
---|
272 | call Buffers_IsXTbuildLoaded
|
---|
273 | jz SHORT .EnableMenuitemFromCSBX
|
---|
274 | jmp SHORT .DisableMenuitemFromCSBX
|
---|
275 |
|
---|
276 |
|
---|
277 | ;--------------------------------------------------------------------
|
---|
278 | ; .EnableOrDisableRamVarsSegmentSelection
|
---|
279 | ; Parameters:
|
---|
280 | ; AX: ROMVARS.wFlags
|
---|
281 | ; SS:BP: Menu handle
|
---|
282 | ; Returns:
|
---|
283 | ; Nothing
|
---|
284 | ; Corrupts registers:
|
---|
285 | ; BX
|
---|
286 | ;--------------------------------------------------------------------
|
---|
287 | ALIGN JUMP_ALIGN
|
---|
288 | .EnableOrDisableRamVarsSegmentSelection:
|
---|
289 | mov bx, g_MenuitemConfigurationRamVars
|
---|
290 | test al, FLG_ROMVARS_FULLMODE
|
---|
291 | jz SHORT .DisableMenuitemFromCSBX
|
---|
292 | jmp SHORT .EnableMenuitemFromCSBX
|
---|
293 |
|
---|
294 |
|
---|
295 | ;--------------------------------------------------------------------
|
---|
296 | ; .EnableOrDisableKiBtoStealFromRAM
|
---|
297 | ; Parameters:
|
---|
298 | ; SS:BP: Menu handle
|
---|
299 | ; Returns:
|
---|
300 | ; Nothing
|
---|
301 | ; Corrupts registers:
|
---|
302 | ; BX
|
---|
303 | ;--------------------------------------------------------------------
|
---|
304 | ALIGN JUMP_ALIGN
|
---|
305 | .EnableOrDisableKiBtoStealFromRAM:
|
---|
306 | mov bx, g_MenuitemConfigurationKiBtoStealFromRAM
|
---|
307 | cmp WORD [es:ROMVARS.wRamVars], 0
|
---|
308 | jne SHORT .DisableMenuitemFromCSBX
|
---|
309 | jmp SHORT .EnableMenuitemFromCSBX
|
---|
310 |
|
---|
311 |
|
---|
312 | ;--------------------------------------------------------------------
|
---|
313 | ; .EnableOrDisableIdleTimeout
|
---|
314 | ; Parameters:
|
---|
315 | ; AX: ROMVARS.wFlags
|
---|
316 | ; SS:BP: Menu handle
|
---|
317 | ; Returns:
|
---|
318 | ; Nothing
|
---|
319 | ; Corrupts registers:
|
---|
320 | ; BX
|
---|
321 | ;--------------------------------------------------------------------
|
---|
322 | ALIGN JUMP_ALIGN
|
---|
323 | .EnableOrDisableIdleTimeout:
|
---|
324 | mov bx, g_MenuitemConfigurationIdleTimeout
|
---|
325 | test al, FLG_ROMVARS_MODULE_POWER_MANAGEMENT
|
---|
326 | jz SHORT .DisableMenuitemFromCSBX
|
---|
327 | ; Fall to .EnableMenuitemFromCSBX
|
---|
328 |
|
---|
329 |
|
---|
330 | ;--------------------------------------------------------------------
|
---|
331 | ; .EnableMenuitemFromCSBX
|
---|
332 | ; .DisableMenuitemFromCSBX
|
---|
333 | ; Parameters:
|
---|
334 | ; CS:BX: Ptr to MENUITEM
|
---|
335 | ; Returns:
|
---|
336 | ; Nothing
|
---|
337 | ; Corrupts registers:
|
---|
338 | ; Nothing
|
---|
339 | ;--------------------------------------------------------------------
|
---|
340 | ALIGN JUMP_ALIGN
|
---|
341 | .EnableMenuitemFromCSBX:
|
---|
342 | jmp EnableMenuitemFromCSBX
|
---|
343 |
|
---|
344 | ALIGN JUMP_ALIGN
|
---|
345 | .DisableMenuitemFromCSBX:
|
---|
346 | jmp DisableMenuitemFromCSBX
|
---|
347 |
|
---|
348 |
|
---|
349 | ;--------------------------------------------------------------------
|
---|
350 | ; WriteFullOperatingMode
|
---|
351 | ; Parameters:
|
---|
352 | ; AX: Value that the MENUITEM system was interacting with
|
---|
353 | ; ES:DI: ROMVARS location where the value is to be stored
|
---|
354 | ; DS:SI: MENUITEM pointer
|
---|
355 | ; Returns:
|
---|
356 | ; AX: Value to actually write to ROMVARS
|
---|
357 | ; Corrupts registers:
|
---|
358 | ; BX
|
---|
359 | ;--------------------------------------------------------------------
|
---|
360 | ALIGN JUMP_ALIGN
|
---|
361 | WriteFullOperatingMode:
|
---|
362 | test ax, ax ; FOM disabled?
|
---|
363 | mov bx, LITE_MODE_RAMVARS_SEGMENT
|
---|
364 | jz SHORT .WriteDefaultValueToRamVars ; Yes, Lite mode it is
|
---|
365 | xor bx, bx ; No, use Conventional memory
|
---|
366 | .WriteDefaultValueToRamVars:
|
---|
367 | mov [es:ROMVARS.wRamVars], bx
|
---|
368 | ret
|
---|
369 |
|
---|
370 |
|
---|
371 | ;--------------------------------------------------------------------
|
---|
372 | ; ReadRamVars
|
---|
373 | ; Parameters:
|
---|
374 | ; AX: Value read from the ROMVARS location
|
---|
375 | ; ES:DI: ROMVARS location where the value was just read from
|
---|
376 | ; DS:SI: MENUITEM pointer
|
---|
377 | ; Returns:
|
---|
378 | ; AX: Value that the MENUITEM system will interact with and display
|
---|
379 | ; Corrupts registers:
|
---|
380 | ; Nothing
|
---|
381 | ;--------------------------------------------------------------------
|
---|
382 | ALIGN JUMP_ALIGN
|
---|
383 | ReadRamVars:
|
---|
384 | test ax, ax
|
---|
385 | jz SHORT .PrintNoInsteadOfValue
|
---|
386 | cmp ax, LITE_MODE_RAMVARS_SEGMENT
|
---|
387 | jne SHORT WriteRamVars.Return
|
---|
388 |
|
---|
389 | .PrintNoInsteadOfValue:
|
---|
390 | push si
|
---|
391 | mov si, g_szNo
|
---|
392 | CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
|
---|
393 | pop si
|
---|
394 | ; This is a humongous hack. The menu system should not be (ab)used like this.
|
---|
395 | pop ax ; Return from ReadRamVars to Menuitem_GetValueToAXfromMenuitemInDSSI
|
---|
396 | pop bx ; Restore registers
|
---|
397 | pop di
|
---|
398 | pop es
|
---|
399 | pop ax ; Return from Menuitem_GetValueToAXfromMenuitemInDSSI to MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
|
---|
400 | jmp MenuitemPrint_FinishPrintingUnsignedOrHexValue
|
---|
401 |
|
---|
402 |
|
---|
403 | ;--------------------------------------------------------------------
|
---|
404 | ; WriteRamVars
|
---|
405 | ; Parameters:
|
---|
406 | ; AX: Value that the MENUITEM system was interacting with
|
---|
407 | ; ES:DI: ROMVARS location where the value is to be stored
|
---|
408 | ; DS:SI: MENUITEM pointer
|
---|
409 | ; Returns:
|
---|
410 | ; AX: Value to actually write to ROMVARS
|
---|
411 | ; Corrupts registers:
|
---|
412 | ; Nothing
|
---|
413 | ;--------------------------------------------------------------------
|
---|
414 | ALIGN JUMP_ALIGN
|
---|
415 | WriteRamVars:
|
---|
416 | inc ax ; FFFF -> 0000 = Disable UMB usage
|
---|
417 | jz SHORT .Return
|
---|
418 | dec ax
|
---|
419 | .Return:
|
---|
420 | ret
|
---|
421 |
|
---|
422 |
|
---|
423 | ;--------------------------------------------------------------------
|
---|
424 | ; MENUITEM activation functions (.fnActivate)
|
---|
425 | ; Parameters:
|
---|
426 | ; SS:BP: Ptr to MENU
|
---|
427 | ; Returns:
|
---|
428 | ; Nothing
|
---|
429 | ; Corrupts registers:
|
---|
430 | ; All, except segments
|
---|
431 | ;--------------------------------------------------------------------
|
---|
432 | %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
433 | %if (ROMVARS.ideVars0 | ROMVARS.ideVars1 | ROMVARS.ideVars2 | ROMVARS.ideVars3) & 0FF00h = 0
|
---|
434 | PrimaryIdeController:
|
---|
435 | mov bl, ROMVARS.ideVars0 & 0FFh
|
---|
436 | SKIP2B f
|
---|
437 | SecondaryIdeController:
|
---|
438 | mov bl, ROMVARS.ideVars1 & 0FFh
|
---|
439 | SKIP2B f
|
---|
440 | TertiaryIdeController:
|
---|
441 | mov bl, ROMVARS.ideVars2 & 0FFh
|
---|
442 | SKIP2B f
|
---|
443 | QuaternaryIdeController:
|
---|
444 | mov bl, ROMVARS.ideVars3 & 0FFh
|
---|
445 | xor bh, bh
|
---|
446 | ; Fall to DisplayIdeControllerMenu
|
---|
447 | %else
|
---|
448 | ALIGN JUMP_ALIGN
|
---|
449 | PrimaryIdeController:
|
---|
450 | mov bx, ROMVARS.ideVars0
|
---|
451 | jmp SHORT DisplayIdeControllerMenu
|
---|
452 |
|
---|
453 | ALIGN JUMP_ALIGN
|
---|
454 | SecondaryIdeController:
|
---|
455 | mov bx, ROMVARS.ideVars1
|
---|
456 | jmp SHORT DisplayIdeControllerMenu
|
---|
457 |
|
---|
458 | ALIGN JUMP_ALIGN
|
---|
459 | TertiaryIdeController:
|
---|
460 | mov bx, ROMVARS.ideVars2
|
---|
461 | jmp SHORT DisplayIdeControllerMenu
|
---|
462 |
|
---|
463 | ALIGN JUMP_ALIGN
|
---|
464 | QuaternaryIdeController:
|
---|
465 | mov bx, ROMVARS.ideVars3
|
---|
466 | ; Fall to DisplayIdeControllerMenu
|
---|
467 | %endif
|
---|
468 | %endif
|
---|
469 |
|
---|
470 | ALIGN JUMP_ALIGN
|
---|
471 | DisplayIdeControllerMenu:
|
---|
472 | call IdeControllerMenu_InitializeToIdevarsOffsetInBX
|
---|
473 | jmp IdeControllerMenu_EnterMenuOrModifyItemVisibility
|
---|
474 |
|
---|
475 |
|
---|
476 | ALIGN JUMP_ALIGN
|
---|
477 | ActivateInputForNumberOfIdeControllersMenuitemInDSSI:
|
---|
478 | call Menuitem_ActivateUnsignedInputForMenuitemInDSSI
|
---|
479 | ; Fall to LimitIdeControllersForLiteMode
|
---|
480 |
|
---|
481 | ;--------------------------------------------------------------------
|
---|
482 | ; LimitIdeControllersForLiteMode
|
---|
483 | ; Parameters:
|
---|
484 | ; SS:BP: Menu handle
|
---|
485 | ; Returns:
|
---|
486 | ; Nothing
|
---|
487 | ; Corrupts registers:
|
---|
488 | ; AX, CX, DI
|
---|
489 | ;--------------------------------------------------------------------
|
---|
490 | ALIGN JUMP_ALIGN
|
---|
491 | LimitIdeControllersForLiteMode:
|
---|
492 | push es
|
---|
493 | call Buffers_GetIdeControllerCountToCX
|
---|
494 | mov [es:di+ROMVARS.bIdeCnt], cl
|
---|
495 | CALL_MENU_LIBRARY GetHighlightedItemToAX
|
---|
496 | CALL_MENU_LIBRARY RefreshItemFromAX
|
---|
497 | pop es
|
---|
498 | ; Fall to ConfigurationMenu_CheckAndMoveSerialDrivesToBottom
|
---|
499 |
|
---|
500 | ;----------------------------------------------------------------------
|
---|
501 | ; ConfigurationMenu_CheckAndMoveSerialDrivesToBottom
|
---|
502 | ;
|
---|
503 | ; Checks to ensure that serial adapters are at the end of the
|
---|
504 | ; IDEVARS structures list, as serial floppies (if present) need to be
|
---|
505 | ; the last drives detected by the BIOS. If there are other controllers
|
---|
506 | ; after a serial controller, the other controllers are moved up on the list
|
---|
507 | ; and the serial controller is placed at the end of the list.
|
---|
508 | ;
|
---|
509 | ; Parameters:
|
---|
510 | ; SS:BP: Menu handle
|
---|
511 | ; Returns:
|
---|
512 | ; Nothing
|
---|
513 | ; Corrupts registers:
|
---|
514 | ; AX, BX, CX, DX
|
---|
515 | ;----------------------------------------------------------------------
|
---|
516 | ConfigurationMenu_CheckAndMoveSerialDrivesToBottom:
|
---|
517 | push es
|
---|
518 | push ds
|
---|
519 | push di
|
---|
520 | push si
|
---|
521 |
|
---|
522 | call Buffers_GetIdeControllerCountToCX ; will also set ES:DI to point to file buffer
|
---|
523 | push es
|
---|
524 | pop ds
|
---|
525 | mov dx, cx ; Controller count to DL (will always be at least 1) while also clearing notification flag in DH
|
---|
526 |
|
---|
527 | lea bx, [di+ROMVARS.ideVars0] ; add in offset of first idevars
|
---|
528 |
|
---|
529 | .outerLoop:
|
---|
530 | mov di, bx ; start of idevars
|
---|
531 | xor si, si ; first serial found
|
---|
532 | xor ax, ax ; first non-serial found
|
---|
533 | mov cl, dl ; idevars count
|
---|
534 |
|
---|
535 | .loop:
|
---|
536 | cmp BYTE [di+IDEVARS.bDevice], DEVICE_SERIAL_PORT
|
---|
537 | jne SHORT .notSerial
|
---|
538 |
|
---|
539 | test si, si ; record the first serial controller that we find
|
---|
540 | jnz SHORT .next
|
---|
541 | mov si, di
|
---|
542 | SKIP2B f
|
---|
543 |
|
---|
544 | .notSerial:
|
---|
545 | mov ax, di ; record the *last* non-serial controller that we find
|
---|
546 |
|
---|
547 | .next:
|
---|
548 | add di, IDEVARS_size
|
---|
549 | loop .loop
|
---|
550 |
|
---|
551 | test si, si ; no serial drives, nothing to do
|
---|
552 | jz SHORT .done
|
---|
553 | cmp si, ax ; serial port is already later on the list than any other controllers
|
---|
554 | ja SHORT .done ; (also takes care of the case where there are no other controllers)
|
---|
555 |
|
---|
556 | ;
|
---|
557 | ; move serial to end of list, others up
|
---|
558 | ;
|
---|
559 | %ifdef CLD_NEEDED
|
---|
560 | cld
|
---|
561 | %endif
|
---|
562 | mov ax, di ; save end pointer of list after scan
|
---|
563 | sub sp, IDEVARS_size ; copy serial to temporary space on stack
|
---|
564 | mov di, sp
|
---|
565 |
|
---|
566 | push ss
|
---|
567 | pop es
|
---|
568 |
|
---|
569 | %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
570 | %if IDEVARS_size & 1
|
---|
571 | mov cl, IDEVARS_size
|
---|
572 | rep movsb
|
---|
573 | %else
|
---|
574 | mov cl, IDEVARS_size / 2
|
---|
575 | rep movsw
|
---|
576 | %endif
|
---|
577 | %endif
|
---|
578 |
|
---|
579 | lea di, [si-IDEVARS_size] ; move up all the idevars below the serial, by one slot
|
---|
580 | mov cx, ax ; restore end pointer of list, subtract off end of serial idevars
|
---|
581 | sub cx, si
|
---|
582 |
|
---|
583 | push ds
|
---|
584 | pop es
|
---|
585 |
|
---|
586 | rep movsb
|
---|
587 |
|
---|
588 | mov si, sp ; place serial (currently on the stack) at bottom of list
|
---|
589 | push ss
|
---|
590 | pop ds
|
---|
591 | ; di is already at last IDEVARS position
|
---|
592 |
|
---|
593 | %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
594 | %if IDEVARS_size & 1
|
---|
595 | mov cl, IDEVARS_size
|
---|
596 | rep movsb
|
---|
597 | %else
|
---|
598 | mov cl, IDEVARS_size / 2
|
---|
599 | rep movsw
|
---|
600 | %endif
|
---|
601 | %endif
|
---|
602 |
|
---|
603 | add sp, IDEVARS_size
|
---|
604 |
|
---|
605 | push es
|
---|
606 | pop ds
|
---|
607 |
|
---|
608 | mov dh, 1 ; set flag that we have done a relocation
|
---|
609 | jmp SHORT .outerLoop
|
---|
610 |
|
---|
611 | .done:
|
---|
612 | pop si
|
---|
613 | pop di
|
---|
614 | pop ds
|
---|
615 | pop es
|
---|
616 |
|
---|
617 | test dh, dh
|
---|
618 | jz SHORT .noWorkDone
|
---|
619 |
|
---|
620 | mov dx, g_szSerialMoved
|
---|
621 | call Dialogs_DisplayNotificationFromCSDX
|
---|
622 |
|
---|
623 | .noWorkDone:
|
---|
624 | ret
|
---|