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

Last change on this file since 536 was 536, checked in by krille_n_@…, 11 years ago

Changes:

  • Added support for the Silicon Valley Computer ADP50L controller (and possibly other IDE controllers from SVC using memory mapped I/O). Please note that this has not been tested in any way since I don't have any of these cards myself (make backups before trying this on drives with important data). Also, *if* it works, make sure it works reliably (stress test the disk system). Some things you should know: 1) Autodetection for this controller has not been added to XTIDECFG, you need to manually select the "SVC ADP50L" controller (and possibly change the BIOS segment address if not using the default of C800h). 2) The memory mapped I/O window is inside the ROM address space of the controller. The XTIDE Universal BIOS currently do not support this so that means you need to use another ROM (for example, an XTIDE or XTCF card or the BOOT ROM of a NIC). This presents another problem, the original ADP50L BIOS needs to be disabled somehow to avoid conflicts. Either pull the ROM chip or disable the BIOS by removing jumper J3. Note, I have no idea if any of this will actually work. It's basically a shot in the dark.
File size: 25.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
[483]28    at  MENUPAGE.wMenuitems,        dw  12
[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
[483]189g_MenuitemIdeControllerXTCFwindow:
190istruc MENUITEM
191    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateHexInputForMenuitemInDSSI
192    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
193    at  MENUITEM.szName,            dw  g_szItemIdeXTCFwindow
194    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeXTCFwindow
195    at  MENUITEM.szHelp,            dw  g_szNfoIdeXTCFwindow
196    at  MENUITEM.bFlags,            db  FLG_MENUITEM_BYTEVALUE
197    at  MENUITEM.bType,             db  TYPE_MENUITEM_HEX
198    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
199    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeXTCFwindow
200    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  0A000h
201    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  0E800h
202    at  MENUITEM.itemValue + ITEM_VALUE.fnValueReader,              dw  ReaderForXTCFwindow
203    at  MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,              dw  WriterForXTCFwindow
204iend
205
[153]206g_rgwChoiceToValueLookupForDevice:
207    dw  DEVICE_16BIT_ATA
208    dw  DEVICE_32BIT_ATA
[481]209    dw  DEVICE_8BIT_ATA
210    dw  DEVICE_8BIT_XTIDE_REV1
211    dw  DEVICE_8BIT_XTIDE_REV2
212    dw  DEVICE_8BIT_XTCF_PIO8
213    dw  DEVICE_8BIT_XTCF_DMA
214    dw  DEVICE_8BIT_XTCF_MEMMAP
215    dw  DEVICE_8BIT_JRIDE_ISA
[536]216    dw  DEVICE_8BIT_ADP50L
[153]217    dw  DEVICE_SERIAL_PORT
218g_rgszValueToStringLookupForDevice:
219    dw  g_szValueCfgDevice16b
220    dw  g_szValueCfgDevice32b
[481]221    dw  g_szValueCfgDevice8b
222    dw  g_szValueCfgDeviceRev1
223    dw  g_szValueCfgDeviceRev2
224    dw  g_szValueCfgDevicePioXTCF
225    dw  g_szValueCfgDeviceDmaXTCF
226    dw  g_szValueCfgDeviceMemXTCF
227    dw  g_szValueCfgDeviceJrIdeIsa
[536]228    dw  g_szValueCfgDeviceADP50L
[153]229    dw  g_szValueCfgDeviceSerial
[57]230
[233]231g_rgbChoiceToValueLookupForCOM:
232    dw  '1'
233    dw  '2'
234    dw  '3'
235    dw  '4'
236    dw  '5'
237    dw  '6'
238    dw  '7'
239    dw  '8'
240    dw  '9'
241    dw  'A'
242    dw  'B'
243    dw  'C'
244    dw  'x'             ; must be last entry (see reader/write routines)
[242]245g_rgszChoiceToStringLookupForCOM:
[199]246    dw  g_szValueCfgCOM1
247    dw  g_szValueCfgCOM2
248    dw  g_szValueCfgCOM3
249    dw  g_szValueCfgCOM4
250    dw  g_szValueCfgCOM5
251    dw  g_szValueCfgCOM6
252    dw  g_szValueCfgCOM7
253    dw  g_szValueCfgCOM8
254    dw  g_szValueCfgCOM9
255    dw  g_szValueCfgCOMA
256    dw  g_szValueCfgCOMB
257    dw  g_szValueCfgCOMC
258    dw  g_szValueCfgCOMx
[233]259    dw  NULL
[57]260
[280]261SERIAL_DEFAULT_CUSTOM_PORT   EQU        300h           ; can't be any of the pre-defined COM values
[199]262
[233]263PackedCOMPortAddresses:             ; COM1 - COMC (or COM12)
[280]264    db      SERIAL_COM1_IOADDRESS >> 2
265    db      SERIAL_COM2_IOADDRESS >> 2
266    db      SERIAL_COM3_IOADDRESS >> 2
267    db      SERIAL_COM4_IOADDRESS >> 2
268    db      SERIAL_COM5_IOADDRESS >> 2
269    db      SERIAL_COM6_IOADDRESS >> 2
270    db      SERIAL_COM7_IOADDRESS >> 2
271    db      SERIAL_COM8_IOADDRESS >> 2
272    db      SERIAL_COM9_IOADDRESS >> 2
273    db      SERIAL_COMA_IOADDRESS >> 2
274    db      SERIAL_COMB_IOADDRESS >> 2
275    db      SERIAL_COMC_IOADDRESS >> 2
276    db      SERIAL_DEFAULT_CUSTOM_PORT >> 2         ; must be last entry (see reader/writer routines)
277SERIAL_DEFAULT_COM          EQU     '1'
[242]278
[233]279g_rgbChoiceToValueLookupForBaud:
280    dw      (115200 / 115200) & 0xff
281    dw      (115200 /  57600) & 0xff
282    dw      (115200 /  38400) & 0xff
283    dw      (115200 /  28800) & 0xff
284    dw      (115200 /  19200) & 0xff
285    dw      (115200 /   9600) & 0xff
286    dw      (115200 /   4800) & 0xff
287    dw      (115200 /   2400) & 0xff
288g_rgszChoiceToStringLookupForBaud:
289    dw      g_szValueCfgBaud115_2
290    dw      g_szValueCfgBaud57_6
291    dw      g_szValueCfgBaud38_4
292    dw      g_szValueCfgBaud28_8
293    dw      g_szValueCfgBaud19_2
294    dw      g_szValueCfgBaud9600
295    dw      g_szValueCfgBaud4800
296    dw      g_szValueCfgBaud2400
297    dw      NULL
[280]298SERIAL_DEFAULT_BAUD         EQU     ((115200 / 9600)    & 0xff)
[199]299
[57]300; Section containing code
301SECTION .text
302
303;--------------------------------------------------------------------
304; IdeControllerMenu_InitializeToIdevarsOffsetInBX
305;   Parameters:
306;       SS:BP:  Menu handle
307;   Returns:
308;       Nothing
309;   Corrupts registers:
310;       AX
311;--------------------------------------------------------------------
312ALIGN JUMP_ALIGN
313IdeControllerMenu_InitializeToIdevarsOffsetInBX:
314    lea     ax, [bx+IDEVARS.drvParamsMaster]
315    mov     [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
316
317    lea     ax, [bx+IDEVARS.drvParamsSlave]
318    mov     [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
319
[153]320    lea     ax, [bx+IDEVARS.bDevice]
321    mov     [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[57]322
[481]323    lea     ax, [bx+IDEVARS.wBasePort]
[57]324    mov     [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]325
326    lea     ax, [bx+IDEVARS.bSerialPort]
[199]327    mov     [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[233]328
329    lea     ax, [bx+IDEVARS.bSerialBaud]
[199]330    mov     [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]331
[481]332    lea     ax, [bx+IDEVARS.wControlBlockPort]
[57]333    mov     [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]334
[483]335    lea     ax, [bx+IDEVARS.bXTCFcontrolRegister]
336    mov     [cs:g_MenuitemIdeControllerXTCFwindow+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
337
[233]338    lea     ax, [bx+IDEVARS.bSerialCOMPortChar]
[242]339    mov     [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[57]340
341    lea     ax, [bx+IDEVARS.bIRQ]
342    mov     [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
343    mov     [cs:g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[199]344
[57]345    ret
346
347
348;--------------------------------------------------------------------
349; IdeControllerMenu_EnterMenuOrModifyItemVisibility
350;   Parameters:
351;       SS:BP:  Menu handle
352;   Returns:
353;       Nothing
354;   Corrupts registers:
355;       All, except BP
356;--------------------------------------------------------------------
357ALIGN JUMP_ALIGN
358IdeControllerMenu_EnterMenuOrModifyItemVisibility:
359    push    cs
360    pop     ds
[483]361    call    .EnableOrDisableControlBlockPort
[459]362    call    .DisableIRQchannelSelection
363    call    .EnableOrDisableEnableInterrupt
[483]364    call    .EnableOrDisableXTCFwindow
[199]365    call    .EnableOrDisableSerial
[57]366    mov     si, g_MenupageForIdeControllerMenu
367    jmp     Menupage_ChangeToNewMenupageInDSSI
368
[459]369
[57]370;--------------------------------------------------------------------
[483]371; .EnableOrDisableControlBlockPort
372;   Parameters:
373;       SS:BP:  Menu handle
374;   Returns:
375;       Nothing
376;   Corrupts registers:
377;       AX, BX
378;--------------------------------------------------------------------
379ALIGN JUMP_ALIGN
380.EnableOrDisableControlBlockPort:
381    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
382    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
383    mov     bx, g_MenuitemIdeControllerControlBlockAddress
384    cmp     al, DEVICE_8BIT_XTCF_PIO8
[536]385    jb      SHORT .EnableMenuitemFromCSBX   ; Not needed for XT-CF, JR-IDE/ISA and ADP50L
[483]386    jmp     SHORT .DisableMenuitemFromCSBX
387
388
389;--------------------------------------------------------------------
[459]390; .EnableOrDisableEnableInterrupt
[57]391;   Parameters:
392;       SS:BP:  Menu handle
393;   Returns:
394;       Nothing
395;   Corrupts registers:
396;       AX, BX
397;--------------------------------------------------------------------
398ALIGN JUMP_ALIGN
[459]399.EnableOrDisableEnableInterrupt:
400    call    Buffers_GetRomvarsFlagsToAX
401    mov     bx, g_MenuitemIdeControllerEnableInterrupt
402    test    ax, FLG_ROMVARS_MODULE_IRQ
403    jz      SHORT .DisableMenuitemFromCSBX
404
405    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
406    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
407    mov     bx, g_MenuitemIdeControllerEnableInterrupt
[481]408    cmp     al, DEVICE_8BIT_XTIDE_REV2
[459]409    jae     SHORT .DisableMenuitemFromCSBX
410
411    call    .EnableMenuitemFromCSBX
412    ; Fall to .EnableOrDisableIRQchannelSelection
413
414;--------------------------------------------------------------------
415; .EnableOrDisableIRQchannelSelection
416;   Parameters:
417;       SS:BP:  Menu handle
418;   Returns:
419;       Nothing
420;   Corrupts registers:
421;       AX, BX
422;--------------------------------------------------------------------
423ALIGN JUMP_ALIGN
424.EnableOrDisableIRQchannelSelection:
[57]425    mov     bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
426    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
427    mov     bx, g_MenuitemIdeControllerIdeIRQ
[109]428    test    al, al
[459]429    jnz     SHORT .EnableMenuitemFromCSBX
430.DisableIRQchannelSelection:
431    mov     bx, g_MenuitemIdeControllerIdeIRQ
[483]432    jmp     SHORT .DisableMenuitemFromCSBX
433
434
435;--------------------------------------------------------------------
436; .EnableOrDisableXTCFwindow
437;   Parameters:
438;       SS:BP:  Menu handle
439;   Returns:
440;       Nothing
441;   Corrupts registers:
442;       AX, BX
443;--------------------------------------------------------------------
444ALIGN JUMP_ALIGN
445.EnableOrDisableXTCFwindow:
446    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
447    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
448    mov     bx, g_MenuitemIdeControllerXTCFwindow
449    cmp     al, DEVICE_8BIT_XTCF_MEMMAP
450    je      SHORT .EnableMenuitemFromCSBX
[459]451    ; Fall to .DisableMenuitemFromCSBX
[57]452
[459]453
[57]454;--------------------------------------------------------------------
[459]455; .DisableMenuitemFromCSBX
[57]456; .EnableMenuitemFromCSBX
457;   Parameters:
458;       CS:BX:  Ptr to MENUITEM
459;   Returns:
460;       Nothing
461;   Corrupts registers:
462;       Nothing
463;--------------------------------------------------------------------
464ALIGN JUMP_ALIGN
[459]465.DisableMenuitemFromCSBX:
466    and     BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
[57]467    ret
468
469ALIGN JUMP_ALIGN
[459]470.EnableMenuitemFromCSBX:
471    or      BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
[57]472    ret
473
[459]474
[199]475.EnableOrDisableSerial:
476    mov     bx, g_MenuitemIdeControllerSerialBaud
477    call    .DisableMenuitemFromCSBX
478
479    mov     bx, g_MenuitemIdeControllerSerialCOM
480    call    .DisableMenuitemFromCSBX
481
482    mov     bx, g_MenuitemIdeControllerSerialPort
483    call    .DisableMenuitemFromCSBX
[242]484
485    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]486    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
[459]487    cmp     al, DEVICE_SERIAL_PORT
[199]488    jnz     .DisableAllSerial
489
490    mov     bx, g_MenuitemIdeControllerSerialCOM
491    call    .EnableMenuitemFromCSBX
492
493    mov     bx, g_MenuitemIdeControllerSerialBaud
494    call    .EnableMenuitemFromCSBX
495
[242]496    mov     bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]497    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
498    mov     bx, g_MenuitemIdeControllerSerialPort
499    cmp     al,'x'
500    jz      .EnableMenuitemFromCSBX
501    jmp     .DisableMenuitemFromCSBX
502.DisableAllSerial:
503    ret
[242]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;
527; block mode is not supported on serial drives, disable/enable the option as appropriate
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
533    cmp     al,DEVICE_SERIAL_PORT
534    jz      .isSerial
535    or      BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
536    jmp     .isDone
[242]537.isSerial:
[233]538    and     BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
539.isDone:
540    pop     bx
[242]541
[57]542    call    MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
543    jmp     MasterSlaveMenu_EnterMenuOrModifyItemVisibility
[199]544
545;------------------------------------------------------------------------------------------
546;
547; Reader/Writer Routines
548;
549; For serial drives, we pack the port number and baud rate into a single byte, and thus
550; we need to take care to properly read/write just the bits we need.  In addition, since
551; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
[242]552; default the values stored in both these words when switching in and out of the Serial
[199]553; device choice.
554;
555; Writers:
556;   Parameters:
557;       AX:     Value that the MENUITEM system was interacting with
558;       ES:DI:  ROMVARS location where the value is to be stored
559;       DS:SI:  MENUITEM pointer
560;   Returns:
561;       AX:     Value to actually write to ROMVARS
562;   Corrupts registers:
563;       AX
564;
565; Readers:
566;   Parameters:
567;       AX:     Value read from the ROMVARS location
568;       ES:DI:  ROMVARS location where the value was just read from
569;       DS:SI:  MENUITEM pointer
570;   Returns:
571;       AX:     Value that the MENUITEM system will interact with and display
572;   Corrupts registers:
573;       AX
574;
[483]575ALIGN JUMP_ALIGN
576WriterForXTCFwindow:
577    mov     al, ah
578    xor     ah, ah
579    ret
[199]580
[483]581ALIGN JUMP_ALIGN
582ReaderForXTCFwindow:
583    mov     ah, al
584    xor     al, al
585    ret
586
587
[199]588;
589; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are
[242]590; changing in/out of a Serial device (since we use these bytes in radically different ways).
[199]591;
592ALIGN JUMP_ALIGN
593IdeControllerMenu_WriteDevice:
594        push    bx
595        push    di
[483]596        push    di
597        push    ax
[199]598
[483]599        ; Note! AL is the choice index, not device code
600        shl     ax, 1                               ; Selection to device code
601        mov     bl, [es:di]                         ; what is the current Device we are changing from?
602        sub     di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort    ; Get ready to set the Port addresses
603        cmp     al, DEVICE_SERIAL_PORT
604        je      SHORT .changingToSerial
605        cmp     al, DEVICE_8BIT_JRIDE_ISA
606        je      SHORT .ChangingToJrIdeIsa
[536]607        cmp     al, DEVICE_8BIT_ADP50L
608        je      SHORT .ChangingToADP50L
[242]609
[483]610        ; Restore ports to default values
611        cmp     al, DEVICE_8BIT_ATA                 ; Standard ATA controllers, including 8-bit mode
[399]612        mov     ax, DEVICE_ATA_PRIMARY_PORT         ; Defaults for 16-bit and better ATA devices
613        mov     bx, DEVICE_ATA_PRIMARY_PORTCTRL
[483]614        jbe     SHORT .writeNonSerial
[199]615
[483]616        mov     ax, DEVICE_XTIDE_DEFAULT_PORT       ; Defaults for 8-bit XTIDE devices
617        mov     bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
618
[242]619.writeNonSerial:
[481]620        stosw                                       ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
[242]621        xchg    bx, ax
622        stosw
[483]623        jmp     SHORT .done
[199]624
[483]625.ChangingToJrIdeIsa:
[536]626        mov     ah, JRIDE_DEFAULT_SEGMENT_ADDRESS >> 8
627        SKIP2B  bx
628
629.ChangingToADP50L:
630        mov     ah, ADP50L_DEFAULT_BIOS_SEGMENT_ADDRESS >> 8
631        xor     al, al
[483]632        xor     bx, bx
633        jmp     SHORT .writeNonSerial
[199]634
[242]635.changingToSerial:
[483]636        cmp     bl, DEVICE_SERIAL_PORT
637        je      SHORT .done                         ; if we were already serial, nothing to do
[199]638
[483]639        mov     BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
[233]640
[483]641        mov     al, SERIAL_DEFAULT_COM
642        sub     di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
[199]643        call    IdeControllerMenu_SerialWriteCOM
[242]644        stosb
645
646.done:
[483]647        ; See if we are changing to XT-CF. If we are, store
648        ; byte for Control Register.
649        pop     ax
650        pop     di          ; IDEVARS.bDevice
651        sub     di, BYTE IDEVARS.bDevice - IDEVARS.bXTCFcontrolRegister ; IDEVARS.bXTCFcontrolRegister
652        cmp     al, DEVICE_8BIT_XTCF_PIO8 >> 1
653        je      SHORT .ChangingToPioModeXTCF
654        cmp     al, DEVICE_8BIT_XTCF_DMA >> 1
655        je      SHORT .ChangingToDmaModeXTCF
656        cmp     al, DEVICE_8BIT_XTCF_MEMMAP >> 1
657        jne     SHORT .NoNeedToChangeXTCFsettings
658
659        ; XT-CF Memory Mapped Mode
660        mov     WORD [es:di], DEFAULT_XTCF_SECTOR_WINDOW_SEGMENT >> 8   ; Store word to clear Control Block Port high byte
661        jmp     SHORT .NoNeedToChangeXTCFsettings
662.ChangingToPioModeXTCF:
663        mov     BYTE [es:di], XTCF_8BIT_PIO_MODE
664        jmp     SHORT .NoNeedToChangeXTCFsettings
665.ChangingToDmaModeXTCF:
666        mov     BYTE [es:di], XTCF_DMA_MODE
667        ; Fall to .NoNeedToChangeXTCFsettings
668
669.NoNeedToChangeXTCFsettings:
[199]670        pop     di
671        pop     bx
672        ret
673
674;
[233]675; Doesn't modify COM character (unless it is not recognized, which would be an error case),
[242]676; But does update the port address based on COM port selection
677;
[199]678ALIGN JUMP_ALIGN
679IdeControllerMenu_SerialWriteCOM:
[233]680        push    ax
[199]681        push    bx
[233]682        push    si
[242]683
[233]684        mov     si,g_rgbChoiceToValueLookupForCOM
685        mov     bx,PackedCOMPortAddresses
[199]686
[233]687.loop:
688        mov     ah,[bx]
[199]689
[280]690        cmp     ah,(SERIAL_DEFAULT_CUSTOM_PORT >> 2)
[233]691        jz      .notFound
[242]692
[233]693        cmp     al,[si]
694        jz      .found
[242]695
[233]696        inc     si
697        inc     si
698        inc     bx
[242]699
[233]700        jmp     .loop
[199]701
[233]702.notFound:
703        mov     al, 'x'
[242]704
705.found:
[233]706        mov     [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
[199]707
[233]708        pop     si
[199]709        pop     bx
[233]710        pop     ax
[242]711
[199]712        ret
713
[242]714
[199]715;
[233]716; Packed Port (byte) -> Numeric Port (word)
[242]717;
[199]718ALIGN JUMP_ALIGN
[233]719IdeControllerMenu_SerialReadPort:
720        xor     ah,ah
[242]721        eSHL_IM ax, 2
[199]722        ret
723
724;
[233]725; Numeric Port (word) -> Packed Port (byte)
726; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
[199]727;
728ALIGN JUMP_ALIGN
[242]729IdeControllerMenu_SerialWritePort:
[199]730        push    bx
[233]731        push    si
[199]732
[242]733        eSHR_IM ax, 2
[233]734        and     al,0feh         ; force 8-byte boundary
[199]735
[242]736        mov     si,g_rgbChoiceToValueLookupForCOM
[233]737        mov     bx,PackedCOMPortAddresses           ; loop, looking for port address in known COM address list
738
739.loop:
740        mov     ah,[si]
741        cmp     ah,'x'
742        jz      .found
[242]743
[233]744        cmp     al,[bx]
745        jz      .found
[242]746
[233]747        inc     si
748        inc     si
[199]749        inc     bx
[242]750
[233]751        jmp     .loop
[199]752
[242]753.found:
[233]754        mov     [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
755
756        pop     si
[199]757        pop     bx
758
[233]759        ret
[199]760
Note: See TracBrowser for help on using the repository browser.