source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm@ 591

Last change on this file since 591 was 589, checked in by Krister Nordvall, 8 years ago

Changes:

  • BIOS: Fixed a purely cosmetic bug from r542 where, in builds containing MODULE_EBIOS, the boot menu would display an incorrect drive size (0.4 kB with MODULE_STRINGS_COMPRESSED or 0.5 kB without) for old drives with no support for LBA.
  • Fixed a bug from r392 where Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent would return the ID in AL instead of AH (if DANGEROUS_DETECTION had been defined).
  • Fixed a bug from r587 in AdvAtaInit.asm that would prevent detection of QDI Vision controllers.
  • Also changed how the QDI Vision IDs are defined (removed the need for shifting) to avoid confusion. This fixed a potential bug from r587 in AdvAtaInit.asm where some IDs were not being shifted.
  • Fixed a bug in PDC20x30.asm from r587 where GetPdcIDtoAX would not return with the IDE base port in DX so DisablePdcProgrammingMode would fail.
  • Made some changes to ModuleDependency.inc and other files so that MODULE_ADVANCED_ATA now requires USE_386. Consequently it is no longer included in the regular AT-builds, only in the 386_8k-build.
  • Moved the UNROLL_SECTORS_IN_CX_TO_xWORDS macros from IDE_8bit.inc to IdeIO.inc which means it's now possible to build a BIOS without MODULE_8BIT_IDE.
  • XTIDECFG: Added a minimum DOS version check (since it needs DOS version 2+) to allow the program to quit gracefully in the unlikely scenario where someone tries to run it under DOS version 1.
  • Made some changes to Drive.asm to improve drive enumeration. The old method using GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE worked well in Windows XP but not in Windows 98 SE (in Windows or in DOS mode). The two problems were; 1) The function call would access the drives which on single floppy drive systems would cause Windows to swap between A: and B: (throwing a blue screen asking the user to insert a disk etc). 2) Only floppy drives and FAT16 drives would be available in the list of drives, no FAT32/optical/network drives.
  • Improved code in IdeControllerMenu.asm so that the default port addresses for all IDE interfaces are now restored when (re-)selecting the (same) type of IDE device.
  • Also made it impossible to select a device type unless the required module is included in the loaded BIOS.
  • The version check done when loading a BIOS now uses the FLASH_SIGNATURE definition from Version.inc. Any changes affecting RomVars now only requires updating that definition. This means that changes to RomVars must be implemented in both the BIOS and XTIDECFG before being committed to the repository.
  • Added a compatibility fix for 3Com 3C503 cards to the ROM checksumming code in Buffers.asm (Buffers_GenerateChecksum).
  • SerDrive: Made some minor changes to file names and paths to improve compatibility with case sensitive environments.
  • BIOSDRVS: Made a minor size optimization which as a side effect also makes it compatible with all DOS versions including DOS version 1.
  • Library: Renamed the WAIT_RETRACE_IF_NECESSARY_THEN macro to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN and made a tail-call-optimized version of it (JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN).
  • A speed optimization to the eRCL_IM macro for 386 and higher. This change breaks emulation in the sense that the macro will fail when given a memory operand as the first parameter.
  • Other minor optimizations and fixes.
File size: 25.6 KB
RevLine 
[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
[526]6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]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
21SECTION .data
22
23ALIGN WORD_ALIGN
24g_MenupageForIdeControllerMenu:
25istruc MENUPAGE
26 at MENUPAGE.fnEnter, dw IdeControllerMenu_EnterMenuOrModifyItemVisibility
[59]27 at MENUPAGE.fnBack, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility
[546]28 at MENUPAGE.wMenuitems, dw 11
[57]29iend
30
31g_MenuitemIdeControllerBackToConfigurationMenu:
32istruc 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
39iend
40
41g_MenuitemIdeControllerMasterDrive:
42istruc 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
49iend
50
51g_MenuitemIdeControllerSlaveDrive:
52istruc 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
59iend
60
[153]61g_MenuitemIdeControllerDevice:
[57]62istruc 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]76iend
77
78g_MenuitemIdeControllerCommandBlockAddress:
79istruc 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
[502]85 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
[57]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
91iend
92
93g_MenuitemIdeControllerControlBlockAddress:
94istruc 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
[483]100 at MENUITEM.bFlags, db NULL
[57]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
106iend
107
[199]108g_MenuitemIdeControllerSerialCOM:
109istruc 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
123iend
124
125g_MenuitemIdeControllerSerialPort:
126istruc 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]140iend
[199]141
[242]142g_MenuitemIdeControllerSerialBaud:
[199]143istruc 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]156iend
[242]157
[57]158g_MenuitemIdeControllerEnableInterrupt:
159istruc 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
172iend
173
174g_MenuitemIdeControllerIdeIRQ:
175istruc 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
187iend
188
[153]189g_rgwChoiceToValueLookupForDevice:
190 dw DEVICE_16BIT_ATA
191 dw DEVICE_32BIT_ATA
[481]192 dw DEVICE_8BIT_ATA
193 dw DEVICE_8BIT_XTIDE_REV1
194 dw DEVICE_8BIT_XTIDE_REV2
195 dw DEVICE_8BIT_XTCF_PIO8
[546]196 dw DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
[585]197 dw DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD
[481]198 dw DEVICE_8BIT_XTCF_DMA
199 dw DEVICE_8BIT_JRIDE_ISA
[536]200 dw DEVICE_8BIT_ADP50L
[153]201 dw DEVICE_SERIAL_PORT
202g_rgszValueToStringLookupForDevice:
203 dw g_szValueCfgDevice16b
204 dw g_szValueCfgDevice32b
[481]205 dw g_szValueCfgDevice8b
206 dw g_szValueCfgDeviceRev1
207 dw g_szValueCfgDeviceRev2
[546]208 dw g_szValueCfgDeviceXTCFPio8
209 dw g_szValueCfgDeviceXTCFPio8WithBIUOffload
[585]210 dw g_szValueCfgDeviceXTCFPio16WithBIUOffload
[546]211 dw g_szValueCfgDeviceXTCFDMA
[481]212 dw g_szValueCfgDeviceJrIdeIsa
[536]213 dw g_szValueCfgDeviceADP50L
[153]214 dw g_szValueCfgDeviceSerial
[57]215
[233]216g_rgbChoiceToValueLookupForCOM:
217 dw '1'
218 dw '2'
219 dw '3'
220 dw '4'
221 dw '5'
222 dw '6'
223 dw '7'
224 dw '8'
225 dw '9'
226 dw 'A'
227 dw 'B'
228 dw 'C'
229 dw 'x' ; must be last entry (see reader/write routines)
[242]230g_rgszChoiceToStringLookupForCOM:
[199]231 dw g_szValueCfgCOM1
232 dw g_szValueCfgCOM2
233 dw g_szValueCfgCOM3
234 dw g_szValueCfgCOM4
235 dw g_szValueCfgCOM5
236 dw g_szValueCfgCOM6
237 dw g_szValueCfgCOM7
238 dw g_szValueCfgCOM8
239 dw g_szValueCfgCOM9
240 dw g_szValueCfgCOMA
241 dw g_szValueCfgCOMB
242 dw g_szValueCfgCOMC
243 dw g_szValueCfgCOMx
[233]244 dw NULL
[57]245
[567]246SERIAL_DEFAULT_CUSTOM_PORT EQU 300h ; can't be any of the pre-defined COM values
247SERIAL_DEFAULT_COM EQU '1'
248SERIAL_DEFAULT_BAUD EQU ((115200 / 9600) & 0xff)
[199]249
[567]250PackedCOMPortAddresses: ; COM1 - COMC (or COM12)
251 db SERIAL_COM1_IOADDRESS >> 2
[280]252 db SERIAL_COM2_IOADDRESS >> 2
253 db SERIAL_COM3_IOADDRESS >> 2
254 db SERIAL_COM4_IOADDRESS >> 2
255 db SERIAL_COM5_IOADDRESS >> 2
256 db SERIAL_COM6_IOADDRESS >> 2
257 db SERIAL_COM7_IOADDRESS >> 2
258 db SERIAL_COM8_IOADDRESS >> 2
259 db SERIAL_COM9_IOADDRESS >> 2
260 db SERIAL_COMA_IOADDRESS >> 2
261 db SERIAL_COMB_IOADDRESS >> 2
262 db SERIAL_COMC_IOADDRESS >> 2
263 db SERIAL_DEFAULT_CUSTOM_PORT >> 2 ; must be last entry (see reader/writer routines)
[242]264
[233]265g_rgbChoiceToValueLookupForBaud:
266 dw (115200 / 115200) & 0xff
267 dw (115200 / 57600) & 0xff
268 dw (115200 / 38400) & 0xff
269 dw (115200 / 28800) & 0xff
270 dw (115200 / 19200) & 0xff
271 dw (115200 / 9600) & 0xff
272 dw (115200 / 4800) & 0xff
273 dw (115200 / 2400) & 0xff
274g_rgszChoiceToStringLookupForBaud:
275 dw g_szValueCfgBaud115_2
276 dw g_szValueCfgBaud57_6
277 dw g_szValueCfgBaud38_4
278 dw g_szValueCfgBaud28_8
279 dw g_szValueCfgBaud19_2
280 dw g_szValueCfgBaud9600
281 dw g_szValueCfgBaud4800
282 dw g_szValueCfgBaud2400
283 dw NULL
[199]284
[57]285; Section containing code
286SECTION .text
287
288;--------------------------------------------------------------------
289; IdeControllerMenu_InitializeToIdevarsOffsetInBX
290; Parameters:
291; SS:BP: Menu handle
292; Returns:
293; Nothing
294; Corrupts registers:
295; AX
296;--------------------------------------------------------------------
297ALIGN JUMP_ALIGN
298IdeControllerMenu_InitializeToIdevarsOffsetInBX:
299 lea ax, [bx+IDEVARS.drvParamsMaster]
300 mov [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
301
302 lea ax, [bx+IDEVARS.drvParamsSlave]
303 mov [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
304
[153]305 lea ax, [bx+IDEVARS.bDevice]
306 mov [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[57]307
[481]308 lea ax, [bx+IDEVARS.wBasePort]
[57]309 mov [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]310
311 lea ax, [bx+IDEVARS.bSerialPort]
[199]312 mov [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[233]313
314 lea ax, [bx+IDEVARS.bSerialBaud]
[199]315 mov [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]316
[481]317 lea ax, [bx+IDEVARS.wControlBlockPort]
[57]318 mov [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]319
[233]320 lea ax, [bx+IDEVARS.bSerialCOMPortChar]
[242]321 mov [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[57]322
323 lea ax, [bx+IDEVARS.bIRQ]
324 mov [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
325 mov [cs:g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[199]326
[57]327 ret
328
329
330;--------------------------------------------------------------------
331; IdeControllerMenu_EnterMenuOrModifyItemVisibility
332; Parameters:
333; SS:BP: Menu handle
334; Returns:
335; Nothing
336; Corrupts registers:
337; All, except BP
338;--------------------------------------------------------------------
339ALIGN JUMP_ALIGN
340IdeControllerMenu_EnterMenuOrModifyItemVisibility:
341 push cs
342 pop ds
[567]343 call .EnableOrDisableCommandBlockPort
[483]344 call .EnableOrDisableControlBlockPort
[459]345 call .DisableIRQchannelSelection
346 call .EnableOrDisableEnableInterrupt
[199]347 call .EnableOrDisableSerial
[57]348 mov si, g_MenupageForIdeControllerMenu
349 jmp Menupage_ChangeToNewMenupageInDSSI
350
[459]351
[57]352;--------------------------------------------------------------------
[567]353; .EnableOrDisableCommandBlockPort
354; Parameters:
355; SS:BP: Menu handle
356; Returns:
357; Nothing
358; Corrupts registers:
359; AX, BX
360;--------------------------------------------------------------------
361ALIGN JUMP_ALIGN
362.EnableOrDisableCommandBlockPort:
363 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
364 call Buffers_GetRomvarsValueToAXfromOffsetInBX
365 mov bx, g_MenuitemIdeControllerCommandBlockAddress
366 cmp al, DEVICE_SERIAL_PORT
367 je SHORT .DisableMenuitemFromCSBX
368 jmp SHORT .EnableMenuitemFromCSBX
369
370
371;--------------------------------------------------------------------
[483]372; .EnableOrDisableControlBlockPort
373; Parameters:
374; SS:BP: Menu handle
375; Returns:
376; Nothing
377; Corrupts registers:
378; AX, BX
379;--------------------------------------------------------------------
380ALIGN JUMP_ALIGN
381.EnableOrDisableControlBlockPort:
382 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
383 call Buffers_GetRomvarsValueToAXfromOffsetInBX
384 mov bx, g_MenuitemIdeControllerControlBlockAddress
385 cmp al, DEVICE_8BIT_XTCF_PIO8
[536]386 jb SHORT .EnableMenuitemFromCSBX ; Not needed for XT-CF, JR-IDE/ISA and ADP50L
[483]387 jmp SHORT .DisableMenuitemFromCSBX
388
389
390;--------------------------------------------------------------------
[459]391; .EnableOrDisableEnableInterrupt
[57]392; Parameters:
393; SS:BP: Menu handle
394; Returns:
395; Nothing
396; Corrupts registers:
397; AX, BX
398;--------------------------------------------------------------------
399ALIGN JUMP_ALIGN
[459]400.EnableOrDisableEnableInterrupt:
401 call Buffers_GetRomvarsFlagsToAX
402 mov bx, g_MenuitemIdeControllerEnableInterrupt
403 test ax, FLG_ROMVARS_MODULE_IRQ
404 jz SHORT .DisableMenuitemFromCSBX
405
406 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
407 call Buffers_GetRomvarsValueToAXfromOffsetInBX
408 mov bx, g_MenuitemIdeControllerEnableInterrupt
[567]409 cmp al, DEVICE_8BIT_XTCF_PIO8
[459]410 jae SHORT .DisableMenuitemFromCSBX
411
[567]412 call EnableMenuitemFromCSBX
[459]413 ; Fall to .EnableOrDisableIRQchannelSelection
414
415;--------------------------------------------------------------------
416; .EnableOrDisableIRQchannelSelection
417; Parameters:
418; SS:BP: Menu handle
419; Returns:
420; Nothing
421; Corrupts registers:
422; AX, BX
423;--------------------------------------------------------------------
424ALIGN JUMP_ALIGN
425.EnableOrDisableIRQchannelSelection:
[57]426 mov bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
427 call Buffers_GetRomvarsValueToAXfromOffsetInBX
428 mov bx, g_MenuitemIdeControllerIdeIRQ
[109]429 test al, al
[459]430 jnz SHORT .EnableMenuitemFromCSBX
431.DisableIRQchannelSelection:
432 mov bx, g_MenuitemIdeControllerIdeIRQ
433 ; Fall to .DisableMenuitemFromCSBX
[57]434
[459]435
[57]436;--------------------------------------------------------------------
[459]437; .DisableMenuitemFromCSBX
[57]438; .EnableMenuitemFromCSBX
439; Parameters:
440; CS:BX: Ptr to MENUITEM
441; Returns:
442; Nothing
443; Corrupts registers:
444; Nothing
445;--------------------------------------------------------------------
446ALIGN JUMP_ALIGN
[459]447.DisableMenuitemFromCSBX:
[567]448 jmp DisableMenuitemFromCSBX
[57]449
450ALIGN JUMP_ALIGN
[459]451.EnableMenuitemFromCSBX:
[567]452 jmp EnableMenuitemFromCSBX
[57]453
[459]454
[199]455.EnableOrDisableSerial:
456 mov bx, g_MenuitemIdeControllerSerialBaud
[567]457 call DisableMenuitemFromCSBX
[199]458
459 mov bx, g_MenuitemIdeControllerSerialCOM
[567]460 call DisableMenuitemFromCSBX
[199]461
462 mov bx, g_MenuitemIdeControllerSerialPort
[567]463 call DisableMenuitemFromCSBX
[242]464
465 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]466 call Buffers_GetRomvarsValueToAXfromOffsetInBX
[459]467 cmp al, DEVICE_SERIAL_PORT
[567]468 jne .DisableAllSerial
[199]469
470 mov bx, g_MenuitemIdeControllerSerialCOM
[567]471 call EnableMenuitemFromCSBX
[199]472
473 mov bx, g_MenuitemIdeControllerSerialBaud
[567]474 call EnableMenuitemFromCSBX
[199]475
[242]476 mov bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]477 call Buffers_GetRomvarsValueToAXfromOffsetInBX
478 mov bx, g_MenuitemIdeControllerSerialPort
[567]479 cmp al, 'x'
480 je SHORT .EnableMenuitemFromCSBX
481 jmp SHORT .DisableMenuitemFromCSBX
[199]482.DisableAllSerial:
483 ret
[242]484
[57]485;--------------------------------------------------------------------
486; MENUITEM activation functions (.fnActivate)
487; Parameters:
488; SS:BP: Ptr to MENU
489; Returns:
490; Nothing
491; Corrupts registers:
492; All, except segments
493;--------------------------------------------------------------------
494ALIGN JUMP_ALIGN
495MasterDrive:
496 mov bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
497 jmp SHORT DisplayMasterSlaveMenu
498
499ALIGN JUMP_ALIGN
500SlaveDrive:
501 mov bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
502 ; Fall to DisplayMasterSlaveMenu
503
504ALIGN JUMP_ALIGN
505DisplayMasterSlaveMenu:
[233]506;
[567]507; "Block Mode Transfers" and "Internal Write Cache" are not supported on serial drives, disable/enable the options as appropriate
[233]508;
509 push bx
[242]510 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[233]511 call Buffers_GetRomvarsValueToAXfromOffsetInBX
512 mov bx, g_MenuitemMasterSlaveBlockModeTransfers
[567]513
514 cmp al, DEVICE_SERIAL_PORT
515 je .isSerial
516
517 call EnableMenuitemFromCSBX
518 mov bx, g_MenuitemMasterSlaveWriteCache
519 call EnableMenuitemFromCSBX
[233]520 jmp .isDone
[567]521
[242]522.isSerial:
[567]523 call DisableMenuitemFromCSBX
524 mov bx, g_MenuitemMasterSlaveWriteCache
525 call DisableMenuitemFromCSBX
526
[233]527.isDone:
528 pop bx
[242]529
[57]530 call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
531 jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility
[199]532
533;------------------------------------------------------------------------------------------
534;
535; Reader/Writer Routines
536;
537; For serial drives, we pack the port number and baud rate into a single byte, and thus
538; we need to take care to properly read/write just the bits we need. In addition, since
539; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
[242]540; default the values stored in both these words when switching in and out of the Serial
[199]541; device choice.
542;
543; Writers:
544; Parameters:
[567]545; AX: Value that the MENUITEM system was interacting with
546; ES:DI: ROMVARS location where the value is to be stored
547; DS:SI: MENUITEM pointer
[199]548; Returns:
549; AX: Value to actually write to ROMVARS
550; Corrupts registers:
551; AX
552;
553; Readers:
554; Parameters:
[567]555; AX: Value read from the ROMVARS location
556; ES:DI: ROMVARS location where the value was just read from
557; DS:SI: MENUITEM pointer
[199]558; Returns:
559; AX: Value that the MENUITEM system will interact with and display
560; Corrupts registers:
561; AX
562;
[483]563ALIGN JUMP_ALIGN
564WriterForXTCFwindow:
[567]565 xor al, al
566 SKIP2B f
567ReaderForXTCFwindow:
[483]568 xor ah, ah
[567]569 xchg al, ah
[483]570 ret
[199]571
[483]572
[199]573ALIGN JUMP_ALIGN
574IdeControllerMenu_WriteDevice:
[567]575 push bx
576 push di
577 push ax
[199]578
[589]579 mov bl, [es:di] ; What is the current Device we are changing from?
580 sub di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort ; Get ready to set the Port addresses
581
[567]582 ; Note! AL is the choice index, not device code
[589]583 shl al, 1 ; Selection to device code
584
585 ; Restore ports and other stuff to default values
586 jz SHORT .StandardIdeDevice ; DEVICE_16BIT_ATA
587
588 cmp al, DEVICE_8BIT_ATA
589 ja SHORT .NotStandardIdeDevice
590 jb SHORT .AdvancedAtaDevice ; DEVICE_32BIT_ATA
591 test BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE
592 jmp SHORT .CheckZF
593
594.AdvancedAtaDevice:
595 test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_ADVANCED_ATA >> 8
596.CheckZF:
597 jz SHORT .SupportForDeviceNotAvailable
598
599 ; Standard ATA controllers, including 8-bit mode
600.StandardIdeDevice:
601 lea ax, [di-ROMVARS.ideVars0+IDEVARS.wBasePort]
602 mov bl, IDEVARS_size
603 div bl
604 mov bx, .rgbLowByteOfStdIdeInterfacePorts
605 xlat
606 mov ah, 1 ; DEVICE_ATA_*_PORT >> 8
607 mov bh, 3 ; DEVICE_ATA_*_PORTCTRL >> 8
608 mov bl, al
609 jmp SHORT .WriteNonSerial
610
611.rgbLowByteOfStdIdeInterfacePorts: ; Defaults for 16-bit and better ATA devices
612 db DEVICE_ATA_PRIMARY_PORT & 0FFh
613 db DEVICE_ATA_SECONDARY_PORT & 0FFh
614 db DEVICE_ATA_TERTIARY_PORT & 0FFh
615 db DEVICE_ATA_QUATERNARY_PORT & 0FFh
616
617.NotStandardIdeDevice:
[567]618 cmp al, DEVICE_SERIAL_PORT
[589]619 jb SHORT .NotSerialDevice
620 test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_SERIAL >> 8
621 jnz SHORT .ChangingToSerial
622
623.SupportForDeviceNotAvailable:
624 push dx
625 mov dx, g_szUnsupportedDevice
626 call Dialogs_DisplayErrorFromCSDX
627 pop dx
628
629 ; Restore device type to the previous value
630 pop ax ; Get choice index from stack
631 mov al, bl ; Previous device type to AL
632 shr al, 1 ; Device code to choice index
633 jmp SHORT .DoneWithNoChangeOfDevice
634
635.NotSerialDevice:
636 ; Remaining device types all require MODULE_8BIT_IDE or MODULE_8BIT_IDE_ADVANCED
637 test BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE | FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED
638 jz SHORT .SupportForDeviceNotAvailable
639
640 ; We know MODULE_8BIT_IDE is included
641 lahf ; Save the PF
642 cmp al, DEVICE_8BIT_XTIDE_REV2
643 jbe SHORT .ChangingToXTIDEorXTCF
644 sahf ; Restore the PF
645 jpo SHORT .SupportForDeviceNotAvailable ; Jump if no MODULE_8BIT_IDE_ADVANCED
[567]646 cmp al, DEVICE_8BIT_JRIDE_ISA
647 je SHORT .ChangingToJrIdeIsa
648 cmp al, DEVICE_8BIT_ADP50L
649 je SHORT .ChangingToADP50L
[242]650
[589]651.ChangingToXTIDEorXTCF:
[567]652 mov ax, DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE and XT-CF devices
653 mov bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
[483]654
[567]655.WriteNonSerial:
656 stosw ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
657 xchg bx, ax
658 stosw
659 jmp SHORT .Done
[199]660
[483]661.ChangingToJrIdeIsa:
[567]662 mov ah, JRIDE_DEFAULT_SEGMENT_ADDRESS >> 8
663 SKIP2B bx
[536]664
665.ChangingToADP50L:
[567]666 mov ah, ADP50L_DEFAULT_BIOS_SEGMENT_ADDRESS >> 8
667 xor al, al
668 xor bx, bx
669 jmp SHORT .WriteNonSerial
[199]670
[567]671.ChangingToSerial:
672 cmp bl, DEVICE_SERIAL_PORT
673 je SHORT .Done ; if we were already serial, nothing to do
[199]674
[567]675 mov BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
[588]676 mov BYTE [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], 0 ; Clear .bIRQ to keep the boot menu from printing it
[233]677
[567]678 mov al, SERIAL_DEFAULT_COM
679 sub di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
680 call IdeControllerMenu_SerialWriteCOM
681 stosb
[242]682
[567]683.Done:
684 pop ax
[589]685.DoneWithNoChangeOfDevice:
[567]686 pop di ; IDEVARS.bDevice
687 pop bx
688 ret
[199]689
690;
[233]691; Doesn't modify COM character (unless it is not recognized, which would be an error case),
[242]692; But does update the port address based on COM port selection
693;
[199]694ALIGN JUMP_ALIGN
695IdeControllerMenu_SerialWriteCOM:
[567]696 push ax
697 push bx
698 push si
[242]699
[567]700 mov si, g_rgbChoiceToValueLookupForCOM
701 mov bx, PackedCOMPortAddresses
[199]702
[233]703.loop:
[567]704 mov ah, [bx]
[199]705
[567]706 cmp ah, (SERIAL_DEFAULT_CUSTOM_PORT >> 2)
707 je .notFound
[242]708
[567]709 cmp al, [si]
710 je .found
[242]711
[567]712 inc si
713 inc si
714 inc bx
[242]715
[567]716 jmp .loop
[199]717
[233]718.notFound:
[567]719 mov al, 'x'
[242]720
721.found:
[567]722 mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
[199]723
[567]724 pop si
725 pop bx
726 pop ax
[242]727
[567]728 ret
[199]729
[242]730
[199]731;
[233]732; Packed Port (byte) -> Numeric Port (word)
[242]733;
[199]734ALIGN JUMP_ALIGN
[233]735IdeControllerMenu_SerialReadPort:
[567]736 xor ah, ah
737 eSHL_IM ax, 2
738 ret
[199]739
740;
[233]741; Numeric Port (word) -> Packed Port (byte)
742; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
[199]743;
744ALIGN JUMP_ALIGN
[242]745IdeControllerMenu_SerialWritePort:
[567]746 push bx
747 push si
[199]748
[567]749 eSHR_IM ax, 2
750 and al, 0feh ; force 8-byte boundary
[199]751
[567]752 mov si, g_rgbChoiceToValueLookupForCOM
753 mov bx, PackedCOMPortAddresses ; loop, looking for port address in known COM address list
[233]754
755.loop:
[567]756 mov ah, [si]
757 cmp ah, 'x'
758 je .found
[242]759
[567]760 cmp al, [bx]
761 je .found
[242]762
[567]763 inc si
764 inc si
765 inc bx
[242]766
[567]767 jmp .loop
[199]768
[242]769.found:
[567]770 mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
[233]771
[567]772 pop si
773 pop bx
[199]774
[567]775 ret
[199]776
Note: See TracBrowser for help on using the repository browser.