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

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

Changes to Configurator v2:

  • XT-CF port can be selected again.
  • Auto Configure should now detect Sound Blaster 16 Tertiary and Quaternary IDE.
  • Auto Configure now properly sets Slave Drive variables.
File size: 25.5 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
[376]6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
[399]12;
[376]13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
[399]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
[399]18;
[376]19
[57]20; Section containing initialized data
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
[153]216    dw  DEVICE_SERIAL_PORT
217g_rgszValueToStringLookupForDevice:
218    dw  g_szValueCfgDevice16b
219    dw  g_szValueCfgDevice32b
[481]220    dw  g_szValueCfgDevice8b
221    dw  g_szValueCfgDeviceRev1
222    dw  g_szValueCfgDeviceRev2
223    dw  g_szValueCfgDevicePioXTCF
224    dw  g_szValueCfgDeviceDmaXTCF
225    dw  g_szValueCfgDeviceMemXTCF
226    dw  g_szValueCfgDeviceJrIdeIsa
[153]227    dw  g_szValueCfgDeviceSerial
[57]228
[233]229g_rgbChoiceToValueLookupForCOM:
230    dw  '1'
231    dw  '2'
232    dw  '3'
233    dw  '4'
234    dw  '5'
235    dw  '6'
236    dw  '7'
237    dw  '8'
238    dw  '9'
239    dw  'A'
240    dw  'B'
241    dw  'C'
242    dw  'x'             ; must be last entry (see reader/write routines)
[242]243g_rgszChoiceToStringLookupForCOM:
[199]244    dw  g_szValueCfgCOM1
245    dw  g_szValueCfgCOM2
246    dw  g_szValueCfgCOM3
247    dw  g_szValueCfgCOM4
248    dw  g_szValueCfgCOM5
249    dw  g_szValueCfgCOM6
250    dw  g_szValueCfgCOM7
251    dw  g_szValueCfgCOM8
252    dw  g_szValueCfgCOM9
253    dw  g_szValueCfgCOMA
254    dw  g_szValueCfgCOMB
255    dw  g_szValueCfgCOMC
256    dw  g_szValueCfgCOMx
[233]257    dw  NULL
[57]258
[280]259SERIAL_DEFAULT_CUSTOM_PORT   EQU        300h           ; can't be any of the pre-defined COM values
[199]260
[233]261PackedCOMPortAddresses:             ; COM1 - COMC (or COM12)
[280]262    db      SERIAL_COM1_IOADDRESS >> 2
263    db      SERIAL_COM2_IOADDRESS >> 2
264    db      SERIAL_COM3_IOADDRESS >> 2
265    db      SERIAL_COM4_IOADDRESS >> 2
266    db      SERIAL_COM5_IOADDRESS >> 2
267    db      SERIAL_COM6_IOADDRESS >> 2
268    db      SERIAL_COM7_IOADDRESS >> 2
269    db      SERIAL_COM8_IOADDRESS >> 2
270    db      SERIAL_COM9_IOADDRESS >> 2
271    db      SERIAL_COMA_IOADDRESS >> 2
272    db      SERIAL_COMB_IOADDRESS >> 2
273    db      SERIAL_COMC_IOADDRESS >> 2
274    db      SERIAL_DEFAULT_CUSTOM_PORT >> 2         ; must be last entry (see reader/writer routines)
275SERIAL_DEFAULT_COM          EQU     '1'
[242]276
[233]277g_rgbChoiceToValueLookupForBaud:
278    dw      (115200 / 115200) & 0xff
279    dw      (115200 /  57600) & 0xff
280    dw      (115200 /  38400) & 0xff
281    dw      (115200 /  28800) & 0xff
282    dw      (115200 /  19200) & 0xff
283    dw      (115200 /   9600) & 0xff
284    dw      (115200 /   4800) & 0xff
285    dw      (115200 /   2400) & 0xff
286g_rgszChoiceToStringLookupForBaud:
287    dw      g_szValueCfgBaud115_2
288    dw      g_szValueCfgBaud57_6
289    dw      g_szValueCfgBaud38_4
290    dw      g_szValueCfgBaud28_8
291    dw      g_szValueCfgBaud19_2
292    dw      g_szValueCfgBaud9600
293    dw      g_szValueCfgBaud4800
294    dw      g_szValueCfgBaud2400
295    dw      NULL
[280]296SERIAL_DEFAULT_BAUD         EQU     ((115200 / 9600)    & 0xff)
[199]297
[57]298; Section containing code
299SECTION .text
300
301;--------------------------------------------------------------------
302; IdeControllerMenu_InitializeToIdevarsOffsetInBX
303;   Parameters:
304;       SS:BP:  Menu handle
305;   Returns:
306;       Nothing
307;   Corrupts registers:
308;       AX
309;--------------------------------------------------------------------
310ALIGN JUMP_ALIGN
311IdeControllerMenu_InitializeToIdevarsOffsetInBX:
312    lea     ax, [bx+IDEVARS.drvParamsMaster]
313    mov     [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
314
315    lea     ax, [bx+IDEVARS.drvParamsSlave]
316    mov     [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
317
[153]318    lea     ax, [bx+IDEVARS.bDevice]
319    mov     [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[57]320
[481]321    lea     ax, [bx+IDEVARS.wBasePort]
[57]322    mov     [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]323
324    lea     ax, [bx+IDEVARS.bSerialPort]
[199]325    mov     [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[233]326
327    lea     ax, [bx+IDEVARS.bSerialBaud]
[199]328    mov     [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]329
[481]330    lea     ax, [bx+IDEVARS.wControlBlockPort]
[57]331    mov     [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]332
[483]333    lea     ax, [bx+IDEVARS.bXTCFcontrolRegister]
334    mov     [cs:g_MenuitemIdeControllerXTCFwindow+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
335
[233]336    lea     ax, [bx+IDEVARS.bSerialCOMPortChar]
[242]337    mov     [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[57]338
339    lea     ax, [bx+IDEVARS.bIRQ]
340    mov     [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
341    mov     [cs:g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[199]342
[57]343    ret
344
345
346;--------------------------------------------------------------------
347; IdeControllerMenu_EnterMenuOrModifyItemVisibility
348;   Parameters:
349;       SS:BP:  Menu handle
350;   Returns:
351;       Nothing
352;   Corrupts registers:
353;       All, except BP
354;--------------------------------------------------------------------
355ALIGN JUMP_ALIGN
356IdeControllerMenu_EnterMenuOrModifyItemVisibility:
357    push    cs
358    pop     ds
[483]359    call    .EnableOrDisableControlBlockPort
[459]360    call    .DisableIRQchannelSelection
361    call    .EnableOrDisableEnableInterrupt
[483]362    call    .EnableOrDisableXTCFwindow
[199]363    call    .EnableOrDisableSerial
[57]364    mov     si, g_MenupageForIdeControllerMenu
365    jmp     Menupage_ChangeToNewMenupageInDSSI
366
[459]367
[57]368;--------------------------------------------------------------------
[483]369; .EnableOrDisableControlBlockPort
370;   Parameters:
371;       SS:BP:  Menu handle
372;   Returns:
373;       Nothing
374;   Corrupts registers:
375;       AX, BX
376;--------------------------------------------------------------------
377ALIGN JUMP_ALIGN
378.EnableOrDisableControlBlockPort:
379    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
380    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
381    mov     bx, g_MenuitemIdeControllerControlBlockAddress
382    cmp     al, DEVICE_8BIT_XTCF_PIO8
[502]383    jb      SHORT .EnableMenuitemFromCSBX   ; Not needed for XT-CF and JR-IDE/ISA
[483]384    jmp     SHORT .DisableMenuitemFromCSBX
385
386
387;--------------------------------------------------------------------
[459]388; .EnableOrDisableEnableInterrupt
[57]389;   Parameters:
390;       SS:BP:  Menu handle
391;   Returns:
392;       Nothing
393;   Corrupts registers:
394;       AX, BX
395;--------------------------------------------------------------------
396ALIGN JUMP_ALIGN
[459]397.EnableOrDisableEnableInterrupt:
398    call    Buffers_GetRomvarsFlagsToAX
399    mov     bx, g_MenuitemIdeControllerEnableInterrupt
400    test    ax, FLG_ROMVARS_MODULE_IRQ
401    jz      SHORT .DisableMenuitemFromCSBX
402
403    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
404    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
405    mov     bx, g_MenuitemIdeControllerEnableInterrupt
[481]406    cmp     al, DEVICE_8BIT_XTIDE_REV2
[459]407    jae     SHORT .DisableMenuitemFromCSBX
408
409    call    .EnableMenuitemFromCSBX
410    ; Fall to .EnableOrDisableIRQchannelSelection
411
412;--------------------------------------------------------------------
413; .EnableOrDisableIRQchannelSelection
414;   Parameters:
415;       SS:BP:  Menu handle
416;   Returns:
417;       Nothing
418;   Corrupts registers:
419;       AX, BX
420;--------------------------------------------------------------------
421ALIGN JUMP_ALIGN
422.EnableOrDisableIRQchannelSelection:
[57]423    mov     bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
424    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
425    mov     bx, g_MenuitemIdeControllerIdeIRQ
[109]426    test    al, al
[459]427    jnz     SHORT .EnableMenuitemFromCSBX
428.DisableIRQchannelSelection:
429    mov     bx, g_MenuitemIdeControllerIdeIRQ
[483]430    jmp     SHORT .DisableMenuitemFromCSBX
431
432
433;--------------------------------------------------------------------
434; .EnableOrDisableXTCFwindow
435;   Parameters:
436;       SS:BP:  Menu handle
437;   Returns:
438;       Nothing
439;   Corrupts registers:
440;       AX, BX
441;--------------------------------------------------------------------
442ALIGN JUMP_ALIGN
443.EnableOrDisableXTCFwindow:
444    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
445    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
446    mov     bx, g_MenuitemIdeControllerXTCFwindow
447    cmp     al, DEVICE_8BIT_XTCF_MEMMAP
448    je      SHORT .EnableMenuitemFromCSBX
[459]449    ; Fall to .DisableMenuitemFromCSBX
[57]450
[459]451
[57]452;--------------------------------------------------------------------
[459]453; .DisableMenuitemFromCSBX
[57]454; .EnableMenuitemFromCSBX
455;   Parameters:
456;       CS:BX:  Ptr to MENUITEM
457;   Returns:
458;       Nothing
459;   Corrupts registers:
460;       Nothing
461;--------------------------------------------------------------------
462ALIGN JUMP_ALIGN
[459]463.DisableMenuitemFromCSBX:
464    and     BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
[57]465    ret
466
467ALIGN JUMP_ALIGN
[459]468.EnableMenuitemFromCSBX:
469    or      BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
[57]470    ret
471
[459]472
[199]473.EnableOrDisableSerial:
474    mov     bx, g_MenuitemIdeControllerSerialBaud
475    call    .DisableMenuitemFromCSBX
476
477    mov     bx, g_MenuitemIdeControllerSerialCOM
478    call    .DisableMenuitemFromCSBX
479
480    mov     bx, g_MenuitemIdeControllerSerialPort
481    call    .DisableMenuitemFromCSBX
[242]482
483    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]484    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
[459]485    cmp     al, DEVICE_SERIAL_PORT
[199]486    jnz     .DisableAllSerial
487
488    mov     bx, g_MenuitemIdeControllerSerialCOM
489    call    .EnableMenuitemFromCSBX
490
491    mov     bx, g_MenuitemIdeControllerSerialBaud
492    call    .EnableMenuitemFromCSBX
493
[242]494    mov     bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]495    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
496    mov     bx, g_MenuitemIdeControllerSerialPort
497    cmp     al,'x'
498    jz      .EnableMenuitemFromCSBX
499    jmp     .DisableMenuitemFromCSBX
500.DisableAllSerial:
501    ret
[242]502
[57]503;--------------------------------------------------------------------
504; MENUITEM activation functions (.fnActivate)
505;   Parameters:
506;       SS:BP:  Ptr to MENU
507;   Returns:
508;       Nothing
509;   Corrupts registers:
510;       All, except segments
511;--------------------------------------------------------------------
512ALIGN JUMP_ALIGN
513MasterDrive:
514    mov     bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
515    jmp     SHORT DisplayMasterSlaveMenu
516
517ALIGN JUMP_ALIGN
518SlaveDrive:
519    mov     bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
520    ; Fall to DisplayMasterSlaveMenu
521
522ALIGN JUMP_ALIGN
523DisplayMasterSlaveMenu:
[233]524;
525; block mode is not supported on serial drives, disable/enable the option as appropriate
526;
527    push    bx
[242]528    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[233]529    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
530    mov     bx, g_MenuitemMasterSlaveBlockModeTransfers
531    cmp     al,DEVICE_SERIAL_PORT
532    jz      .isSerial
533    or      BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
534    jmp     .isDone
[242]535.isSerial:
[233]536    and     BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
537.isDone:
538    pop     bx
[242]539
[57]540    call    MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
541    jmp     MasterSlaveMenu_EnterMenuOrModifyItemVisibility
[199]542
543;------------------------------------------------------------------------------------------
544;
545; Reader/Writer Routines
546;
547; For serial drives, we pack the port number and baud rate into a single byte, and thus
548; we need to take care to properly read/write just the bits we need.  In addition, since
549; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
[242]550; default the values stored in both these words when switching in and out of the Serial
[199]551; device choice.
552;
553; Writers:
554;   Parameters:
555;       AX:     Value that the MENUITEM system was interacting with
556;       ES:DI:  ROMVARS location where the value is to be stored
557;       DS:SI:  MENUITEM pointer
558;   Returns:
559;       AX:     Value to actually write to ROMVARS
560;   Corrupts registers:
561;       AX
562;
563; Readers:
564;   Parameters:
565;       AX:     Value read from the ROMVARS location
566;       ES:DI:  ROMVARS location where the value was just read from
567;       DS:SI:  MENUITEM pointer
568;   Returns:
569;       AX:     Value that the MENUITEM system will interact with and display
570;   Corrupts registers:
571;       AX
572;
[483]573ALIGN JUMP_ALIGN
574WriterForXTCFwindow:
575    mov     al, ah
576    xor     ah, ah
577    ret
[199]578
[483]579ALIGN JUMP_ALIGN
580ReaderForXTCFwindow:
581    mov     ah, al
582    xor     al, al
583    ret
584
585
[199]586;
587; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are
[242]588; changing in/out of a Serial device (since we use these bytes in radically different ways).
[199]589;
590ALIGN JUMP_ALIGN
591IdeControllerMenu_WriteDevice:
592        push    bx
593        push    di
[483]594        push    di
595        push    ax
[199]596
[483]597        ; Note! AL is the choice index, not device code
598        shl     ax, 1                               ; Selection to device code
599        mov     bl, [es:di]                         ; what is the current Device we are changing from?
600        sub     di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort    ; Get ready to set the Port addresses
601        cmp     al, DEVICE_SERIAL_PORT
602        je      SHORT .changingToSerial
603        cmp     al, DEVICE_8BIT_JRIDE_ISA
604        je      SHORT .ChangingToJrIdeIsa
[242]605
[483]606        ; Restore ports to default values
607        cmp     al, DEVICE_8BIT_ATA                 ; Standard ATA controllers, including 8-bit mode
[399]608        mov     ax, DEVICE_ATA_PRIMARY_PORT         ; Defaults for 16-bit and better ATA devices
609        mov     bx, DEVICE_ATA_PRIMARY_PORTCTRL
[483]610        jbe     SHORT .writeNonSerial
[199]611
[483]612        mov     ax, DEVICE_XTIDE_DEFAULT_PORT       ; Defaults for 8-bit XTIDE devices
613        mov     bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
614
[242]615.writeNonSerial:
[481]616        stosw                                       ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
[242]617        xchg    bx, ax
618        stosw
[483]619        jmp     SHORT .done
[199]620
[483]621.ChangingToJrIdeIsa:
622        mov     ax, JRIDE_DEFAULT_SEGMENT_ADDRESS
623        xor     bx, bx
624        jmp     SHORT .writeNonSerial
[199]625
[242]626.changingToSerial:
[483]627        cmp     bl, DEVICE_SERIAL_PORT
628        je      SHORT .done                         ; if we were already serial, nothing to do
[199]629
[483]630        mov     BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
[233]631
[483]632        mov     al, SERIAL_DEFAULT_COM
633        sub     di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
[199]634        call    IdeControllerMenu_SerialWriteCOM
[242]635        stosb
636
637.done:
[483]638        ; See if we are changing to XT-CF. If we are, store
639        ; byte for Control Register.
640        pop     ax
641        pop     di          ; IDEVARS.bDevice
642        sub     di, BYTE IDEVARS.bDevice - IDEVARS.bXTCFcontrolRegister ; IDEVARS.bXTCFcontrolRegister
643        cmp     al, DEVICE_8BIT_XTCF_PIO8 >> 1
644        je      SHORT .ChangingToPioModeXTCF
645        cmp     al, DEVICE_8BIT_XTCF_DMA >> 1
646        je      SHORT .ChangingToDmaModeXTCF
647        cmp     al, DEVICE_8BIT_XTCF_MEMMAP >> 1
648        jne     SHORT .NoNeedToChangeXTCFsettings
649
650        ; XT-CF Memory Mapped Mode
651        mov     WORD [es:di], DEFAULT_XTCF_SECTOR_WINDOW_SEGMENT >> 8   ; Store word to clear Control Block Port high byte
652        jmp     SHORT .NoNeedToChangeXTCFsettings
653.ChangingToPioModeXTCF:
654        mov     BYTE [es:di], XTCF_8BIT_PIO_MODE
655        jmp     SHORT .NoNeedToChangeXTCFsettings
656.ChangingToDmaModeXTCF:
657        mov     BYTE [es:di], XTCF_DMA_MODE
658        ; Fall to .NoNeedToChangeXTCFsettings
659
660.NoNeedToChangeXTCFsettings:
[199]661        pop     di
662        pop     bx
663        ret
664
665;
[233]666; Doesn't modify COM character (unless it is not recognized, which would be an error case),
[242]667; But does update the port address based on COM port selection
668;
[199]669ALIGN JUMP_ALIGN
670IdeControllerMenu_SerialWriteCOM:
[233]671        push    ax
[199]672        push    bx
[233]673        push    si
[242]674
[233]675        mov     si,g_rgbChoiceToValueLookupForCOM
676        mov     bx,PackedCOMPortAddresses
[199]677
[233]678.loop:
679        mov     ah,[bx]
[199]680
[280]681        cmp     ah,(SERIAL_DEFAULT_CUSTOM_PORT >> 2)
[233]682        jz      .notFound
[242]683
[233]684        cmp     al,[si]
685        jz      .found
[242]686
[233]687        inc     si
688        inc     si
689        inc     bx
[242]690
[233]691        jmp     .loop
[199]692
[233]693.notFound:
694        mov     al, 'x'
[242]695
696.found:
[233]697        mov     [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
[199]698
[233]699        pop     si
[199]700        pop     bx
[233]701        pop     ax
[242]702
[199]703        ret
704
[242]705
[199]706;
[233]707; Packed Port (byte) -> Numeric Port (word)
[242]708;
[199]709ALIGN JUMP_ALIGN
[233]710IdeControllerMenu_SerialReadPort:
711        xor     ah,ah
[242]712        eSHL_IM ax, 2
[199]713        ret
714
715;
[233]716; Numeric Port (word) -> Packed Port (byte)
717; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
[199]718;
719ALIGN JUMP_ALIGN
[242]720IdeControllerMenu_SerialWritePort:
[199]721        push    bx
[233]722        push    si
[199]723
[242]724        eSHR_IM ax, 2
[233]725        and     al,0feh         ; force 8-byte boundary
[199]726
[242]727        mov     si,g_rgbChoiceToValueLookupForCOM
[233]728        mov     bx,PackedCOMPortAddresses           ; loop, looking for port address in known COM address list
729
730.loop:
731        mov     ah,[si]
732        cmp     ah,'x'
733        jz      .found
[242]734
[233]735        cmp     al,[bx]
736        jz      .found
[242]737
[233]738        inc     si
739        inc     si
[199]740        inc     bx
[242]741
[233]742        jmp     .loop
[199]743
[242]744.found:
[233]745        mov     [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
746
747        pop     si
[199]748        pop     bx
749
[233]750        ret
[199]751
Note: See TracBrowser for help on using the repository browser.