[57] | 1 | ; Project name : XTIDE Universal BIOS Configurator v2 |
---|
| 2 | ; Description : "Configure XTIDE Universal BIOS" menu structs and functions. |
---|
| 3 | |
---|
[376] | 4 | ; |
---|
[380] | 5 | ; XTIDE Universal BIOS and Associated Tools |
---|
[376] | 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 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. |
---|
[380] | 12 | ; |
---|
[376] | 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 |
---|
[380] | 16 | ; GNU General Public License for more details. |
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
[380] | 18 | ; |
---|
[376] | 19 | |
---|
[57] | 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 |
---|
[59] | 27 | at MENUPAGE.fnBack, dw MainMenu_EnterMenuOrModifyItemVisibility |
---|
[380] | 28 | at MENUPAGE.wMenuitems, dw 10 |
---|
[57] | 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 |
---|
[59] | 83 | at MENUITEM.fnActivate, dw BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility |
---|
[57] | 84 | at MENUITEM.szName, dw g_szItemCfgBootMenu |
---|
| 85 | at MENUITEM.szQuickInfo, dw g_szNfoCfgBootMenu |
---|
| 86 | at MENUITEM.szHelp, dw g_szNfoCfgBootMenu |
---|
[109] | 87 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE |
---|
[57] | 88 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT |
---|
| 89 | iend |
---|
| 90 | |
---|
| 91 | g_MenuitemConfigurationFullOperatingMode: |
---|
| 92 | istruc MENUITEM |
---|
[108] | 93 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI |
---|
[59] | 94 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI |
---|
[57] | 95 | at MENUITEM.szName, dw g_szItemCfgFullMode |
---|
| 96 | at MENUITEM.szQuickInfo, dw g_szNfoCfgFullMode |
---|
| 97 | at MENUITEM.szHelp, dw g_szHelpCfgFullMode |
---|
[457] | 98 | at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE |
---|
[108] | 99 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE |
---|
[57] | 100 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wFlags |
---|
| 101 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgFullMode |
---|
[108] | 102 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag |
---|
[57] | 103 | at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans |
---|
| 104 | at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_ROMVARS_FULLMODE |
---|
| 105 | iend |
---|
| 106 | |
---|
| 107 | g_MenuitemConfigurationKiBtoStealFromRAM: |
---|
| 108 | istruc MENUITEM |
---|
| 109 | at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI |
---|
| 110 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI |
---|
| 111 | at MENUITEM.szName, dw g_szItemCfgStealSize |
---|
| 112 | at MENUITEM.szQuickInfo, dw g_szNfoCfgStealSize |
---|
| 113 | at MENUITEM.szHelp, dw g_szHelpCfgStealSize |
---|
| 114 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE |
---|
| 115 | at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED |
---|
| 116 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bStealSize |
---|
| 117 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgStealSize |
---|
| 118 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1 |
---|
| 119 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 255 |
---|
| 120 | iend |
---|
| 121 | |
---|
| 122 | g_MenuitemConfigurationIdeControllers: |
---|
| 123 | istruc MENUITEM |
---|
[204] | 124 | at MENUITEM.fnActivate, dw ActivateInputForNumberOfIdeControllersMenuitemInDSSI |
---|
[57] | 125 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI |
---|
| 126 | at MENUITEM.szName, dw g_szItemCfgIdeCnt |
---|
| 127 | at MENUITEM.szQuickInfo, dw g_szNfoCfgIdeCnt |
---|
| 128 | at MENUITEM.szHelp, dw g_szNfoCfgIdeCnt |
---|
[206] | 129 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE |
---|
[57] | 130 | at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED |
---|
| 131 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bIdeCnt |
---|
| 132 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgIdeCnt |
---|
| 133 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1 |
---|
[204] | 134 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw MAX_ALLOWED_IDE_CONTROLLERS |
---|
[57] | 135 | iend |
---|
| 136 | |
---|
[380] | 137 | g_MenuitemConfigurationIdleTimeout: |
---|
| 138 | istruc MENUITEM |
---|
| 139 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI |
---|
| 140 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI |
---|
| 141 | at MENUITEM.szName, dw g_szItemCfgIdleTimeout |
---|
| 142 | at MENUITEM.szQuickInfo, dw g_szNfoCfgIdleTimeout |
---|
| 143 | at MENUITEM.szHelp, dw g_szHelpCfgIdleTimeout |
---|
[457] | 144 | at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS |
---|
[380] | 145 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE |
---|
| 146 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bIdleTimeout |
---|
| 147 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgCfgIdleTimeout |
---|
| 148 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceIdleTimeout |
---|
| 149 | at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForIdleTimeout |
---|
| 150 | at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForIdleTimeout |
---|
| 151 | iend |
---|
[57] | 152 | |
---|
[380] | 153 | g_rgwChoiceToValueLookupForIdleTimeout: |
---|
| 154 | %assign i -12 |
---|
| 155 | %rep 21 |
---|
| 156 | %assign i i+12 |
---|
| 157 | dw i ; i / 12 = 0 (disabled) or 1...20 minutes |
---|
| 158 | %endrep |
---|
| 159 | %rep 4 |
---|
| 160 | %assign i i+1 |
---|
| 161 | dw i ; 241...244 = (i - 240) * 30 minutes |
---|
| 162 | %endrep |
---|
| 163 | g_rgszChoiceToStringLookupForIdleTimeout: |
---|
| 164 | %assign i 0 |
---|
| 165 | %rep 25 |
---|
| 166 | dw g_szIdleTimeoutChoice%[i] |
---|
| 167 | %assign i i+1 |
---|
| 168 | %endrep |
---|
| 169 | ; dw NULL ; Is this needed? *FIXME* |
---|
| 170 | |
---|
[57] | 171 | ; Section containing code |
---|
| 172 | SECTION .text |
---|
| 173 | |
---|
| 174 | ;-------------------------------------------------------------------- |
---|
| 175 | ; MainMenu_EnterMenuOrModifyItemVisibility |
---|
| 176 | ; Parameters: |
---|
| 177 | ; SS:BP: Menu handle |
---|
| 178 | ; Returns: |
---|
| 179 | ; Nothing |
---|
| 180 | ; Corrupts registers: |
---|
| 181 | ; All, except BP |
---|
| 182 | ;-------------------------------------------------------------------- |
---|
| 183 | ALIGN JUMP_ALIGN |
---|
| 184 | ConfigurationMenu_EnterMenuOrModifyItemVisibility: |
---|
| 185 | push cs |
---|
| 186 | pop ds |
---|
| 187 | call .DisableAllIdeControllerMenuitems |
---|
| 188 | call .EnableIdeControllerMenuitemsBasedOnConfiguration |
---|
[457] | 189 | call .EnableOrDisableOperatingModeSelection |
---|
[57] | 190 | call .EnableOrDisableKiBtoStealFromRAM |
---|
[457] | 191 | call .EnableOrDisableIdleTimeout |
---|
[204] | 192 | call LimitIdeControllersForLiteMode |
---|
[57] | 193 | mov si, g_MenupageForConfigurationMenu |
---|
| 194 | jmp Menupage_ChangeToNewMenupageInDSSI |
---|
| 195 | |
---|
| 196 | ;-------------------------------------------------------------------- |
---|
| 197 | ; .DisableAllIdeControllerMenuitems |
---|
| 198 | ; .EnableIdeControllerMenuitemsBasedOnConfiguration |
---|
| 199 | ; Parameters: |
---|
| 200 | ; SS:BP: Menu handle |
---|
| 201 | ; Returns: |
---|
| 202 | ; Nothing |
---|
| 203 | ; Corrupts registers: |
---|
[204] | 204 | ; AX, BX, CX, DI, ES |
---|
[57] | 205 | ;-------------------------------------------------------------------- |
---|
| 206 | ALIGN JUMP_ALIGN |
---|
| 207 | .DisableAllIdeControllerMenuitems: |
---|
| 208 | mov cx, MAX_ALLOWED_IDE_CONTROLLERS-1 |
---|
| 209 | mov bx, g_MenuitemConfigurationSecondaryIdeController |
---|
| 210 | ALIGN JUMP_ALIGN |
---|
| 211 | .DisableNextIdeControllerMenuitem: |
---|
| 212 | call .DisableMenuitemFromCSBX |
---|
| 213 | add bx, BYTE MENUITEM_size |
---|
| 214 | loop .DisableNextIdeControllerMenuitem |
---|
| 215 | ret |
---|
| 216 | |
---|
| 217 | ALIGN JUMP_ALIGN |
---|
| 218 | .EnableIdeControllerMenuitemsBasedOnConfiguration: |
---|
[204] | 219 | call Buffers_GetIdeControllerCountToCX |
---|
[57] | 220 | dec cx ; Primary always enabled |
---|
[204] | 221 | jz SHORT .PrimaryControllerAlreadyEnabled |
---|
[57] | 222 | mov bx, g_MenuitemConfigurationSecondaryIdeController |
---|
| 223 | ALIGN JUMP_ALIGN |
---|
| 224 | .EnableNextIdeControllerMenuitem: |
---|
| 225 | call .EnableMenuitemFromCSBX |
---|
| 226 | add bx, BYTE MENUITEM_size |
---|
| 227 | loop .EnableNextIdeControllerMenuitem |
---|
| 228 | .PrimaryControllerAlreadyEnabled: |
---|
| 229 | ret |
---|
| 230 | |
---|
| 231 | |
---|
| 232 | ;-------------------------------------------------------------------- |
---|
[457] | 233 | ; .EnableOrDisableOperatingModeSelection |
---|
| 234 | ; Parameters: |
---|
| 235 | ; SS:BP: Menu handle |
---|
| 236 | ; Returns: |
---|
| 237 | ; Nothing |
---|
| 238 | ; Corrupts registers: |
---|
| 239 | ; BX, DI, ES |
---|
| 240 | ;-------------------------------------------------------------------- |
---|
| 241 | ALIGN JUMP_ALIGN |
---|
| 242 | .EnableOrDisableOperatingModeSelection: |
---|
| 243 | mov bx, g_MenuitemConfigurationFullOperatingMode |
---|
| 244 | call Buffers_IsXTbuildLoaded |
---|
| 245 | je SHORT .EnableMenuitemFromCSBX |
---|
| 246 | jmp SHORT .DisableMenuitemFromCSBX |
---|
| 247 | |
---|
| 248 | |
---|
| 249 | ;-------------------------------------------------------------------- |
---|
[57] | 250 | ; .EnableOrDisableKiBtoStealFromRAM |
---|
| 251 | ; Parameters: |
---|
| 252 | ; SS:BP: Menu handle |
---|
| 253 | ; Returns: |
---|
| 254 | ; Nothing |
---|
| 255 | ; Corrupts registers: |
---|
| 256 | ; AX, BX, CX |
---|
| 257 | ;-------------------------------------------------------------------- |
---|
| 258 | ALIGN JUMP_ALIGN |
---|
| 259 | .EnableOrDisableKiBtoStealFromRAM: |
---|
[59] | 260 | call Buffers_GetRomvarsFlagsToAX |
---|
[57] | 261 | mov bx, g_MenuitemConfigurationKiBtoStealFromRAM |
---|
| 262 | test ax, FLG_ROMVARS_FULLMODE |
---|
| 263 | jz SHORT .DisableMenuitemFromCSBX |
---|
[457] | 264 | jmp SHORT .EnableMenuitemFromCSBX |
---|
| 265 | |
---|
| 266 | |
---|
| 267 | ;-------------------------------------------------------------------- |
---|
| 268 | ; .EnableOrDisableIdleTimeout |
---|
| 269 | ; Parameters: |
---|
| 270 | ; SS:BP: Menu handle |
---|
| 271 | ; Returns: |
---|
| 272 | ; Nothing |
---|
| 273 | ; Corrupts registers: |
---|
| 274 | ; AX, BX |
---|
| 275 | ;-------------------------------------------------------------------- |
---|
| 276 | ALIGN JUMP_ALIGN |
---|
| 277 | .EnableOrDisableIdleTimeout: |
---|
| 278 | call Buffers_GetRomvarsFlagsToAX |
---|
| 279 | mov bx, g_MenuitemConfigurationIdleTimeout |
---|
| 280 | test ax, FLG_ROMVARS_MODULE_FEATURE_SETS |
---|
| 281 | jz SHORT .DisableMenuitemFromCSBX |
---|
[204] | 282 | ; Fall to .EnableMenuitemFromCSBX |
---|
[57] | 283 | |
---|
[153] | 284 | |
---|
[57] | 285 | ;-------------------------------------------------------------------- |
---|
| 286 | ; .EnableMenuitemFromCSBX |
---|
| 287 | ; .DisableMenuitemFromCSBX |
---|
| 288 | ; Parameters: |
---|
| 289 | ; CS:BX: Ptr to MENUITEM |
---|
| 290 | ; Returns: |
---|
| 291 | ; Nothing |
---|
| 292 | ; Corrupts registers: |
---|
| 293 | ; Nothing |
---|
| 294 | ;-------------------------------------------------------------------- |
---|
| 295 | ALIGN JUMP_ALIGN |
---|
| 296 | .EnableMenuitemFromCSBX: |
---|
| 297 | or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE |
---|
| 298 | ret |
---|
| 299 | |
---|
| 300 | ALIGN JUMP_ALIGN |
---|
| 301 | .DisableMenuitemFromCSBX: |
---|
| 302 | and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE |
---|
| 303 | ret |
---|
| 304 | |
---|
| 305 | |
---|
| 306 | |
---|
| 307 | ;-------------------------------------------------------------------- |
---|
| 308 | ; MENUITEM activation functions (.fnActivate) |
---|
| 309 | ; Parameters: |
---|
| 310 | ; SS:BP: Ptr to MENU |
---|
| 311 | ; Returns: |
---|
| 312 | ; Nothing |
---|
| 313 | ; Corrupts registers: |
---|
| 314 | ; All, except segments |
---|
| 315 | ;-------------------------------------------------------------------- |
---|
| 316 | ALIGN JUMP_ALIGN |
---|
| 317 | PrimaryIdeController: |
---|
| 318 | mov bx, ROMVARS.ideVars0 |
---|
| 319 | jmp SHORT DisplayIdeControllerMenu |
---|
| 320 | |
---|
| 321 | ALIGN JUMP_ALIGN |
---|
| 322 | SecondaryIdeController: |
---|
| 323 | mov bx, ROMVARS.ideVars1 |
---|
| 324 | jmp SHORT DisplayIdeControllerMenu |
---|
| 325 | |
---|
| 326 | ALIGN JUMP_ALIGN |
---|
| 327 | TertiaryIdeController: |
---|
| 328 | mov bx, ROMVARS.ideVars2 |
---|
| 329 | jmp SHORT DisplayIdeControllerMenu |
---|
| 330 | |
---|
| 331 | ALIGN JUMP_ALIGN |
---|
| 332 | QuaternaryIdeController: |
---|
| 333 | mov bx, ROMVARS.ideVars3 |
---|
| 334 | ; Fall to DisplayIdeControllerMenu |
---|
| 335 | |
---|
| 336 | ALIGN JUMP_ALIGN |
---|
| 337 | DisplayIdeControllerMenu: |
---|
| 338 | call IdeControllerMenu_InitializeToIdevarsOffsetInBX |
---|
| 339 | jmp IdeControllerMenu_EnterMenuOrModifyItemVisibility |
---|
[204] | 340 | |
---|
| 341 | |
---|
| 342 | ALIGN JUMP_ALIGN |
---|
| 343 | ActivateInputForNumberOfIdeControllersMenuitemInDSSI: |
---|
| 344 | call Menuitem_ActivateUnsignedInputForMenuitemInDSSI |
---|
| 345 | ; Fall to LimitIdeControllersForLiteMode |
---|
| 346 | |
---|
| 347 | ;-------------------------------------------------------------------- |
---|
| 348 | ; LimitIdeControllersForLiteMode |
---|
| 349 | ; Parameters: |
---|
| 350 | ; SS:BP: Menu handle |
---|
| 351 | ; Returns: |
---|
| 352 | ; Nothing |
---|
| 353 | ; Corrupts registers: |
---|
| 354 | ; AX, CX, DI |
---|
| 355 | ;-------------------------------------------------------------------- |
---|
| 356 | ALIGN JUMP_ALIGN |
---|
| 357 | LimitIdeControllersForLiteMode: |
---|
| 358 | push es |
---|
| 359 | call Buffers_GetIdeControllerCountToCX |
---|
| 360 | mov [es:di+ROMVARS.bIdeCnt], cl |
---|
| 361 | CALL_MENU_LIBRARY GetHighlightedItemToAX |
---|
| 362 | CALL_MENU_LIBRARY RefreshItemFromAX |
---|
| 363 | pop es |
---|
[258] | 364 | ; Fall to ConfigurationMenu_CheckAndMoveSerialDrivesToBottom |
---|
| 365 | |
---|
| 366 | ;---------------------------------------------------------------------- |
---|
| 367 | ; ConfigurationMenu_CheckAndMoveSerialDrivesToBottom |
---|
| 368 | ; |
---|
[380] | 369 | ; Checks to ensure that serial adapters are at the end of the |
---|
| 370 | ; IDEVARS structures list, as serial floppies (if present) need to be |
---|
[258] | 371 | ; the last drives detected by the BIOS. If there are other controllers |
---|
| 372 | ; after a serial controller, the other controllers are moved up on the list |
---|
| 373 | ; and the serial controller is placed at the end of the list. |
---|
| 374 | ; |
---|
| 375 | ; Parameters: |
---|
| 376 | ; SS:BP: Menu handle |
---|
| 377 | ; Returns: |
---|
| 378 | ; Nothing |
---|
| 379 | ; Corrupts registers: |
---|
| 380 | ; All |
---|
[380] | 381 | ;---------------------------------------------------------------------- |
---|
| 382 | ConfigurationMenu_CheckAndMoveSerialDrivesToBottom: |
---|
[258] | 383 | push es |
---|
| 384 | push ds |
---|
| 385 | push di |
---|
| 386 | push si |
---|
| 387 | |
---|
| 388 | call Buffers_GetIdeControllerCountToCX ; will also set ES:DI to point to file buffer |
---|
| 389 | push es |
---|
| 390 | pop ds |
---|
[380] | 391 | xor ch, ch ; clearing high order of CX and notification flag |
---|
| 392 | mov dx, cx ; (probably unnecessary, CX should be less than 127, but just to be sure) |
---|
| 393 | jcxz .done ; probably unnecessary, but make sure there is at least one controller |
---|
[258] | 394 | |
---|
[380] | 395 | lea bx, [di+ROMVARS.ideVars0] ; add in offset of first idevars |
---|
[258] | 396 | |
---|
| 397 | .outerLoop: |
---|
| 398 | mov di, bx ; start of idevars |
---|
| 399 | xor si, si ; first serial found |
---|
| 400 | xor ax, ax ; first non-serial found |
---|
| 401 | mov cl, dl ; idevars count |
---|
[380] | 402 | xor ch, ch |
---|
[258] | 403 | |
---|
| 404 | .loop: |
---|
| 405 | cmp byte [di+IDEVARS.bDevice], DEVICE_SERIAL_PORT |
---|
| 406 | jnz .notSerial |
---|
| 407 | |
---|
[380] | 408 | test si, si ; record the first serial controller that we find |
---|
| 409 | jnz .next |
---|
[258] | 410 | mov si, di |
---|
| 411 | jmp .next |
---|
| 412 | |
---|
| 413 | .notSerial: |
---|
| 414 | mov ax, di ; record the *last* non-serial controller that we find |
---|
| 415 | |
---|
[380] | 416 | .next: |
---|
[258] | 417 | add di, IDEVARS_size |
---|
| 418 | loop .loop |
---|
| 419 | |
---|
[380] | 420 | test si, si ; no serial drives, nothing to do |
---|
[258] | 421 | jz .done |
---|
[380] | 422 | cmp si, ax ; serial port is already later on the list than any other controllers |
---|
| 423 | ja .done ; (also takes care of the case where there are no other controllers) |
---|
[258] | 424 | |
---|
| 425 | ; |
---|
| 426 | ; move serial to end of list, others up |
---|
| 427 | ; |
---|
| 428 | cld |
---|
| 429 | |
---|
| 430 | mov ax, di ; save end pointer of list after scan |
---|
| 431 | |
---|
| 432 | sub sp, IDEVARS_size ; copy serial to temporary space on stack |
---|
| 433 | |
---|
| 434 | mov di, sp |
---|
| 435 | |
---|
| 436 | mov cx, IDEVARS_size |
---|
| 437 | push ss |
---|
| 438 | pop es |
---|
| 439 | |
---|
| 440 | rep movsb |
---|
| 441 | |
---|
[380] | 442 | lea di, [si-IDEVARS_size] ; move up all the idevars below the serial, by one slot |
---|
[258] | 443 | |
---|
| 444 | mov cx, ax ; restore end pointer of list, subtract off end of serial idevars |
---|
| 445 | sub cx, si |
---|
| 446 | |
---|
| 447 | push ds |
---|
| 448 | pop es |
---|
| 449 | |
---|
| 450 | rep movsb |
---|
| 451 | |
---|
| 452 | mov si, sp ; place serial (currently on the stack) at bottom of list |
---|
| 453 | push ss |
---|
| 454 | pop ds |
---|
| 455 | mov cx, IDEVARS_size |
---|
| 456 | ; di is already at last IDEVARS position |
---|
[380] | 457 | |
---|
[258] | 458 | rep movsb |
---|
| 459 | |
---|
[380] | 460 | add sp, IDEVARS_size |
---|
[258] | 461 | |
---|
| 462 | push es |
---|
| 463 | pop ds |
---|
| 464 | |
---|
| 465 | mov dh, 1 ; set flag that we have done a relocation |
---|
[380] | 466 | |
---|
[258] | 467 | jmp .outerLoop |
---|
| 468 | |
---|
| 469 | .done: |
---|
| 470 | pop si |
---|
| 471 | pop di |
---|
| 472 | pop ds |
---|
| 473 | pop es |
---|
| 474 | |
---|
| 475 | test dh, dh |
---|
| 476 | jz .noWorkDone |
---|
[380] | 477 | |
---|
[258] | 478 | mov dx, g_szSerialMoved |
---|
| 479 | call Dialogs_DisplayNotificationFromCSDX |
---|
| 480 | |
---|
[380] | 481 | .noWorkDone: |
---|
[457] | 482 | ret |
---|