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