[57] | 1 | ; Project name : XTIDE Universal BIOS Configurator v2 |
---|
| 2 | ; Description : "IDE Controller" menu structs and functions. |
---|
| 3 | |
---|
[376] | 4 | ; |
---|
[399] | 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. |
---|
[399] | 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 |
---|
[399] | 16 | ; GNU General Public License for more details. |
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
[399] | 18 | ; |
---|
[376] | 19 | |
---|
[57] | 20 | ; Section containing initialized data |
---|
| 21 | SECTION .data |
---|
| 22 | |
---|
| 23 | ALIGN WORD_ALIGN |
---|
| 24 | g_MenupageForIdeControllerMenu: |
---|
| 25 | istruc MENUPAGE |
---|
| 26 | at MENUPAGE.fnEnter, dw IdeControllerMenu_EnterMenuOrModifyItemVisibility |
---|
[59] | 27 | at MENUPAGE.fnBack, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility |
---|
[199] | 28 | at MENUPAGE.wMenuitems, dw 11 |
---|
[57] | 29 | iend |
---|
| 30 | |
---|
| 31 | g_MenuitemIdeControllerBackToConfigurationMenu: |
---|
| 32 | istruc MENUITEM |
---|
| 33 | at MENUITEM.fnActivate, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility |
---|
| 34 | at MENUITEM.szName, dw g_szItemBackToCfgMenu |
---|
| 35 | at MENUITEM.szQuickInfo, dw g_szNfoIdeBackToCfgMenu |
---|
| 36 | at MENUITEM.szHelp, dw g_szNfoIdeBackToCfgMenu |
---|
| 37 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE |
---|
| 38 | at MENUITEM.bType, db TYPE_MENUITEM_PAGEBACK |
---|
| 39 | iend |
---|
| 40 | |
---|
| 41 | g_MenuitemIdeControllerMasterDrive: |
---|
| 42 | istruc MENUITEM |
---|
| 43 | at MENUITEM.fnActivate, dw MasterDrive |
---|
| 44 | at MENUITEM.szName, dw g_szItemIdeMaster |
---|
| 45 | at MENUITEM.szQuickInfo, dw g_szNfoIdeMaster |
---|
| 46 | at MENUITEM.szHelp, dw g_szNfoIdeMaster |
---|
| 47 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE |
---|
| 48 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT |
---|
| 49 | iend |
---|
| 50 | |
---|
| 51 | g_MenuitemIdeControllerSlaveDrive: |
---|
| 52 | istruc MENUITEM |
---|
| 53 | at MENUITEM.fnActivate, dw SlaveDrive |
---|
| 54 | at MENUITEM.szName, dw g_szItemIdeSlave |
---|
| 55 | at MENUITEM.szQuickInfo, dw g_szNfoIdeSlave |
---|
| 56 | at MENUITEM.szHelp, dw g_szNfoIdeSlave |
---|
| 57 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE |
---|
| 58 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT |
---|
| 59 | iend |
---|
| 60 | |
---|
[153] | 61 | g_MenuitemIdeControllerDevice: |
---|
[57] | 62 | istruc MENUITEM |
---|
[108] | 63 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI |
---|
[233] | 64 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI |
---|
[153] | 65 | at MENUITEM.szName, dw g_szItemIdeDevice |
---|
| 66 | at MENUITEM.szQuickInfo, dw g_szNfoIdeDevice |
---|
| 67 | at MENUITEM.szHelp, dw g_szNfoIdeDevice |
---|
[199] | 68 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_MODIFY_MENU |
---|
[108] | 69 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE |
---|
[57] | 70 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL |
---|
[153] | 71 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDevice |
---|
| 72 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceCfgDevice |
---|
| 73 | at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForDevice |
---|
| 74 | at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForDevice |
---|
[199] | 75 | at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw IdeControllerMenu_WriteDevice |
---|
[57] | 76 | iend |
---|
| 77 | |
---|
| 78 | g_MenuitemIdeControllerCommandBlockAddress: |
---|
| 79 | istruc MENUITEM |
---|
| 80 | at MENUITEM.fnActivate, dw Menuitem_ActivateHexInputForMenuitemInDSSI |
---|
| 81 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI |
---|
| 82 | at MENUITEM.szName, dw g_szItemIdeCmdPort |
---|
| 83 | at MENUITEM.szQuickInfo, dw g_szNfoIdeCmdPort |
---|
| 84 | at MENUITEM.szHelp, dw g_szHelpIdeCmdPort |
---|
| 85 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE |
---|
| 86 | at MENUITEM.bType, db TYPE_MENUITEM_HEX |
---|
| 87 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL |
---|
| 88 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgIdeCmdPort |
---|
| 89 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 0 |
---|
| 90 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw -1 |
---|
| 91 | iend |
---|
| 92 | |
---|
| 93 | g_MenuitemIdeControllerControlBlockAddress: |
---|
| 94 | istruc MENUITEM |
---|
| 95 | at MENUITEM.fnActivate, dw Menuitem_ActivateHexInputForMenuitemInDSSI |
---|
| 96 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI |
---|
| 97 | at MENUITEM.szName, dw g_szItemIdeCtrlPort |
---|
| 98 | at MENUITEM.szQuickInfo, dw g_szNfoIdeCtrlPort |
---|
| 99 | at MENUITEM.szHelp, dw g_szHelpIdeCtrlPort |
---|
| 100 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE |
---|
| 101 | at MENUITEM.bType, db TYPE_MENUITEM_HEX |
---|
| 102 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL |
---|
| 103 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgIdeCtrlPort |
---|
| 104 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 0 |
---|
| 105 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw -1 |
---|
| 106 | iend |
---|
| 107 | |
---|
[199] | 108 | g_MenuitemIdeControllerSerialCOM: |
---|
| 109 | istruc MENUITEM |
---|
| 110 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI |
---|
[233] | 111 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI |
---|
[199] | 112 | at MENUITEM.szName, dw g_szItemSerialCOM |
---|
| 113 | at MENUITEM.szQuickInfo, dw g_szNfoIdeSerialCOM |
---|
| 114 | at MENUITEM.szHelp, dw g_szHelpIdeSerialCOM |
---|
[233] | 115 | at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS |
---|
[242] | 116 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE |
---|
[199] | 117 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL |
---|
| 118 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDevice |
---|
| 119 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szSerialCOMChoice |
---|
[233] | 120 | at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgbChoiceToValueLookupForCOM |
---|
| 121 | at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForCOM |
---|
[199] | 122 | at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw IdeControllerMenu_SerialWriteCOM |
---|
| 123 | iend |
---|
| 124 | |
---|
| 125 | g_MenuitemIdeControllerSerialPort: |
---|
| 126 | istruc MENUITEM |
---|
| 127 | at MENUITEM.fnActivate, dw Menuitem_ActivateHexInputForMenuitemInDSSI |
---|
| 128 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI |
---|
| 129 | at MENUITEM.szName, dw g_szItemSerialPort |
---|
| 130 | at MENUITEM.szQuickInfo, dw g_szNfoIdeSerialPort |
---|
| 131 | at MENUITEM.szHelp, dw g_szHelpIdeSerialPort |
---|
[233] | 132 | at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE |
---|
[199] | 133 | at MENUITEM.bType, db TYPE_MENUITEM_HEX |
---|
| 134 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL |
---|
| 135 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgIdeCmdPort |
---|
[233] | 136 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 8h |
---|
| 137 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 3f8h |
---|
[199] | 138 | at MENUITEM.itemValue + ITEM_VALUE.fnValueReader, dw IdeControllerMenu_SerialReadPort |
---|
| 139 | at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw IdeControllerMenu_SerialWritePort |
---|
[242] | 140 | iend |
---|
[199] | 141 | |
---|
[242] | 142 | g_MenuitemIdeControllerSerialBaud: |
---|
[199] | 143 | istruc MENUITEM |
---|
| 144 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI |
---|
[233] | 145 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI |
---|
[199] | 146 | at MENUITEM.szName, dw g_szItemSerialBaud |
---|
| 147 | at MENUITEM.szQuickInfo, dw g_szNfoIdeSerialBaud |
---|
| 148 | at MENUITEM.szHelp, dw g_szHelpIdeSerialBaud |
---|
[233] | 149 | at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS |
---|
[199] | 150 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE |
---|
| 151 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL |
---|
| 152 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDevice |
---|
| 153 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szSerialBaudChoice |
---|
[233] | 154 | at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgbChoiceToValueLookupForBaud |
---|
| 155 | at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForBaud |
---|
[199] | 156 | iend |
---|
[242] | 157 | |
---|
[57] | 158 | g_MenuitemIdeControllerEnableInterrupt: |
---|
| 159 | istruc MENUITEM |
---|
[108] | 160 | at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI |
---|
[59] | 161 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI |
---|
[57] | 162 | at MENUITEM.szName, dw g_szItemIdeEnIRQ |
---|
| 163 | at MENUITEM.szQuickInfo, dw g_szNfoIdeEnIRQ |
---|
| 164 | at MENUITEM.szHelp, dw g_szHelpIdeEnIRQ |
---|
[459] | 165 | at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE |
---|
[108] | 166 | at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE |
---|
[57] | 167 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL |
---|
| 168 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgIdeEnIRQ |
---|
[108] | 169 | at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag |
---|
[57] | 170 | at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans |
---|
| 171 | at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw 15 |
---|
| 172 | iend |
---|
| 173 | |
---|
| 174 | g_MenuitemIdeControllerIdeIRQ: |
---|
| 175 | istruc MENUITEM |
---|
| 176 | at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI |
---|
| 177 | at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI |
---|
| 178 | at MENUITEM.szName, dw g_szItemIdeIRQ |
---|
| 179 | at MENUITEM.szQuickInfo, dw g_szNfoIdeIRQ |
---|
| 180 | at MENUITEM.szHelp, dw g_szHelpIdeIRQ |
---|
| 181 | at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE |
---|
| 182 | at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED |
---|
| 183 | at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL |
---|
| 184 | at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgIdeIRQ |
---|
| 185 | at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 2 |
---|
| 186 | at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 15 |
---|
| 187 | iend |
---|
| 188 | |
---|
[153] | 189 | g_rgwChoiceToValueLookupForDevice: |
---|
[403] | 190 | dw DEVICE_8BIT_JRIDE_ISA |
---|
[438] | 191 | dw DEVICE_8BIT_XTCF |
---|
[403] | 192 | dw DEVICE_8BIT_XTIDE_REV2 |
---|
| 193 | dw DEVICE_8BIT_XTIDE_REV1 |
---|
[153] | 194 | dw DEVICE_16BIT_ATA |
---|
| 195 | dw DEVICE_32BIT_ATA |
---|
| 196 | dw DEVICE_SERIAL_PORT |
---|
| 197 | g_rgszValueToStringLookupForDevice: |
---|
[403] | 198 | dw g_szValueCfgDeviceJrIdeIsa |
---|
| 199 | dw g_szValueCfgDeviceFast |
---|
| 200 | dw g_szValueCfgDeviceRev2 |
---|
[362] | 201 | dw g_szValueCfgDeviceRev1 |
---|
[153] | 202 | dw g_szValueCfgDevice16b |
---|
| 203 | dw g_szValueCfgDevice32b |
---|
| 204 | dw g_szValueCfgDeviceSerial |
---|
[57] | 205 | |
---|
[403] | 206 | |
---|
[233] | 207 | g_rgbChoiceToValueLookupForCOM: |
---|
| 208 | dw '1' |
---|
| 209 | dw '2' |
---|
| 210 | dw '3' |
---|
| 211 | dw '4' |
---|
| 212 | dw '5' |
---|
| 213 | dw '6' |
---|
| 214 | dw '7' |
---|
| 215 | dw '8' |
---|
| 216 | dw '9' |
---|
| 217 | dw 'A' |
---|
| 218 | dw 'B' |
---|
| 219 | dw 'C' |
---|
| 220 | dw 'x' ; must be last entry (see reader/write routines) |
---|
[242] | 221 | g_rgszChoiceToStringLookupForCOM: |
---|
[199] | 222 | dw g_szValueCfgCOM1 |
---|
| 223 | dw g_szValueCfgCOM2 |
---|
| 224 | dw g_szValueCfgCOM3 |
---|
| 225 | dw g_szValueCfgCOM4 |
---|
| 226 | dw g_szValueCfgCOM5 |
---|
| 227 | dw g_szValueCfgCOM6 |
---|
| 228 | dw g_szValueCfgCOM7 |
---|
| 229 | dw g_szValueCfgCOM8 |
---|
| 230 | dw g_szValueCfgCOM9 |
---|
| 231 | dw g_szValueCfgCOMA |
---|
| 232 | dw g_szValueCfgCOMB |
---|
| 233 | dw g_szValueCfgCOMC |
---|
| 234 | dw g_szValueCfgCOMx |
---|
[233] | 235 | dw NULL |
---|
[57] | 236 | |
---|
[280] | 237 | SERIAL_DEFAULT_CUSTOM_PORT EQU 300h ; can't be any of the pre-defined COM values |
---|
[199] | 238 | |
---|
[233] | 239 | PackedCOMPortAddresses: ; COM1 - COMC (or COM12) |
---|
[280] | 240 | db SERIAL_COM1_IOADDRESS >> 2 |
---|
| 241 | db SERIAL_COM2_IOADDRESS >> 2 |
---|
| 242 | db SERIAL_COM3_IOADDRESS >> 2 |
---|
| 243 | db SERIAL_COM4_IOADDRESS >> 2 |
---|
| 244 | db SERIAL_COM5_IOADDRESS >> 2 |
---|
| 245 | db SERIAL_COM6_IOADDRESS >> 2 |
---|
| 246 | db SERIAL_COM7_IOADDRESS >> 2 |
---|
| 247 | db SERIAL_COM8_IOADDRESS >> 2 |
---|
| 248 | db SERIAL_COM9_IOADDRESS >> 2 |
---|
| 249 | db SERIAL_COMA_IOADDRESS >> 2 |
---|
| 250 | db SERIAL_COMB_IOADDRESS >> 2 |
---|
| 251 | db SERIAL_COMC_IOADDRESS >> 2 |
---|
| 252 | db SERIAL_DEFAULT_CUSTOM_PORT >> 2 ; must be last entry (see reader/writer routines) |
---|
| 253 | SERIAL_DEFAULT_COM EQU '1' |
---|
[242] | 254 | |
---|
[233] | 255 | g_rgbChoiceToValueLookupForBaud: |
---|
| 256 | dw (115200 / 115200) & 0xff |
---|
| 257 | dw (115200 / 57600) & 0xff |
---|
| 258 | dw (115200 / 38400) & 0xff |
---|
| 259 | dw (115200 / 28800) & 0xff |
---|
| 260 | dw (115200 / 19200) & 0xff |
---|
| 261 | dw (115200 / 9600) & 0xff |
---|
| 262 | dw (115200 / 4800) & 0xff |
---|
| 263 | dw (115200 / 2400) & 0xff |
---|
| 264 | g_rgszChoiceToStringLookupForBaud: |
---|
| 265 | dw g_szValueCfgBaud115_2 |
---|
| 266 | dw g_szValueCfgBaud57_6 |
---|
| 267 | dw g_szValueCfgBaud38_4 |
---|
| 268 | dw g_szValueCfgBaud28_8 |
---|
| 269 | dw g_szValueCfgBaud19_2 |
---|
| 270 | dw g_szValueCfgBaud9600 |
---|
| 271 | dw g_szValueCfgBaud4800 |
---|
| 272 | dw g_szValueCfgBaud2400 |
---|
| 273 | dw NULL |
---|
[280] | 274 | SERIAL_DEFAULT_BAUD EQU ((115200 / 9600) & 0xff) |
---|
[199] | 275 | |
---|
[57] | 276 | ; Section containing code |
---|
| 277 | SECTION .text |
---|
| 278 | |
---|
| 279 | ;-------------------------------------------------------------------- |
---|
| 280 | ; IdeControllerMenu_InitializeToIdevarsOffsetInBX |
---|
| 281 | ; Parameters: |
---|
| 282 | ; SS:BP: Menu handle |
---|
| 283 | ; Returns: |
---|
| 284 | ; Nothing |
---|
| 285 | ; Corrupts registers: |
---|
| 286 | ; AX |
---|
| 287 | ;-------------------------------------------------------------------- |
---|
| 288 | ALIGN JUMP_ALIGN |
---|
| 289 | IdeControllerMenu_InitializeToIdevarsOffsetInBX: |
---|
| 290 | lea ax, [bx+IDEVARS.drvParamsMaster] |
---|
| 291 | mov [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax |
---|
| 292 | |
---|
| 293 | lea ax, [bx+IDEVARS.drvParamsSlave] |
---|
| 294 | mov [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax |
---|
| 295 | |
---|
[153] | 296 | lea ax, [bx+IDEVARS.bDevice] |
---|
| 297 | mov [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax |
---|
[57] | 298 | |
---|
| 299 | lea ax, [bx+IDEVARS.wPort] |
---|
| 300 | mov [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax |
---|
[242] | 301 | |
---|
| 302 | lea ax, [bx+IDEVARS.bSerialPort] |
---|
[199] | 303 | mov [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax |
---|
[233] | 304 | |
---|
| 305 | lea ax, [bx+IDEVARS.bSerialBaud] |
---|
[199] | 306 | mov [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax |
---|
[242] | 307 | |
---|
[57] | 308 | lea ax, [bx+IDEVARS.wPortCtrl] |
---|
| 309 | mov [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax |
---|
[242] | 310 | |
---|
[233] | 311 | lea ax, [bx+IDEVARS.bSerialCOMPortChar] |
---|
[242] | 312 | mov [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax |
---|
[57] | 313 | |
---|
| 314 | lea ax, [bx+IDEVARS.bIRQ] |
---|
| 315 | mov [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax |
---|
| 316 | mov [cs:g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax |
---|
[199] | 317 | |
---|
[57] | 318 | ret |
---|
| 319 | |
---|
| 320 | |
---|
| 321 | ;-------------------------------------------------------------------- |
---|
| 322 | ; IdeControllerMenu_EnterMenuOrModifyItemVisibility |
---|
| 323 | ; Parameters: |
---|
| 324 | ; SS:BP: Menu handle |
---|
| 325 | ; Returns: |
---|
| 326 | ; Nothing |
---|
| 327 | ; Corrupts registers: |
---|
| 328 | ; All, except BP |
---|
| 329 | ;-------------------------------------------------------------------- |
---|
| 330 | ALIGN JUMP_ALIGN |
---|
| 331 | IdeControllerMenu_EnterMenuOrModifyItemVisibility: |
---|
| 332 | push cs |
---|
| 333 | pop ds |
---|
[459] | 334 | call .DisableIRQchannelSelection |
---|
| 335 | call .EnableOrDisableEnableInterrupt |
---|
[199] | 336 | call .EnableOrDisableSerial |
---|
[57] | 337 | mov si, g_MenupageForIdeControllerMenu |
---|
| 338 | jmp Menupage_ChangeToNewMenupageInDSSI |
---|
| 339 | |
---|
[459] | 340 | |
---|
[57] | 341 | ;-------------------------------------------------------------------- |
---|
[459] | 342 | ; .EnableOrDisableEnableInterrupt |
---|
[57] | 343 | ; Parameters: |
---|
| 344 | ; SS:BP: Menu handle |
---|
| 345 | ; Returns: |
---|
| 346 | ; Nothing |
---|
| 347 | ; Corrupts registers: |
---|
| 348 | ; AX, BX |
---|
| 349 | ;-------------------------------------------------------------------- |
---|
| 350 | ALIGN JUMP_ALIGN |
---|
[459] | 351 | .EnableOrDisableEnableInterrupt: |
---|
| 352 | call Buffers_GetRomvarsFlagsToAX |
---|
| 353 | mov bx, g_MenuitemIdeControllerEnableInterrupt |
---|
| 354 | test ax, FLG_ROMVARS_MODULE_IRQ |
---|
| 355 | jz SHORT .DisableMenuitemFromCSBX |
---|
| 356 | |
---|
| 357 | mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] |
---|
| 358 | call Buffers_GetRomvarsValueToAXfromOffsetInBX |
---|
| 359 | mov bx, g_MenuitemIdeControllerEnableInterrupt |
---|
| 360 | cmp al, DEVICE_SERIAL_PORT |
---|
| 361 | jae SHORT .DisableMenuitemFromCSBX |
---|
| 362 | cmp al, DEVICE_8BIT_XTCF |
---|
| 363 | jbe SHORT .DisableMenuitemFromCSBX |
---|
| 364 | |
---|
| 365 | call .EnableMenuitemFromCSBX |
---|
| 366 | ; Fall to .EnableOrDisableIRQchannelSelection |
---|
| 367 | |
---|
| 368 | ;-------------------------------------------------------------------- |
---|
| 369 | ; .EnableOrDisableIRQchannelSelection |
---|
| 370 | ; Parameters: |
---|
| 371 | ; SS:BP: Menu handle |
---|
| 372 | ; Returns: |
---|
| 373 | ; Nothing |
---|
| 374 | ; Corrupts registers: |
---|
| 375 | ; AX, BX |
---|
| 376 | ;-------------------------------------------------------------------- |
---|
| 377 | ALIGN JUMP_ALIGN |
---|
| 378 | .EnableOrDisableIRQchannelSelection: |
---|
[57] | 379 | mov bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] |
---|
| 380 | call Buffers_GetRomvarsValueToAXfromOffsetInBX |
---|
| 381 | mov bx, g_MenuitemIdeControllerIdeIRQ |
---|
[109] | 382 | test al, al |
---|
[459] | 383 | jnz SHORT .EnableMenuitemFromCSBX |
---|
| 384 | .DisableIRQchannelSelection: |
---|
| 385 | mov bx, g_MenuitemIdeControllerIdeIRQ |
---|
[57] | 386 | jz SHORT .DisableMenuitemFromCSBX |
---|
[459] | 387 | ; Fall to .DisableMenuitemFromCSBX |
---|
[57] | 388 | |
---|
[459] | 389 | |
---|
[57] | 390 | ;-------------------------------------------------------------------- |
---|
[459] | 391 | ; .DisableMenuitemFromCSBX |
---|
[57] | 392 | ; .EnableMenuitemFromCSBX |
---|
| 393 | ; Parameters: |
---|
| 394 | ; CS:BX: Ptr to MENUITEM |
---|
| 395 | ; Returns: |
---|
| 396 | ; Nothing |
---|
| 397 | ; Corrupts registers: |
---|
| 398 | ; Nothing |
---|
| 399 | ;-------------------------------------------------------------------- |
---|
| 400 | ALIGN JUMP_ALIGN |
---|
[459] | 401 | .DisableMenuitemFromCSBX: |
---|
| 402 | and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE |
---|
[57] | 403 | ret |
---|
| 404 | |
---|
| 405 | ALIGN JUMP_ALIGN |
---|
[459] | 406 | .EnableMenuitemFromCSBX: |
---|
| 407 | or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE |
---|
[57] | 408 | ret |
---|
| 409 | |
---|
[459] | 410 | |
---|
[199] | 411 | .EnableOrDisableSerial: |
---|
| 412 | mov bx, g_MenuitemIdeControllerCommandBlockAddress |
---|
| 413 | call .DisableMenuitemFromCSBX |
---|
[57] | 414 | |
---|
[199] | 415 | mov bx, g_MenuitemIdeControllerControlBlockAddress |
---|
| 416 | call .DisableMenuitemFromCSBX |
---|
| 417 | |
---|
| 418 | mov bx, g_MenuitemIdeControllerSerialBaud |
---|
| 419 | call .DisableMenuitemFromCSBX |
---|
| 420 | |
---|
| 421 | mov bx, g_MenuitemIdeControllerSerialCOM |
---|
| 422 | call .DisableMenuitemFromCSBX |
---|
| 423 | |
---|
| 424 | mov bx, g_MenuitemIdeControllerSerialPort |
---|
| 425 | call .DisableMenuitemFromCSBX |
---|
[242] | 426 | |
---|
| 427 | mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] |
---|
[199] | 428 | call Buffers_GetRomvarsValueToAXfromOffsetInBX |
---|
[459] | 429 | cmp al, DEVICE_SERIAL_PORT |
---|
[199] | 430 | jnz .DisableAllSerial |
---|
| 431 | |
---|
| 432 | mov bx, g_MenuitemIdeControllerSerialCOM |
---|
| 433 | call .EnableMenuitemFromCSBX |
---|
| 434 | |
---|
| 435 | mov bx, g_MenuitemIdeControllerSerialBaud |
---|
| 436 | call .EnableMenuitemFromCSBX |
---|
| 437 | |
---|
[242] | 438 | mov bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] |
---|
[199] | 439 | call Buffers_GetRomvarsValueToAXfromOffsetInBX |
---|
| 440 | mov bx, g_MenuitemIdeControllerSerialPort |
---|
| 441 | cmp al,'x' |
---|
| 442 | jz .EnableMenuitemFromCSBX |
---|
| 443 | jmp .DisableMenuitemFromCSBX |
---|
| 444 | |
---|
| 445 | .DisableAllSerial: |
---|
| 446 | |
---|
| 447 | mov bx, g_MenuitemIdeControllerCommandBlockAddress |
---|
| 448 | call .EnableMenuitemFromCSBX |
---|
| 449 | |
---|
| 450 | mov bx, g_MenuitemIdeControllerControlBlockAddress |
---|
| 451 | call .EnableMenuitemFromCSBX |
---|
| 452 | |
---|
| 453 | ret |
---|
[242] | 454 | |
---|
[57] | 455 | ;-------------------------------------------------------------------- |
---|
| 456 | ; MENUITEM activation functions (.fnActivate) |
---|
| 457 | ; Parameters: |
---|
| 458 | ; SS:BP: Ptr to MENU |
---|
| 459 | ; Returns: |
---|
| 460 | ; Nothing |
---|
| 461 | ; Corrupts registers: |
---|
| 462 | ; All, except segments |
---|
| 463 | ;-------------------------------------------------------------------- |
---|
| 464 | ALIGN JUMP_ALIGN |
---|
| 465 | MasterDrive: |
---|
| 466 | mov bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] |
---|
| 467 | jmp SHORT DisplayMasterSlaveMenu |
---|
| 468 | |
---|
| 469 | ALIGN JUMP_ALIGN |
---|
| 470 | SlaveDrive: |
---|
| 471 | mov bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] |
---|
| 472 | ; Fall to DisplayMasterSlaveMenu |
---|
| 473 | |
---|
| 474 | ALIGN JUMP_ALIGN |
---|
| 475 | DisplayMasterSlaveMenu: |
---|
[233] | 476 | ; |
---|
| 477 | ; block mode is not supported on serial drives, disable/enable the option as appropriate |
---|
| 478 | ; |
---|
| 479 | push bx |
---|
[242] | 480 | mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset] |
---|
[233] | 481 | call Buffers_GetRomvarsValueToAXfromOffsetInBX |
---|
| 482 | mov bx, g_MenuitemMasterSlaveBlockModeTransfers |
---|
| 483 | cmp al,DEVICE_SERIAL_PORT |
---|
| 484 | jz .isSerial |
---|
| 485 | or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE |
---|
| 486 | jmp .isDone |
---|
[242] | 487 | .isSerial: |
---|
[233] | 488 | and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE |
---|
| 489 | .isDone: |
---|
| 490 | pop bx |
---|
[242] | 491 | |
---|
[57] | 492 | call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX |
---|
| 493 | jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility |
---|
[199] | 494 | |
---|
| 495 | ;------------------------------------------------------------------------------------------ |
---|
| 496 | ; |
---|
| 497 | ; Reader/Writer Routines |
---|
| 498 | ; |
---|
| 499 | ; For serial drives, we pack the port number and baud rate into a single byte, and thus |
---|
| 500 | ; we need to take care to properly read/write just the bits we need. In addition, since |
---|
| 501 | ; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly |
---|
[242] | 502 | ; default the values stored in both these words when switching in and out of the Serial |
---|
[199] | 503 | ; device choice. |
---|
| 504 | ; |
---|
| 505 | ; Writers: |
---|
| 506 | ; Parameters: |
---|
| 507 | ; AX: Value that the MENUITEM system was interacting with |
---|
| 508 | ; ES:DI: ROMVARS location where the value is to be stored |
---|
| 509 | ; DS:SI: MENUITEM pointer |
---|
| 510 | ; Returns: |
---|
| 511 | ; AX: Value to actually write to ROMVARS |
---|
| 512 | ; Corrupts registers: |
---|
| 513 | ; AX |
---|
| 514 | ; |
---|
| 515 | ; Readers: |
---|
| 516 | ; Parameters: |
---|
| 517 | ; AX: Value read from the ROMVARS location |
---|
| 518 | ; ES:DI: ROMVARS location where the value was just read from |
---|
| 519 | ; DS:SI: MENUITEM pointer |
---|
| 520 | ; Returns: |
---|
| 521 | ; AX: Value that the MENUITEM system will interact with and display |
---|
| 522 | ; Corrupts registers: |
---|
| 523 | ; AX |
---|
| 524 | ; |
---|
| 525 | |
---|
| 526 | ; |
---|
| 527 | ; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are |
---|
[242] | 528 | ; changing in/out of a Serial device (since we use these bytes in radically different ways). |
---|
[199] | 529 | ; |
---|
| 530 | ALIGN JUMP_ALIGN |
---|
| 531 | IdeControllerMenu_WriteDevice: |
---|
| 532 | push ax |
---|
| 533 | push bx |
---|
| 534 | push di |
---|
| 535 | |
---|
| 536 | mov bl,[es:di] ; what is the current Device? |
---|
[242] | 537 | |
---|
[199] | 538 | add di,IDEVARS.wPort - IDEVARS.bDevice ; Get ready to set the Port addresses |
---|
[242] | 539 | |
---|
[199] | 540 | cmp al,DEVICE_SERIAL_PORT |
---|
| 541 | jz .changingToSerial |
---|
| 542 | |
---|
| 543 | cmp bl,DEVICE_SERIAL_PORT |
---|
| 544 | jnz .done ; if we weren't Serial before, nothing to do |
---|
| 545 | |
---|
| 546 | .changingFromSerial: |
---|
| 547 | cmp al,DEVICE_16BIT_ATA |
---|
| 548 | |
---|
[242] | 549 | mov ax,DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE devices |
---|
| 550 | mov bx,DEVICE_XTIDE_DEFAULT_PORTCTRL |
---|
| 551 | |
---|
| 552 | jb .writeNonSerial |
---|
| 553 | |
---|
[399] | 554 | mov ax, DEVICE_ATA_PRIMARY_PORT ; Defaults for 16-bit and better ATA devices |
---|
| 555 | mov bx, DEVICE_ATA_PRIMARY_PORTCTRL |
---|
[199] | 556 | |
---|
[242] | 557 | .writeNonSerial: |
---|
| 558 | stosw ; Store defaults in IDEVARS.wPort and IDEVARS.wPortCtrl |
---|
| 559 | xchg bx, ax |
---|
| 560 | stosw |
---|
[199] | 561 | |
---|
| 562 | jmp .done |
---|
| 563 | |
---|
[242] | 564 | .changingToSerial: |
---|
[199] | 565 | cmp bl,DEVICE_SERIAL_PORT |
---|
| 566 | jz .done ; if we were already serial, nothing to do |
---|
| 567 | |
---|
[280] | 568 | mov byte [es:di+IDEVARS.bSerialBaud-IDEVARS.wPort],SERIAL_DEFAULT_BAUD |
---|
[233] | 569 | |
---|
[280] | 570 | mov al,SERIAL_DEFAULT_COM |
---|
[233] | 571 | add di,IDEVARS.bSerialCOMPortChar-IDEVARS.wPort |
---|
[199] | 572 | call IdeControllerMenu_SerialWriteCOM |
---|
[242] | 573 | stosb |
---|
| 574 | |
---|
| 575 | .done: |
---|
[199] | 576 | pop di |
---|
| 577 | pop bx |
---|
| 578 | pop ax |
---|
| 579 | |
---|
| 580 | ret |
---|
| 581 | |
---|
| 582 | ; |
---|
[233] | 583 | ; Doesn't modify COM character (unless it is not recognized, which would be an error case), |
---|
[242] | 584 | ; But does update the port address based on COM port selection |
---|
| 585 | ; |
---|
[199] | 586 | ALIGN JUMP_ALIGN |
---|
| 587 | IdeControllerMenu_SerialWriteCOM: |
---|
[233] | 588 | push ax |
---|
[199] | 589 | push bx |
---|
[233] | 590 | push si |
---|
[242] | 591 | |
---|
[233] | 592 | mov si,g_rgbChoiceToValueLookupForCOM |
---|
| 593 | mov bx,PackedCOMPortAddresses |
---|
[199] | 594 | |
---|
[233] | 595 | .loop: |
---|
| 596 | mov ah,[bx] |
---|
[199] | 597 | |
---|
[280] | 598 | cmp ah,(SERIAL_DEFAULT_CUSTOM_PORT >> 2) |
---|
[233] | 599 | jz .notFound |
---|
[242] | 600 | |
---|
[233] | 601 | cmp al,[si] |
---|
| 602 | jz .found |
---|
[242] | 603 | |
---|
[233] | 604 | inc si |
---|
| 605 | inc si |
---|
| 606 | inc bx |
---|
[242] | 607 | |
---|
[233] | 608 | jmp .loop |
---|
[199] | 609 | |
---|
[233] | 610 | .notFound: |
---|
| 611 | mov al, 'x' |
---|
[242] | 612 | |
---|
| 613 | .found: |
---|
[233] | 614 | mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah |
---|
[199] | 615 | |
---|
[233] | 616 | pop si |
---|
[199] | 617 | pop bx |
---|
[233] | 618 | pop ax |
---|
[242] | 619 | |
---|
[199] | 620 | ret |
---|
| 621 | |
---|
[242] | 622 | |
---|
[199] | 623 | ; |
---|
[233] | 624 | ; Packed Port (byte) -> Numeric Port (word) |
---|
[242] | 625 | ; |
---|
[199] | 626 | ALIGN JUMP_ALIGN |
---|
[233] | 627 | IdeControllerMenu_SerialReadPort: |
---|
| 628 | xor ah,ah |
---|
[242] | 629 | eSHL_IM ax, 2 |
---|
[199] | 630 | ret |
---|
| 631 | |
---|
| 632 | ; |
---|
[233] | 633 | ; Numeric Port (word) -> Packed Port (byte) |
---|
| 634 | ; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers |
---|
[199] | 635 | ; |
---|
| 636 | ALIGN JUMP_ALIGN |
---|
[242] | 637 | IdeControllerMenu_SerialWritePort: |
---|
[199] | 638 | push bx |
---|
[233] | 639 | push si |
---|
[199] | 640 | |
---|
[242] | 641 | eSHR_IM ax, 2 |
---|
[233] | 642 | and al,0feh ; force 8-byte boundary |
---|
[199] | 643 | |
---|
[242] | 644 | mov si,g_rgbChoiceToValueLookupForCOM |
---|
[233] | 645 | mov bx,PackedCOMPortAddresses ; loop, looking for port address in known COM address list |
---|
| 646 | |
---|
| 647 | .loop: |
---|
| 648 | mov ah,[si] |
---|
| 649 | cmp ah,'x' |
---|
| 650 | jz .found |
---|
[242] | 651 | |
---|
[233] | 652 | cmp al,[bx] |
---|
| 653 | jz .found |
---|
[242] | 654 | |
---|
[233] | 655 | inc si |
---|
| 656 | inc si |
---|
[199] | 657 | inc bx |
---|
[242] | 658 | |
---|
[233] | 659 | jmp .loop |
---|
[199] | 660 | |
---|
[242] | 661 | .found: |
---|
[233] | 662 | mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah |
---|
| 663 | |
---|
| 664 | pop si |
---|
[199] | 665 | pop bx |
---|
| 666 | |
---|
[233] | 667 | ret |
---|
[199] | 668 | |
---|