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

Last change on this file since 600 was 592, checked in by Krister Nordvall, 6 years ago

Changes:

  • The problem with NASM in the previous revision (r591) has been fixed.
  • The colors used by the boot menu and hotkey bar can now be customized by selecting one of a number of pre-defined color themes. Suggestions for additional themes are more than welcome!
  • Large builds are now 10 KB. Small builds are still 8 KB with the exception of the Tiny build which is now 4 KB. In other words, builds are now as small as possible to make it easier to combine them with other BIOSes.
  • Added code to the library to improve drive error handling. XTIDECFG can now handle "Drive Not Ready" errors.
  • Fixed a couple of potential bugs in AtaID.asm (AtaID_GetMaxPioModeToAXandMinCycleTimeToCX); 1) ATA1.bPioMode was treated as a WORD variable. 2) ATA2.bPIOSupp was assumed to be non-zero which would result in PIO mode 3 being returned if the assumption was wrong.
  • Made the same changes in the equivalent function used by BIOSDRVS (DisplayPioModeInformationUsingAtaInfoFromDSBX in AtaInfo.asm).
  • Fixed a bug from r587 in PDC20x30.asm in PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX.
  • Fixed a bug from r523 in XTIDECFG where Auto Configure would only set the IRQ on one IDE interface on AT-builds.
  • XTIDECFG will now restore the default settings for the "Serial port virtual device" when reselecting it in the list of device types. This makes it behave consistently for all device types.
  • The eAAM macro is now used regardless if USE_UNDOC_INTEL is defined or not because it is apparently supported on all processors including the NEC V20/V30 CPUs.
  • Renamed the EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS define to EXCLUDE_FROM_XUB.
  • Added a define to exclude unused library code from BIOSDRVS (EXCLUDE_FROM_BIOSDRVS). This makes it a lot smaller than in previous revisions.
  • All unnecessary CLD-instructions are now under a new define 'CLD_NEEDED' which is only enabled for the BIOS. It is disabled for XTIDECFG and BIOSDRVS but can be enabled if needed by adding this define to the respective makefile. This change was made because these unnecessary instructions are wasteful and should never be needed. In fact, they only serve to hide bugs (in other peoples code) which I strongly believe should be avoided. I recommend people making their own BIOSes from source to not use this define as it's extremely unlikely to be needed.
  • Updated the copyright info in SerDrive and changed an URL to point to the new site.
  • Updated the copyright info and version number in BIOSDRVS.
  • Updated the copyright info in XTIDECFG.
  • Optimizations in general.
File size: 26.7 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
[592]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
[592]308%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
309%if IDEVARS.wBasePort = 0
310 mov [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], bx
311%else
[481]312 lea ax, [bx+IDEVARS.wBasePort]
[57]313 mov [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[592]314%endif
[242]315
[592]316%if IDEVARS.bSerialPort = 0
317 mov [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], bx
318%else
[242]319 lea ax, [bx+IDEVARS.bSerialPort]
[199]320 mov [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[592]321%endif
322%endif
[233]323
324 lea ax, [bx+IDEVARS.bSerialBaud]
[199]325 mov [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]326
[481]327 lea ax, [bx+IDEVARS.wControlBlockPort]
[57]328 mov [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]329
[233]330 lea ax, [bx+IDEVARS.bSerialCOMPortChar]
[242]331 mov [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[57]332
333 lea ax, [bx+IDEVARS.bIRQ]
334 mov [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
335 mov [cs:g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[199]336
[57]337 ret
338
339
340;--------------------------------------------------------------------
341; IdeControllerMenu_EnterMenuOrModifyItemVisibility
342; Parameters:
343; SS:BP: Menu handle
344; Returns:
345; Nothing
346; Corrupts registers:
347; All, except BP
348;--------------------------------------------------------------------
349ALIGN JUMP_ALIGN
350IdeControllerMenu_EnterMenuOrModifyItemVisibility:
351 push cs
352 pop ds
[567]353 call .EnableOrDisableCommandBlockPort
[483]354 call .EnableOrDisableControlBlockPort
[459]355 call .DisableIRQchannelSelection
356 call .EnableOrDisableEnableInterrupt
[199]357 call .EnableOrDisableSerial
[57]358 mov si, g_MenupageForIdeControllerMenu
359 jmp Menupage_ChangeToNewMenupageInDSSI
360
[459]361
[57]362;--------------------------------------------------------------------
[567]363; .EnableOrDisableCommandBlockPort
364; Parameters:
365; SS:BP: Menu handle
366; Returns:
367; Nothing
368; Corrupts registers:
369; AX, BX
370;--------------------------------------------------------------------
371ALIGN JUMP_ALIGN
372.EnableOrDisableCommandBlockPort:
[592]373 mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[567]374 call Buffers_GetRomvarsValueToAXfromOffsetInBX
375 mov bx, g_MenuitemIdeControllerCommandBlockAddress
376 cmp al, DEVICE_SERIAL_PORT
377 je SHORT .DisableMenuitemFromCSBX
378 jmp SHORT .EnableMenuitemFromCSBX
379
380
381;--------------------------------------------------------------------
[483]382; .EnableOrDisableControlBlockPort
383; Parameters:
384; SS:BP: Menu handle
385; Returns:
386; Nothing
387; Corrupts registers:
388; AX, BX
389;--------------------------------------------------------------------
390ALIGN JUMP_ALIGN
391.EnableOrDisableControlBlockPort:
[592]392 mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[483]393 call Buffers_GetRomvarsValueToAXfromOffsetInBX
394 mov bx, g_MenuitemIdeControllerControlBlockAddress
395 cmp al, DEVICE_8BIT_XTCF_PIO8
[536]396 jb SHORT .EnableMenuitemFromCSBX ; Not needed for XT-CF, JR-IDE/ISA and ADP50L
[483]397 jmp SHORT .DisableMenuitemFromCSBX
398
399
400;--------------------------------------------------------------------
[459]401; .EnableOrDisableEnableInterrupt
[57]402; Parameters:
403; SS:BP: Menu handle
404; Returns:
405; Nothing
406; Corrupts registers:
407; AX, BX
408;--------------------------------------------------------------------
409ALIGN JUMP_ALIGN
[459]410.EnableOrDisableEnableInterrupt:
411 call Buffers_GetRomvarsFlagsToAX
412 mov bx, g_MenuitemIdeControllerEnableInterrupt
413 test ax, FLG_ROMVARS_MODULE_IRQ
414 jz SHORT .DisableMenuitemFromCSBX
415
[592]416 mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[459]417 call Buffers_GetRomvarsValueToAXfromOffsetInBX
418 mov bx, g_MenuitemIdeControllerEnableInterrupt
[567]419 cmp al, DEVICE_8BIT_XTCF_PIO8
[459]420 jae SHORT .DisableMenuitemFromCSBX
421
[567]422 call EnableMenuitemFromCSBX
[459]423 ; Fall to .EnableOrDisableIRQchannelSelection
424
425;--------------------------------------------------------------------
426; .EnableOrDisableIRQchannelSelection
427; Parameters:
428; SS:BP: Menu handle
429; Returns:
430; Nothing
431; Corrupts registers:
432; AX, BX
433;--------------------------------------------------------------------
434ALIGN JUMP_ALIGN
435.EnableOrDisableIRQchannelSelection:
[592]436 mov bx, [g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[57]437 call Buffers_GetRomvarsValueToAXfromOffsetInBX
438 mov bx, g_MenuitemIdeControllerIdeIRQ
[109]439 test al, al
[459]440 jnz SHORT .EnableMenuitemFromCSBX
441.DisableIRQchannelSelection:
442 mov bx, g_MenuitemIdeControllerIdeIRQ
443 ; Fall to .DisableMenuitemFromCSBX
[57]444
[459]445
[57]446;--------------------------------------------------------------------
[459]447; .DisableMenuitemFromCSBX
[57]448; .EnableMenuitemFromCSBX
449; Parameters:
450; CS:BX: Ptr to MENUITEM
451; Returns:
452; Nothing
453; Corrupts registers:
454; Nothing
455;--------------------------------------------------------------------
456ALIGN JUMP_ALIGN
[459]457.DisableMenuitemFromCSBX:
[567]458 jmp DisableMenuitemFromCSBX
[57]459
460ALIGN JUMP_ALIGN
[459]461.EnableMenuitemFromCSBX:
[567]462 jmp EnableMenuitemFromCSBX
[57]463
[459]464
[592]465;--------------------------------------------------------------------
466; .EnableOrDisableSerial
467; Parameters:
468; SS:BP: Menu handle
469; Returns:
470; Nothing
471; Corrupts registers:
472; AX, BX
473;--------------------------------------------------------------------
[199]474.EnableOrDisableSerial:
475 mov bx, g_MenuitemIdeControllerSerialBaud
[567]476 call DisableMenuitemFromCSBX
[199]477
478 mov bx, g_MenuitemIdeControllerSerialCOM
[567]479 call DisableMenuitemFromCSBX
[199]480
481 mov bx, g_MenuitemIdeControllerSerialPort
[567]482 call DisableMenuitemFromCSBX
[242]483
[592]484 mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]485 call Buffers_GetRomvarsValueToAXfromOffsetInBX
[459]486 cmp al, DEVICE_SERIAL_PORT
[592]487 jne SHORT .DisableAllSerial
[199]488
489 mov bx, g_MenuitemIdeControllerSerialCOM
[567]490 call EnableMenuitemFromCSBX
[199]491
492 mov bx, g_MenuitemIdeControllerSerialBaud
[567]493 call EnableMenuitemFromCSBX
[199]494
[592]495 mov bx, [g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]496 call Buffers_GetRomvarsValueToAXfromOffsetInBX
497 mov bx, g_MenuitemIdeControllerSerialPort
[567]498 cmp al, 'x'
499 je SHORT .EnableMenuitemFromCSBX
500 jmp SHORT .DisableMenuitemFromCSBX
[199]501.DisableAllSerial:
502 ret
[242]503
[592]504
[57]505;--------------------------------------------------------------------
506; MENUITEM activation functions (.fnActivate)
507; Parameters:
508; SS:BP: Ptr to MENU
509; Returns:
510; Nothing
511; Corrupts registers:
512; All, except segments
513;--------------------------------------------------------------------
514ALIGN JUMP_ALIGN
515MasterDrive:
516 mov bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
517 jmp SHORT DisplayMasterSlaveMenu
518
519ALIGN JUMP_ALIGN
520SlaveDrive:
521 mov bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
522 ; Fall to DisplayMasterSlaveMenu
523
524ALIGN JUMP_ALIGN
525DisplayMasterSlaveMenu:
[233]526;
[567]527; "Block Mode Transfers" and "Internal Write Cache" are not supported on serial drives, disable/enable the options as appropriate
[233]528;
529 push bx
[242]530 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[233]531 call Buffers_GetRomvarsValueToAXfromOffsetInBX
532 mov bx, g_MenuitemMasterSlaveBlockModeTransfers
[567]533
534 cmp al, DEVICE_SERIAL_PORT
535 je .isSerial
536
537 call EnableMenuitemFromCSBX
538 mov bx, g_MenuitemMasterSlaveWriteCache
539 call EnableMenuitemFromCSBX
[233]540 jmp .isDone
[567]541
[242]542.isSerial:
[567]543 call DisableMenuitemFromCSBX
544 mov bx, g_MenuitemMasterSlaveWriteCache
545 call DisableMenuitemFromCSBX
546
[233]547.isDone:
548 pop bx
[242]549
[57]550 call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
551 jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility
[199]552
[592]553
554;--------------------------------------------------------------------
555; IdeControllerMenu_WriteDevice
[199]556;
[592]557; Sets default values to ports and other device dependent stuff
[199]558;
559; Parameters:
[592]560; AX: IDE controller/Device type menu choice index
561; ES:DI: Ptr to IDEVARS.bDevice
[567]562; DS:SI: MENUITEM pointer
[199]563; Returns:
[592]564; AX: IDE controller/Device type menu choice index
[199]565; Corrupts registers:
[592]566; BX, DX
567;--------------------------------------------------------------------
[483]568ALIGN JUMP_ALIGN
[199]569IdeControllerMenu_WriteDevice:
[567]570 push di
571 push ax
[199]572
[589]573 mov bl, [es:di] ; What is the current Device we are changing from?
574 sub di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort ; Get ready to set the Port addresses
575
[567]576 ; Note! AL is the choice index, not device code
[592]577 eSHL_IM al, 1 ; Selection to device code
[589]578 jz SHORT .StandardIdeDevice ; DEVICE_16BIT_ATA
579
580 cmp al, DEVICE_8BIT_ATA
581 ja SHORT .NotStandardIdeDevice
582 jb SHORT .AdvancedAtaDevice ; DEVICE_32BIT_ATA
583 test BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE
584 jmp SHORT .CheckZF
585
586.AdvancedAtaDevice:
587 test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_ADVANCED_ATA >> 8
588.CheckZF:
589 jz SHORT .SupportForDeviceNotAvailable
590
591 ; Standard ATA controllers, including 8-bit mode
592.StandardIdeDevice:
593 lea ax, [di-ROMVARS.ideVars0+IDEVARS.wBasePort]
594 mov bl, IDEVARS_size
595 div bl
596 mov bx, .rgbLowByteOfStdIdeInterfacePorts
[592]597 xlat ; DS=CS so no segment override needed
[589]598 mov ah, 1 ; DEVICE_ATA_*_PORT >> 8
599 mov bh, 3 ; DEVICE_ATA_*_PORTCTRL >> 8
600 mov bl, al
601 jmp SHORT .WriteNonSerial
602
603.rgbLowByteOfStdIdeInterfacePorts: ; Defaults for 16-bit and better ATA devices
604 db DEVICE_ATA_PRIMARY_PORT & 0FFh
605 db DEVICE_ATA_SECONDARY_PORT & 0FFh
606 db DEVICE_ATA_TERTIARY_PORT & 0FFh
607 db DEVICE_ATA_QUATERNARY_PORT & 0FFh
608
609.NotStandardIdeDevice:
[567]610 cmp al, DEVICE_SERIAL_PORT
[589]611 jb SHORT .NotSerialDevice
612 test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_SERIAL >> 8
613 jnz SHORT .ChangingToSerial
614
615.SupportForDeviceNotAvailable:
616 mov dx, g_szUnsupportedDevice
617 call Dialogs_DisplayErrorFromCSDX
618
619 ; Restore device type to the previous value
620 pop ax ; Get choice index from stack
621 mov al, bl ; Previous device type to AL
622 shr al, 1 ; Device code to choice index
[592]623 pop di
624 ret
[589]625
626.NotSerialDevice:
627 ; Remaining device types all require MODULE_8BIT_IDE or MODULE_8BIT_IDE_ADVANCED
628 test BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE | FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED
629 jz SHORT .SupportForDeviceNotAvailable
630
631 ; We know MODULE_8BIT_IDE is included
632 lahf ; Save the PF
633 cmp al, DEVICE_8BIT_XTIDE_REV2
634 jbe SHORT .ChangingToXTIDEorXTCF
635 sahf ; Restore the PF
636 jpo SHORT .SupportForDeviceNotAvailable ; Jump if no MODULE_8BIT_IDE_ADVANCED
[567]637 cmp al, DEVICE_8BIT_JRIDE_ISA
638 je SHORT .ChangingToJrIdeIsa
639 cmp al, DEVICE_8BIT_ADP50L
640 je SHORT .ChangingToADP50L
[242]641
[589]642.ChangingToXTIDEorXTCF:
[567]643 mov ax, DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE and XT-CF devices
644 mov bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
[483]645
[567]646.WriteNonSerial:
647 stosw ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
648 xchg bx, ax
649 stosw
650 jmp SHORT .Done
[199]651
[483]652.ChangingToJrIdeIsa:
[567]653 mov ah, JRIDE_DEFAULT_SEGMENT_ADDRESS >> 8
654 SKIP2B bx
[536]655
656.ChangingToADP50L:
[567]657 mov ah, ADP50L_DEFAULT_BIOS_SEGMENT_ADDRESS >> 8
658 xor al, al
659 xor bx, bx
660 jmp SHORT .WriteNonSerial
[199]661
[567]662.ChangingToSerial:
[592]663;
664; For serial drives, we pack the port number and baud rate into a single byte, and thus
665; we need to take care to properly read/write just the bits we need. In addition, since
666; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
667; default the values stored in both these words when switching in and out of the Serial
668; device choice.
669;
670 mov al, SERIAL_DEFAULT_COM
[567]671 mov BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
[592]672 mov [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], ah ; Clear .bIRQ to keep the boot menu from printing it
[233]673
[567]674 sub di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
675 call IdeControllerMenu_SerialWriteCOM
676 stosb
[242]677
[567]678.Done:
679 pop ax
[592]680 pop di
[567]681 ret
[199]682
[592]683
684;--------------------------------------------------------------------
685; IdeControllerMenu_SerialWriteCOM
[199]686;
[592]687; Updates the port address based on COM port selection
[242]688;
[592]689; Parameters:
690; AL: COM port
691; ES:DI: Ptr to IDEVARS.bSerialCOMPortChar
692; DS:SI: MENUITEM pointer
693; Returns:
694; Nothing
695; Corrupts registers:
696; BX
697;--------------------------------------------------------------------
[199]698ALIGN JUMP_ALIGN
699IdeControllerMenu_SerialWriteCOM:
[567]700 push ax
701 push si
[242]702
[592]703 mov bx, PackedCOMPortAddresses - 1
704 mov si, g_rgbChoiceToValueLookupForCOM - 2
[199]705
[592]706.Loop:
707 inc bx
[567]708 inc si
709 inc si
[242]710
[592]711 mov ah, [bx]
712 cmp ah, SERIAL_DEFAULT_CUSTOM_PORT >> 2
713 je SHORT .NotFound
[199]714
[592]715 cmp al, [si]
716 jne SHORT .Loop
[242]717
[592]718.NotFound:
[567]719 mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
[199]720
[567]721 pop si
722 pop ax
723 ret
[199]724
[242]725
[592]726;--------------------------------------------------------------------
727; IdeControllerMenu_SerialReadPort
[199]728;
[233]729; Packed Port (byte) -> Numeric Port (word)
[242]730;
[592]731; Parameters:
732; AX: Value read from the ROMVARS location
733; ES:DI: ROMVARS location where the value was just read from
734; DS:SI: MENUITEM pointer
735; Returns:
736; AX: Value that the MENUITEM system will interact with and display
737; Corrupts registers:
738; Nothing
739;--------------------------------------------------------------------
[199]740ALIGN JUMP_ALIGN
[233]741IdeControllerMenu_SerialReadPort:
[567]742 xor ah, ah
743 eSHL_IM ax, 2
744 ret
[199]745
[592]746
747;--------------------------------------------------------------------
748; IdeControllerMenu_SerialWritePort
[199]749;
[233]750; Numeric Port (word) -> Packed Port (byte)
[199]751;
[592]752; And convert from Custom to a defined COM port if we
753; match one of the pre-defined COM port numbers
754;
755; Parameters:
756; AX: Value that the MENUITEM system was interacting with
757; ES:DI: ROMVARS location where the value is to be stored
758; DS:SI: MENUITEM pointer
759; Returns:
760; AX: Value to actually write to ROMVARS
761; Corrupts registers:
762; BX
763;--------------------------------------------------------------------
[199]764ALIGN JUMP_ALIGN
[242]765IdeControllerMenu_SerialWritePort:
[567]766 push si
[199]767
[567]768 eSHR_IM ax, 2
[592]769 and al, 0FEh ; Force 8-byte boundary
[199]770
[592]771 mov si, g_rgbChoiceToValueLookupForCOM - 2
772 mov bx, PackedCOMPortAddresses - 1 ; Loop, looking for port address in known COM address list
[233]773
[592]774.Loop:
775 inc si
776 inc si
777 inc bx
778
[567]779 mov ah, [si]
780 cmp ah, 'x'
[592]781 je SHORT .Found
[242]782
[567]783 cmp al, [bx]
[592]784 jne SHORT .Loop
[242]785
[592]786.Found:
[567]787 mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
[233]788
[567]789 pop si
790 ret
[199]791
Note: See TracBrowser for help on using the repository browser.