[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
|
---|
| 165 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | 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
|
---|
| 191 | dw DEVICE_8BIT_FAST_XTIDE
|
---|
| 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
|
---|
| 334 | call .EnableOrDisableIRQ
|
---|
[199] | 335 | call .EnableOrDisableSerial
|
---|
[57] | 336 | mov si, g_MenupageForIdeControllerMenu
|
---|
| 337 | jmp Menupage_ChangeToNewMenupageInDSSI
|
---|
| 338 |
|
---|
| 339 | ;--------------------------------------------------------------------
|
---|
| 340 | ; .EnableOrDisableIRQ
|
---|
| 341 | ; Parameters:
|
---|
| 342 | ; SS:BP: Menu handle
|
---|
| 343 | ; Returns:
|
---|
| 344 | ; Nothing
|
---|
| 345 | ; Corrupts registers:
|
---|
| 346 | ; AX, BX
|
---|
| 347 | ;--------------------------------------------------------------------
|
---|
| 348 | ALIGN JUMP_ALIGN
|
---|
| 349 | .EnableOrDisableIRQ:
|
---|
| 350 | mov bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
| 351 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
| 352 | mov bx, g_MenuitemIdeControllerIdeIRQ
|
---|
[109] | 353 | test al, al
|
---|
[57] | 354 | jz SHORT .DisableMenuitemFromCSBX
|
---|
| 355 | ; Fall to .EnableMenuitemFromCSBX
|
---|
| 356 |
|
---|
| 357 | ;--------------------------------------------------------------------
|
---|
| 358 | ; .EnableMenuitemFromCSBX
|
---|
| 359 | ; .DisableMenuitemFromCSBX
|
---|
| 360 | ; Parameters:
|
---|
| 361 | ; CS:BX: Ptr to MENUITEM
|
---|
| 362 | ; Returns:
|
---|
| 363 | ; Nothing
|
---|
| 364 | ; Corrupts registers:
|
---|
| 365 | ; Nothing
|
---|
| 366 | ;--------------------------------------------------------------------
|
---|
| 367 | ALIGN JUMP_ALIGN
|
---|
| 368 | .EnableMenuitemFromCSBX:
|
---|
| 369 | or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
| 370 | ret
|
---|
| 371 |
|
---|
| 372 | ALIGN JUMP_ALIGN
|
---|
| 373 | .DisableMenuitemFromCSBX:
|
---|
| 374 | and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
|
---|
| 375 | ret
|
---|
| 376 |
|
---|
[199] | 377 | .EnableOrDisableSerial:
|
---|
| 378 | mov bx, g_MenuitemIdeControllerCommandBlockAddress
|
---|
| 379 | call .DisableMenuitemFromCSBX
|
---|
[57] | 380 |
|
---|
[199] | 381 | mov bx, g_MenuitemIdeControllerControlBlockAddress
|
---|
| 382 | call .DisableMenuitemFromCSBX
|
---|
| 383 |
|
---|
| 384 | mov bx, g_MenuitemIdeControllerEnableInterrupt
|
---|
| 385 | call .DisableMenuitemFromCSBX
|
---|
| 386 |
|
---|
| 387 | mov bx, g_MenuitemIdeControllerSerialBaud
|
---|
| 388 | call .DisableMenuitemFromCSBX
|
---|
| 389 |
|
---|
| 390 | mov bx, g_MenuitemIdeControllerSerialCOM
|
---|
| 391 | call .DisableMenuitemFromCSBX
|
---|
| 392 |
|
---|
| 393 | mov bx, g_MenuitemIdeControllerSerialPort
|
---|
| 394 | call .DisableMenuitemFromCSBX
|
---|
[242] | 395 |
|
---|
| 396 | mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
[199] | 397 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
| 398 | cmp al,DEVICE_SERIAL_PORT
|
---|
| 399 | jnz .DisableAllSerial
|
---|
| 400 |
|
---|
| 401 | mov bx, g_MenuitemIdeControllerSerialCOM
|
---|
| 402 | call .EnableMenuitemFromCSBX
|
---|
| 403 |
|
---|
| 404 | mov bx, g_MenuitemIdeControllerSerialBaud
|
---|
| 405 | call .EnableMenuitemFromCSBX
|
---|
| 406 |
|
---|
[242] | 407 | mov bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
[199] | 408 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
| 409 | mov bx, g_MenuitemIdeControllerSerialPort
|
---|
| 410 | cmp al,'x'
|
---|
| 411 | jz .EnableMenuitemFromCSBX
|
---|
| 412 | jmp .DisableMenuitemFromCSBX
|
---|
| 413 |
|
---|
| 414 | .DisableAllSerial:
|
---|
| 415 |
|
---|
| 416 | mov bx, g_MenuitemIdeControllerCommandBlockAddress
|
---|
| 417 | call .EnableMenuitemFromCSBX
|
---|
| 418 |
|
---|
| 419 | mov bx, g_MenuitemIdeControllerControlBlockAddress
|
---|
| 420 | call .EnableMenuitemFromCSBX
|
---|
| 421 |
|
---|
| 422 | mov bx, g_MenuitemIdeControllerEnableInterrupt
|
---|
[242] | 423 | call .EnableMenuitemFromCSBX
|
---|
[199] | 424 |
|
---|
| 425 | ret
|
---|
[242] | 426 |
|
---|
[57] | 427 | ;--------------------------------------------------------------------
|
---|
| 428 | ; MENUITEM activation functions (.fnActivate)
|
---|
| 429 | ; Parameters:
|
---|
| 430 | ; SS:BP: Ptr to MENU
|
---|
| 431 | ; Returns:
|
---|
| 432 | ; Nothing
|
---|
| 433 | ; Corrupts registers:
|
---|
| 434 | ; All, except segments
|
---|
| 435 | ;--------------------------------------------------------------------
|
---|
| 436 | ALIGN JUMP_ALIGN
|
---|
| 437 | MasterDrive:
|
---|
| 438 | mov bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
| 439 | jmp SHORT DisplayMasterSlaveMenu
|
---|
| 440 |
|
---|
| 441 | ALIGN JUMP_ALIGN
|
---|
| 442 | SlaveDrive:
|
---|
| 443 | mov bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
| 444 | ; Fall to DisplayMasterSlaveMenu
|
---|
| 445 |
|
---|
| 446 | ALIGN JUMP_ALIGN
|
---|
| 447 | DisplayMasterSlaveMenu:
|
---|
[233] | 448 | ;
|
---|
| 449 | ; block mode is not supported on serial drives, disable/enable the option as appropriate
|
---|
| 450 | ;
|
---|
| 451 | push bx
|
---|
[242] | 452 | mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
[233] | 453 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
| 454 | mov bx, g_MenuitemMasterSlaveBlockModeTransfers
|
---|
| 455 | cmp al,DEVICE_SERIAL_PORT
|
---|
| 456 | jz .isSerial
|
---|
| 457 | or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
| 458 | jmp .isDone
|
---|
[242] | 459 | .isSerial:
|
---|
[233] | 460 | and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
|
---|
| 461 | .isDone:
|
---|
| 462 | pop bx
|
---|
[242] | 463 |
|
---|
[57] | 464 | call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
|
---|
| 465 | jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility
|
---|
[199] | 466 |
|
---|
| 467 | ;------------------------------------------------------------------------------------------
|
---|
| 468 | ;
|
---|
| 469 | ; Reader/Writer Routines
|
---|
| 470 | ;
|
---|
| 471 | ; For serial drives, we pack the port number and baud rate into a single byte, and thus
|
---|
| 472 | ; we need to take care to properly read/write just the bits we need. In addition, since
|
---|
| 473 | ; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
|
---|
[242] | 474 | ; default the values stored in both these words when switching in and out of the Serial
|
---|
[199] | 475 | ; device choice.
|
---|
| 476 | ;
|
---|
| 477 | ; Writers:
|
---|
| 478 | ; Parameters:
|
---|
| 479 | ; AX: Value that the MENUITEM system was interacting with
|
---|
| 480 | ; ES:DI: ROMVARS location where the value is to be stored
|
---|
| 481 | ; DS:SI: MENUITEM pointer
|
---|
| 482 | ; Returns:
|
---|
| 483 | ; AX: Value to actually write to ROMVARS
|
---|
| 484 | ; Corrupts registers:
|
---|
| 485 | ; AX
|
---|
| 486 | ;
|
---|
| 487 | ; Readers:
|
---|
| 488 | ; Parameters:
|
---|
| 489 | ; AX: Value read from the ROMVARS location
|
---|
| 490 | ; ES:DI: ROMVARS location where the value was just read from
|
---|
| 491 | ; DS:SI: MENUITEM pointer
|
---|
| 492 | ; Returns:
|
---|
| 493 | ; AX: Value that the MENUITEM system will interact with and display
|
---|
| 494 | ; Corrupts registers:
|
---|
| 495 | ; AX
|
---|
| 496 | ;
|
---|
| 497 |
|
---|
| 498 | ;
|
---|
| 499 | ; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are
|
---|
[242] | 500 | ; changing in/out of a Serial device (since we use these bytes in radically different ways).
|
---|
[199] | 501 | ;
|
---|
| 502 | ALIGN JUMP_ALIGN
|
---|
| 503 | IdeControllerMenu_WriteDevice:
|
---|
| 504 | push ax
|
---|
| 505 | push bx
|
---|
| 506 | push di
|
---|
| 507 |
|
---|
| 508 | mov bl,[es:di] ; what is the current Device?
|
---|
[242] | 509 |
|
---|
[199] | 510 | add di,IDEVARS.wPort - IDEVARS.bDevice ; Get ready to set the Port addresses
|
---|
[242] | 511 |
|
---|
[199] | 512 | cmp al,DEVICE_SERIAL_PORT
|
---|
| 513 | jz .changingToSerial
|
---|
| 514 |
|
---|
| 515 | cmp bl,DEVICE_SERIAL_PORT
|
---|
| 516 | jnz .done ; if we weren't Serial before, nothing to do
|
---|
| 517 |
|
---|
| 518 | .changingFromSerial:
|
---|
| 519 | cmp al,DEVICE_16BIT_ATA
|
---|
| 520 |
|
---|
[242] | 521 | mov ax,DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE devices
|
---|
| 522 | mov bx,DEVICE_XTIDE_DEFAULT_PORTCTRL
|
---|
| 523 |
|
---|
| 524 | jb .writeNonSerial
|
---|
| 525 |
|
---|
[399] | 526 | mov ax, DEVICE_ATA_PRIMARY_PORT ; Defaults for 16-bit and better ATA devices
|
---|
| 527 | mov bx, DEVICE_ATA_PRIMARY_PORTCTRL
|
---|
[199] | 528 |
|
---|
[242] | 529 | .writeNonSerial:
|
---|
| 530 | stosw ; Store defaults in IDEVARS.wPort and IDEVARS.wPortCtrl
|
---|
| 531 | xchg bx, ax
|
---|
| 532 | stosw
|
---|
[199] | 533 |
|
---|
| 534 | jmp .done
|
---|
| 535 |
|
---|
[242] | 536 | .changingToSerial:
|
---|
[199] | 537 | cmp bl,DEVICE_SERIAL_PORT
|
---|
| 538 | jz .done ; if we were already serial, nothing to do
|
---|
| 539 |
|
---|
[280] | 540 | mov byte [es:di+IDEVARS.bSerialBaud-IDEVARS.wPort],SERIAL_DEFAULT_BAUD
|
---|
[233] | 541 |
|
---|
[280] | 542 | mov al,SERIAL_DEFAULT_COM
|
---|
[233] | 543 | add di,IDEVARS.bSerialCOMPortChar-IDEVARS.wPort
|
---|
[199] | 544 | call IdeControllerMenu_SerialWriteCOM
|
---|
[242] | 545 | stosb
|
---|
| 546 |
|
---|
| 547 | .done:
|
---|
[199] | 548 | pop di
|
---|
| 549 | pop bx
|
---|
| 550 | pop ax
|
---|
| 551 |
|
---|
| 552 | ret
|
---|
| 553 |
|
---|
| 554 | ;
|
---|
[233] | 555 | ; Doesn't modify COM character (unless it is not recognized, which would be an error case),
|
---|
[242] | 556 | ; But does update the port address based on COM port selection
|
---|
| 557 | ;
|
---|
[199] | 558 | ALIGN JUMP_ALIGN
|
---|
| 559 | IdeControllerMenu_SerialWriteCOM:
|
---|
[233] | 560 | push ax
|
---|
[199] | 561 | push bx
|
---|
[233] | 562 | push si
|
---|
[242] | 563 |
|
---|
[233] | 564 | mov si,g_rgbChoiceToValueLookupForCOM
|
---|
| 565 | mov bx,PackedCOMPortAddresses
|
---|
[199] | 566 |
|
---|
[233] | 567 | .loop:
|
---|
| 568 | mov ah,[bx]
|
---|
[199] | 569 |
|
---|
[280] | 570 | cmp ah,(SERIAL_DEFAULT_CUSTOM_PORT >> 2)
|
---|
[233] | 571 | jz .notFound
|
---|
[242] | 572 |
|
---|
[233] | 573 | cmp al,[si]
|
---|
| 574 | jz .found
|
---|
[242] | 575 |
|
---|
[233] | 576 | inc si
|
---|
| 577 | inc si
|
---|
| 578 | inc bx
|
---|
[242] | 579 |
|
---|
[233] | 580 | jmp .loop
|
---|
[199] | 581 |
|
---|
[233] | 582 | .notFound:
|
---|
| 583 | mov al, 'x'
|
---|
[242] | 584 |
|
---|
| 585 | .found:
|
---|
[233] | 586 | mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
|
---|
[199] | 587 |
|
---|
[233] | 588 | pop si
|
---|
[199] | 589 | pop bx
|
---|
[233] | 590 | pop ax
|
---|
[242] | 591 |
|
---|
[199] | 592 | ret
|
---|
| 593 |
|
---|
[242] | 594 |
|
---|
[199] | 595 | ;
|
---|
[233] | 596 | ; Packed Port (byte) -> Numeric Port (word)
|
---|
[242] | 597 | ;
|
---|
[199] | 598 | ALIGN JUMP_ALIGN
|
---|
[233] | 599 | IdeControllerMenu_SerialReadPort:
|
---|
| 600 | xor ah,ah
|
---|
[242] | 601 | eSHL_IM ax, 2
|
---|
[199] | 602 | ret
|
---|
| 603 |
|
---|
| 604 | ;
|
---|
[233] | 605 | ; Numeric Port (word) -> Packed Port (byte)
|
---|
| 606 | ; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
|
---|
[199] | 607 | ;
|
---|
| 608 | ALIGN JUMP_ALIGN
|
---|
[242] | 609 | IdeControllerMenu_SerialWritePort:
|
---|
[199] | 610 | push bx
|
---|
[233] | 611 | push si
|
---|
[199] | 612 |
|
---|
[242] | 613 | eSHR_IM ax, 2
|
---|
[233] | 614 | and al,0feh ; force 8-byte boundary
|
---|
[199] | 615 |
|
---|
[242] | 616 | mov si,g_rgbChoiceToValueLookupForCOM
|
---|
[233] | 617 | mov bx,PackedCOMPortAddresses ; loop, looking for port address in known COM address list
|
---|
| 618 |
|
---|
| 619 | .loop:
|
---|
| 620 | mov ah,[si]
|
---|
| 621 | cmp ah,'x'
|
---|
| 622 | jz .found
|
---|
[242] | 623 |
|
---|
[233] | 624 | cmp al,[bx]
|
---|
| 625 | jz .found
|
---|
[242] | 626 |
|
---|
[233] | 627 | inc si
|
---|
| 628 | inc si
|
---|
[199] | 629 | inc bx
|
---|
[242] | 630 |
|
---|
[233] | 631 | jmp .loop
|
---|
[199] | 632 |
|
---|
[242] | 633 | .found:
|
---|
[233] | 634 | mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
|
---|
| 635 |
|
---|
| 636 | pop si
|
---|
[199] | 637 | pop bx
|
---|
| 638 |
|
---|
[233] | 639 | ret
|
---|
[199] | 640 |
|
---|