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-2013 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 11
|
---|
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 | 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 ActivateInputForNumberOfIdeControllersMenuitemInDSSI
|
---|
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_VISIBLE | 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 MAX_ALLOWED_IDE_CONTROLLERS
|
---|
145 | iend
|
---|
146 |
|
---|
147 | g_MenuitemConfigurationIdleTimeout:
|
---|
148 | istruc MENUITEM
|
---|
149 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
|
---|
150 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI
|
---|
151 | at MENUITEM.szName, dw g_szItemCfgIdleTimeout
|
---|
152 | at MENUITEM.szQuickInfo, dw g_szNfoCfgIdleTimeout
|
---|
153 | at MENUITEM.szHelp, dw g_szHelpCfgIdleTimeout
|
---|
154 | at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS
|
---|
155 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
|
---|
156 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bIdleTimeout
|
---|
157 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgIdleTimeout
|
---|
158 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceIdleTimeout
|
---|
159 | at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForIdleTimeout
|
---|
160 | at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForIdleTimeout
|
---|
161 | iend
|
---|
162 |
|
---|
163 | g_rgwChoiceToValueLookupForIdleTimeout:
|
---|
164 | %assign i -12
|
---|
165 | %rep 21
|
---|
166 | %assign i i+12
|
---|
167 | dw i ; i / 12 = 0 (disabled) or 1...20 minutes
|
---|
168 | %endrep
|
---|
169 | %rep 4
|
---|
170 | %assign i i+1
|
---|
171 | dw i ; 241...244 = (i - 240) * 30 minutes
|
---|
172 | %endrep
|
---|
173 | g_rgszChoiceToStringLookupForIdleTimeout:
|
---|
174 | %assign i 0
|
---|
175 | %rep 25
|
---|
176 | dw g_szIdleTimeoutChoice%[i]
|
---|
177 | %assign i i+1
|
---|
178 | %endrep
|
---|
179 | dw NULL
|
---|
180 |
|
---|
181 |
|
---|
182 | ; Section containing code
|
---|
183 | SECTION .text
|
---|
184 |
|
---|
185 | ;--------------------------------------------------------------------
|
---|
186 | ; MainMenu_EnterMenuOrModifyItemVisibility
|
---|
187 | ; Parameters:
|
---|
188 | ; SS:BP: Menu handle
|
---|
189 | ; Returns:
|
---|
190 | ; Nothing
|
---|
191 | ; Corrupts registers:
|
---|
192 | ; All, except BP
|
---|
193 | ;--------------------------------------------------------------------
|
---|
194 | ALIGN JUMP_ALIGN
|
---|
195 | ConfigurationMenu_EnterMenuOrModifyItemVisibility:
|
---|
196 | push cs
|
---|
197 | pop ds
|
---|
198 | call .DisableAllIdeControllerMenuitems
|
---|
199 | call .EnableIdeControllerMenuitemsBasedOnConfiguration
|
---|
200 | call .EnableOrDisableOperatingModeSelection
|
---|
201 | call .EnableOrDisableKiBtoStealFromRAM
|
---|
202 | call .EnableOrDisableIdleTimeout
|
---|
203 | call LimitIdeControllersForLiteMode
|
---|
204 | mov si, g_MenupageForConfigurationMenu
|
---|
205 | jmp Menupage_ChangeToNewMenupageInDSSI
|
---|
206 |
|
---|
207 | ;--------------------------------------------------------------------
|
---|
208 | ; .DisableAllIdeControllerMenuitems
|
---|
209 | ; .EnableIdeControllerMenuitemsBasedOnConfiguration
|
---|
210 | ; Parameters:
|
---|
211 | ; SS:BP: Menu handle
|
---|
212 | ; Returns:
|
---|
213 | ; Nothing
|
---|
214 | ; Corrupts registers:
|
---|
215 | ; AX, BX, CX, DI, ES
|
---|
216 | ;--------------------------------------------------------------------
|
---|
217 | ALIGN JUMP_ALIGN
|
---|
218 | .DisableAllIdeControllerMenuitems:
|
---|
219 | mov cx, MAX_ALLOWED_IDE_CONTROLLERS-1
|
---|
220 | mov ax, DisableMenuitemFromCSBX
|
---|
221 | jmp SHORT .Go
|
---|
222 |
|
---|
223 | ALIGN JUMP_ALIGN
|
---|
224 | .EnableIdeControllerMenuitemsBasedOnConfiguration:
|
---|
225 | call Buffers_GetIdeControllerCountToCX
|
---|
226 | dec cx ; Primary always enabled
|
---|
227 | jz SHORT .PrimaryControllerAlreadyEnabled
|
---|
228 | mov ax, EnableMenuitemFromCSBX
|
---|
229 | .Go:
|
---|
230 | mov bx, g_MenuitemConfigurationSecondaryIdeController
|
---|
231 | ALIGN JUMP_ALIGN
|
---|
232 | .EnableOrDisableNextIdeControllerMenuitem:
|
---|
233 | call ax
|
---|
234 | add bx, BYTE MENUITEM_size
|
---|
235 | loop .EnableOrDisableNextIdeControllerMenuitem
|
---|
236 | .PrimaryControllerAlreadyEnabled:
|
---|
237 | ret
|
---|
238 |
|
---|
239 |
|
---|
240 | ;--------------------------------------------------------------------
|
---|
241 | ; .EnableOrDisableOperatingModeSelection
|
---|
242 | ; Parameters:
|
---|
243 | ; SS:BP: Menu handle
|
---|
244 | ; Returns:
|
---|
245 | ; Nothing
|
---|
246 | ; Corrupts registers:
|
---|
247 | ; BX
|
---|
248 | ;--------------------------------------------------------------------
|
---|
249 | ALIGN JUMP_ALIGN
|
---|
250 | .EnableOrDisableOperatingModeSelection:
|
---|
251 | mov bx, g_MenuitemConfigurationFullOperatingMode
|
---|
252 | call Buffers_IsXTbuildLoaded
|
---|
253 | je SHORT .EnableMenuitemFromCSBX
|
---|
254 | jmp SHORT .DisableMenuitemFromCSBX
|
---|
255 |
|
---|
256 |
|
---|
257 | ;--------------------------------------------------------------------
|
---|
258 | ; .EnableOrDisableKiBtoStealFromRAM
|
---|
259 | ; Parameters:
|
---|
260 | ; SS:BP: Menu handle
|
---|
261 | ; Returns:
|
---|
262 | ; Nothing
|
---|
263 | ; Corrupts registers:
|
---|
264 | ; AX, BX
|
---|
265 | ;--------------------------------------------------------------------
|
---|
266 | ALIGN JUMP_ALIGN
|
---|
267 | .EnableOrDisableKiBtoStealFromRAM:
|
---|
268 | call Buffers_GetRomvarsFlagsToAX
|
---|
269 | mov bx, g_MenuitemConfigurationKiBtoStealFromRAM
|
---|
270 | test al, FLG_ROMVARS_FULLMODE
|
---|
271 | jz SHORT .DisableMenuitemFromCSBX
|
---|
272 | jmp SHORT .EnableMenuitemFromCSBX
|
---|
273 |
|
---|
274 |
|
---|
275 | ;--------------------------------------------------------------------
|
---|
276 | ; .EnableOrDisableIdleTimeout
|
---|
277 | ; Parameters:
|
---|
278 | ; SS:BP: Menu handle
|
---|
279 | ; Returns:
|
---|
280 | ; Nothing
|
---|
281 | ; Corrupts registers:
|
---|
282 | ; AX, BX
|
---|
283 | ;--------------------------------------------------------------------
|
---|
284 | ALIGN JUMP_ALIGN
|
---|
285 | .EnableOrDisableIdleTimeout:
|
---|
286 | call Buffers_GetRomvarsFlagsToAX
|
---|
287 | mov bx, g_MenuitemConfigurationIdleTimeout
|
---|
288 | test al, FLG_ROMVARS_MODULE_POWER_MANAGEMENT
|
---|
289 | jz SHORT .DisableMenuitemFromCSBX
|
---|
290 | ; Fall to .EnableMenuitemFromCSBX
|
---|
291 |
|
---|
292 |
|
---|
293 | ;--------------------------------------------------------------------
|
---|
294 | ; .EnableMenuitemFromCSBX
|
---|
295 | ; .DisableMenuitemFromCSBX
|
---|
296 | ; Parameters:
|
---|
297 | ; CS:BX: Ptr to MENUITEM
|
---|
298 | ; Returns:
|
---|
299 | ; Nothing
|
---|
300 | ; Corrupts registers:
|
---|
301 | ; Nothing
|
---|
302 | ;--------------------------------------------------------------------
|
---|
303 | ALIGN JUMP_ALIGN
|
---|
304 | .EnableMenuitemFromCSBX:
|
---|
305 | jmp EnableMenuitemFromCSBX
|
---|
306 |
|
---|
307 | ALIGN JUMP_ALIGN
|
---|
308 | .DisableMenuitemFromCSBX:
|
---|
309 | jmp DisableMenuitemFromCSBX
|
---|
310 |
|
---|
311 |
|
---|
312 | ;--------------------------------------------------------------------
|
---|
313 | ; MENUITEM activation functions (.fnActivate)
|
---|
314 | ; Parameters:
|
---|
315 | ; SS:BP: Ptr to MENU
|
---|
316 | ; Returns:
|
---|
317 | ; Nothing
|
---|
318 | ; Corrupts registers:
|
---|
319 | ; All, except segments
|
---|
320 | ;--------------------------------------------------------------------
|
---|
321 | %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
322 | %if (ROMVARS.ideVars0 | ROMVARS.ideVars1 | ROMVARS.ideVars2 | ROMVARS.ideVars3) & 0FF00h = 0
|
---|
323 | PrimaryIdeController:
|
---|
324 | mov bl, ROMVARS.ideVars0 & 0FFh
|
---|
325 | SKIP2B f
|
---|
326 | SecondaryIdeController:
|
---|
327 | mov bl, ROMVARS.ideVars1 & 0FFh
|
---|
328 | SKIP2B f
|
---|
329 | TertiaryIdeController:
|
---|
330 | mov bl, ROMVARS.ideVars2 & 0FFh
|
---|
331 | SKIP2B f
|
---|
332 | QuaternaryIdeController:
|
---|
333 | mov bl, ROMVARS.ideVars3 & 0FFh
|
---|
334 | xor bh, bh
|
---|
335 | ; Fall to DisplayIdeControllerMenu
|
---|
336 | %else
|
---|
337 | ALIGN JUMP_ALIGN
|
---|
338 | PrimaryIdeController:
|
---|
339 | mov bx, ROMVARS.ideVars0
|
---|
340 | jmp SHORT DisplayIdeControllerMenu
|
---|
341 |
|
---|
342 | ALIGN JUMP_ALIGN
|
---|
343 | SecondaryIdeController:
|
---|
344 | mov bx, ROMVARS.ideVars1
|
---|
345 | jmp SHORT DisplayIdeControllerMenu
|
---|
346 |
|
---|
347 | ALIGN JUMP_ALIGN
|
---|
348 | TertiaryIdeController:
|
---|
349 | mov bx, ROMVARS.ideVars2
|
---|
350 | jmp SHORT DisplayIdeControllerMenu
|
---|
351 |
|
---|
352 | ALIGN JUMP_ALIGN
|
---|
353 | QuaternaryIdeController:
|
---|
354 | mov bx, ROMVARS.ideVars3
|
---|
355 | ; Fall to DisplayIdeControllerMenu
|
---|
356 | %endif
|
---|
357 | %endif
|
---|
358 |
|
---|
359 | ALIGN JUMP_ALIGN
|
---|
360 | DisplayIdeControllerMenu:
|
---|
361 | call IdeControllerMenu_InitializeToIdevarsOffsetInBX
|
---|
362 | jmp IdeControllerMenu_EnterMenuOrModifyItemVisibility
|
---|
363 |
|
---|
364 |
|
---|
365 | ALIGN JUMP_ALIGN
|
---|
366 | ActivateInputForNumberOfIdeControllersMenuitemInDSSI:
|
---|
367 | call Menuitem_ActivateUnsignedInputForMenuitemInDSSI
|
---|
368 | ; Fall to LimitIdeControllersForLiteMode
|
---|
369 |
|
---|
370 | ;--------------------------------------------------------------------
|
---|
371 | ; LimitIdeControllersForLiteMode
|
---|
372 | ; Parameters:
|
---|
373 | ; SS:BP: Menu handle
|
---|
374 | ; Returns:
|
---|
375 | ; Nothing
|
---|
376 | ; Corrupts registers:
|
---|
377 | ; AX, CX, DI
|
---|
378 | ;--------------------------------------------------------------------
|
---|
379 | ALIGN JUMP_ALIGN
|
---|
380 | LimitIdeControllersForLiteMode:
|
---|
381 | push es
|
---|
382 | call Buffers_GetIdeControllerCountToCX
|
---|
383 | mov [es:di+ROMVARS.bIdeCnt], cl
|
---|
384 | CALL_MENU_LIBRARY GetHighlightedItemToAX
|
---|
385 | CALL_MENU_LIBRARY RefreshItemFromAX
|
---|
386 | pop es
|
---|
387 | ; Fall to ConfigurationMenu_CheckAndMoveSerialDrivesToBottom
|
---|
388 |
|
---|
389 | ;----------------------------------------------------------------------
|
---|
390 | ; ConfigurationMenu_CheckAndMoveSerialDrivesToBottom
|
---|
391 | ;
|
---|
392 | ; Checks to ensure that serial adapters are at the end of the
|
---|
393 | ; IDEVARS structures list, as serial floppies (if present) need to be
|
---|
394 | ; the last drives detected by the BIOS. If there are other controllers
|
---|
395 | ; after a serial controller, the other controllers are moved up on the list
|
---|
396 | ; and the serial controller is placed at the end of the list.
|
---|
397 | ;
|
---|
398 | ; Parameters:
|
---|
399 | ; SS:BP: Menu handle
|
---|
400 | ; Returns:
|
---|
401 | ; Nothing
|
---|
402 | ; Corrupts registers:
|
---|
403 | ; AX, BX, CX, DX
|
---|
404 | ;----------------------------------------------------------------------
|
---|
405 | ConfigurationMenu_CheckAndMoveSerialDrivesToBottom:
|
---|
406 | push es
|
---|
407 | push ds
|
---|
408 | push di
|
---|
409 | push si
|
---|
410 |
|
---|
411 | call Buffers_GetIdeControllerCountToCX ; will also set ES:DI to point to file buffer
|
---|
412 | push es
|
---|
413 | pop ds
|
---|
414 | mov dx, cx ; Controller count to DL (will always be at least 1) while also clearing notification flag in DH
|
---|
415 |
|
---|
416 | lea bx, [di+ROMVARS.ideVars0] ; add in offset of first idevars
|
---|
417 |
|
---|
418 | .outerLoop:
|
---|
419 | mov di, bx ; start of idevars
|
---|
420 | xor si, si ; first serial found
|
---|
421 | xor ax, ax ; first non-serial found
|
---|
422 | mov cl, dl ; idevars count
|
---|
423 |
|
---|
424 | .loop:
|
---|
425 | cmp BYTE [di+IDEVARS.bDevice], DEVICE_SERIAL_PORT
|
---|
426 | jne SHORT .notSerial
|
---|
427 |
|
---|
428 | test si, si ; record the first serial controller that we find
|
---|
429 | jnz SHORT .next
|
---|
430 | mov si, di
|
---|
431 | SKIP2B f
|
---|
432 |
|
---|
433 | .notSerial:
|
---|
434 | mov ax, di ; record the *last* non-serial controller that we find
|
---|
435 |
|
---|
436 | .next:
|
---|
437 | add di, IDEVARS_size
|
---|
438 | loop .loop
|
---|
439 |
|
---|
440 | test si, si ; no serial drives, nothing to do
|
---|
441 | jz SHORT .done
|
---|
442 | cmp si, ax ; serial port is already later on the list than any other controllers
|
---|
443 | ja SHORT .done ; (also takes care of the case where there are no other controllers)
|
---|
444 |
|
---|
445 | ;
|
---|
446 | ; move serial to end of list, others up
|
---|
447 | ;
|
---|
448 | %ifdef CLD_NEEDED
|
---|
449 | cld
|
---|
450 | %endif
|
---|
451 | mov ax, di ; save end pointer of list after scan
|
---|
452 | sub sp, IDEVARS_size ; copy serial to temporary space on stack
|
---|
453 | mov di, sp
|
---|
454 |
|
---|
455 | push ss
|
---|
456 | pop es
|
---|
457 |
|
---|
458 | %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
459 | %if IDEVARS_size & 1
|
---|
460 | mov cl, IDEVARS_size
|
---|
461 | rep movsb
|
---|
462 | %else
|
---|
463 | mov cl, IDEVARS_size / 2
|
---|
464 | rep movsw
|
---|
465 | %endif
|
---|
466 | %endif
|
---|
467 |
|
---|
468 | lea di, [si-IDEVARS_size] ; move up all the idevars below the serial, by one slot
|
---|
469 | mov cx, ax ; restore end pointer of list, subtract off end of serial idevars
|
---|
470 | sub cx, si
|
---|
471 |
|
---|
472 | push ds
|
---|
473 | pop es
|
---|
474 |
|
---|
475 | rep movsb
|
---|
476 |
|
---|
477 | mov si, sp ; place serial (currently on the stack) at bottom of list
|
---|
478 | push ss
|
---|
479 | pop ds
|
---|
480 | ; di is already at last IDEVARS position
|
---|
481 |
|
---|
482 | %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
483 | %if IDEVARS_size & 1
|
---|
484 | mov cl, IDEVARS_size
|
---|
485 | rep movsb
|
---|
486 | %else
|
---|
487 | mov cl, IDEVARS_size / 2
|
---|
488 | rep movsw
|
---|
489 | %endif
|
---|
490 | %endif
|
---|
491 |
|
---|
492 | add sp, IDEVARS_size
|
---|
493 |
|
---|
494 | push es
|
---|
495 | pop ds
|
---|
496 |
|
---|
497 | mov dh, 1 ; set flag that we have done a relocation
|
---|
498 | jmp SHORT .outerLoop
|
---|
499 |
|
---|
500 | .done:
|
---|
501 | pop si
|
---|
502 | pop di
|
---|
503 | pop ds
|
---|
504 | pop es
|
---|
505 |
|
---|
506 | test dh, dh
|
---|
507 | jz SHORT .noWorkDone
|
---|
508 |
|
---|
509 | mov dx, g_szSerialMoved
|
---|
510 | call Dialogs_DisplayNotificationFromCSDX
|
---|
511 |
|
---|
512 | .noWorkDone:
|
---|
513 | ret
|
---|