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

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

Changes to Configurator v2:

  • Integrated XT-CFv3 support by James Pearce.
File size: 23.2 KB
RevLine 
[57]1; Project name  :   XTIDE Universal BIOS Configurator v2
2; Description   :   "IDE Controller" menu structs and functions.
3
[376]4;
[399]5; XTIDE Universal BIOS and Associated Tools
[526]6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
[399]12;
[376]13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
[399]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
[399]18;
[376]19
[57]20; Section containing initialized data
21SECTION .data
22
23ALIGN WORD_ALIGN
24g_MenupageForIdeControllerMenu:
25istruc MENUPAGE
26    at  MENUPAGE.fnEnter,           dw  IdeControllerMenu_EnterMenuOrModifyItemVisibility
[59]27    at  MENUPAGE.fnBack,            dw  ConfigurationMenu_EnterMenuOrModifyItemVisibility
[546]28    at  MENUPAGE.wMenuitems,        dw  11
[57]29iend
30
31g_MenuitemIdeControllerBackToConfigurationMenu:
32istruc MENUITEM
33    at  MENUITEM.fnActivate,        dw  ConfigurationMenu_EnterMenuOrModifyItemVisibility
34    at  MENUITEM.szName,            dw  g_szItemBackToCfgMenu
35    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeBackToCfgMenu
36    at  MENUITEM.szHelp,            dw  g_szNfoIdeBackToCfgMenu
37    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
38    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGEBACK
39iend
40
41g_MenuitemIdeControllerMasterDrive:
42istruc MENUITEM
43    at  MENUITEM.fnActivate,        dw  MasterDrive
44    at  MENUITEM.szName,            dw  g_szItemIdeMaster
45    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeMaster
46    at  MENUITEM.szHelp,            dw  g_szNfoIdeMaster
47    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
48    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGENEXT
49iend
50
51g_MenuitemIdeControllerSlaveDrive:
52istruc MENUITEM
53    at  MENUITEM.fnActivate,        dw  SlaveDrive
54    at  MENUITEM.szName,            dw  g_szItemIdeSlave
55    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeSlave
56    at  MENUITEM.szHelp,            dw  g_szNfoIdeSlave
57    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
58    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGENEXT
59iend
60
[153]61g_MenuitemIdeControllerDevice:
[57]62istruc MENUITEM
[108]63    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
[233]64    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI
[153]65    at  MENUITEM.szName,            dw  g_szItemIdeDevice
66    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeDevice
67    at  MENUITEM.szHelp,            dw  g_szNfoIdeDevice
[199]68    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_MODIFY_MENU
[108]69    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOICE
[57]70    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
[153]71    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgDevice
72    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoice,              dw  g_szMultichoiceCfgDevice
73    at  MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup,     dw  g_rgwChoiceToValueLookupForDevice
74    at  MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup,    dw  g_rgszValueToStringLookupForDevice
[199]75    at  MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,              dw  IdeControllerMenu_WriteDevice
[57]76iend
77
78g_MenuitemIdeControllerCommandBlockAddress:
79istruc MENUITEM
80    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateHexInputForMenuitemInDSSI
81    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
82    at  MENUITEM.szName,            dw  g_szItemIdeCmdPort
83    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeCmdPort
84    at  MENUITEM.szHelp,            dw  g_szHelpIdeCmdPort
[502]85    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
[57]86    at  MENUITEM.bType,             db  TYPE_MENUITEM_HEX
87    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
88    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeCmdPort
89    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  0
90    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  -1
91iend
92
93g_MenuitemIdeControllerControlBlockAddress:
94istruc MENUITEM
95    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateHexInputForMenuitemInDSSI
96    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
97    at  MENUITEM.szName,            dw  g_szItemIdeCtrlPort
98    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeCtrlPort
99    at  MENUITEM.szHelp,            dw  g_szHelpIdeCtrlPort
[483]100    at  MENUITEM.bFlags,            db  NULL
[57]101    at  MENUITEM.bType,             db  TYPE_MENUITEM_HEX
102    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
103    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeCtrlPort
104    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  0
105    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  -1
106iend
107
[199]108g_MenuitemIdeControllerSerialCOM:
109istruc MENUITEM
110    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
[233]111    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI
[199]112    at  MENUITEM.szName,            dw  g_szItemSerialCOM
113    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeSerialCOM
114    at  MENUITEM.szHelp,            dw  g_szHelpIdeSerialCOM
[233]115    at  MENUITEM.bFlags,            db  FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS
[242]116    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOICE
[199]117    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
118    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgDevice
119    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoice,              dw  g_szSerialCOMChoice
[233]120    at  MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup,     dw  g_rgbChoiceToValueLookupForCOM
121    at  MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup,   dw  g_rgszChoiceToStringLookupForCOM
[199]122    at  MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,              dw  IdeControllerMenu_SerialWriteCOM
123iend
124
125g_MenuitemIdeControllerSerialPort:
126istruc MENUITEM
127    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateHexInputForMenuitemInDSSI
128    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
129    at  MENUITEM.szName,            dw  g_szItemSerialPort
130    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeSerialPort
131    at  MENUITEM.szHelp,            dw  g_szHelpIdeSerialPort
[233]132    at  MENUITEM.bFlags,            db  FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE
[199]133    at  MENUITEM.bType,             db  TYPE_MENUITEM_HEX
134    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
135    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeCmdPort
[233]136    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  8h
137    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  3f8h
[199]138    at  MENUITEM.itemValue + ITEM_VALUE.fnValueReader,              dw  IdeControllerMenu_SerialReadPort
139    at  MENUITEM.itemValue + ITEM_VALUE.fnValueWriter,              dw  IdeControllerMenu_SerialWritePort
[242]140iend
[199]141
[242]142g_MenuitemIdeControllerSerialBaud:
[199]143istruc MENUITEM
144    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
[233]145    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromRawItemInDSSI
[199]146    at  MENUITEM.szName,            dw  g_szItemSerialBaud
147    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeSerialBaud
148    at  MENUITEM.szHelp,            dw  g_szHelpIdeSerialBaud
[233]149    at  MENUITEM.bFlags,            db  FLG_MENUITEM_BYTEVALUE | FLG_MENUITEM_CHOICESTRINGS
[199]150    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOICE
151    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
152    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgDevice
153    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoice,              dw  g_szSerialBaudChoice
[233]154    at  MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup,     dw  g_rgbChoiceToValueLookupForBaud
155    at  MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup,   dw  g_rgszChoiceToStringLookupForBaud
[199]156iend
[242]157
[57]158g_MenuitemIdeControllerEnableInterrupt:
159istruc MENUITEM
[108]160    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
[59]161    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
[57]162    at  MENUITEM.szName,            dw  g_szItemIdeEnIRQ
163    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeEnIRQ
164    at  MENUITEM.szHelp,            dw  g_szHelpIdeEnIRQ
[459]165    at  MENUITEM.bFlags,            db  FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
[108]166    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOICE
[57]167    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
168    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeEnIRQ
[108]169    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoice,              dw  g_szMultichoiceBooleanFlag
[57]170    at  MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup,    dw  g_rgszValueToStringLookupForFlagBooleans
171    at  MENUITEM.itemValue + ITEM_VALUE.wValueBitmask,              dw  15
172iend
173
174g_MenuitemIdeControllerIdeIRQ:
175istruc MENUITEM
176    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateUnsignedInputForMenuitemInDSSI
177    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
178    at  MENUITEM.szName,            dw  g_szItemIdeIRQ
179    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeIRQ
180    at  MENUITEM.szHelp,            dw  g_szHelpIdeIRQ
181    at  MENUITEM.bFlags,            db  FLG_MENUITEM_BYTEVALUE
182    at  MENUITEM.bType,             db  TYPE_MENUITEM_UNSIGNED
183    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
184    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeIRQ
185    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  2
186    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  15
187iend
188
[153]189g_rgwChoiceToValueLookupForDevice:
190    dw  DEVICE_16BIT_ATA
191    dw  DEVICE_32BIT_ATA
[481]192    dw  DEVICE_8BIT_ATA
193    dw  DEVICE_8BIT_XTIDE_REV1
194    dw  DEVICE_8BIT_XTIDE_REV2
195    dw  DEVICE_8BIT_XTCF_PIO8
[546]196    dw  DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
[481]197    dw  DEVICE_8BIT_XTCF_DMA
198    dw  DEVICE_8BIT_JRIDE_ISA
[536]199    dw  DEVICE_8BIT_ADP50L
[153]200    dw  DEVICE_SERIAL_PORT
201g_rgszValueToStringLookupForDevice:
202    dw  g_szValueCfgDevice16b
203    dw  g_szValueCfgDevice32b
[481]204    dw  g_szValueCfgDevice8b
205    dw  g_szValueCfgDeviceRev1
206    dw  g_szValueCfgDeviceRev2
[546]207    dw  g_szValueCfgDeviceXTCFPio8
208    dw  g_szValueCfgDeviceXTCFPio8WithBIUOffload
209    dw  g_szValueCfgDeviceXTCFDMA
[481]210    dw  g_szValueCfgDeviceJrIdeIsa
[536]211    dw  g_szValueCfgDeviceADP50L
[153]212    dw  g_szValueCfgDeviceSerial
[57]213
[233]214g_rgbChoiceToValueLookupForCOM:
215    dw  '1'
216    dw  '2'
217    dw  '3'
218    dw  '4'
219    dw  '5'
220    dw  '6'
221    dw  '7'
222    dw  '8'
223    dw  '9'
224    dw  'A'
225    dw  'B'
226    dw  'C'
227    dw  'x'             ; must be last entry (see reader/write routines)
[242]228g_rgszChoiceToStringLookupForCOM:
[199]229    dw  g_szValueCfgCOM1
230    dw  g_szValueCfgCOM2
231    dw  g_szValueCfgCOM3
232    dw  g_szValueCfgCOM4
233    dw  g_szValueCfgCOM5
234    dw  g_szValueCfgCOM6
235    dw  g_szValueCfgCOM7
236    dw  g_szValueCfgCOM8
237    dw  g_szValueCfgCOM9
238    dw  g_szValueCfgCOMA
239    dw  g_szValueCfgCOMB
240    dw  g_szValueCfgCOMC
241    dw  g_szValueCfgCOMx
[233]242    dw  NULL
[57]243
[280]244SERIAL_DEFAULT_CUSTOM_PORT   EQU        300h           ; can't be any of the pre-defined COM values
[199]245
[233]246PackedCOMPortAddresses:             ; COM1 - COMC (or COM12)
[280]247    db      SERIAL_COM1_IOADDRESS >> 2
248    db      SERIAL_COM2_IOADDRESS >> 2
249    db      SERIAL_COM3_IOADDRESS >> 2
250    db      SERIAL_COM4_IOADDRESS >> 2
251    db      SERIAL_COM5_IOADDRESS >> 2
252    db      SERIAL_COM6_IOADDRESS >> 2
253    db      SERIAL_COM7_IOADDRESS >> 2
254    db      SERIAL_COM8_IOADDRESS >> 2
255    db      SERIAL_COM9_IOADDRESS >> 2
256    db      SERIAL_COMA_IOADDRESS >> 2
257    db      SERIAL_COMB_IOADDRESS >> 2
258    db      SERIAL_COMC_IOADDRESS >> 2
259    db      SERIAL_DEFAULT_CUSTOM_PORT >> 2         ; must be last entry (see reader/writer routines)
260SERIAL_DEFAULT_COM          EQU     '1'
[242]261
[233]262g_rgbChoiceToValueLookupForBaud:
263    dw      (115200 / 115200) & 0xff
264    dw      (115200 /  57600) & 0xff
265    dw      (115200 /  38400) & 0xff
266    dw      (115200 /  28800) & 0xff
267    dw      (115200 /  19200) & 0xff
268    dw      (115200 /   9600) & 0xff
269    dw      (115200 /   4800) & 0xff
270    dw      (115200 /   2400) & 0xff
271g_rgszChoiceToStringLookupForBaud:
272    dw      g_szValueCfgBaud115_2
273    dw      g_szValueCfgBaud57_6
274    dw      g_szValueCfgBaud38_4
275    dw      g_szValueCfgBaud28_8
276    dw      g_szValueCfgBaud19_2
277    dw      g_szValueCfgBaud9600
278    dw      g_szValueCfgBaud4800
279    dw      g_szValueCfgBaud2400
280    dw      NULL
[280]281SERIAL_DEFAULT_BAUD         EQU     ((115200 / 9600)    & 0xff)
[199]282
[57]283; Section containing code
284SECTION .text
285
286;--------------------------------------------------------------------
287; IdeControllerMenu_InitializeToIdevarsOffsetInBX
288;   Parameters:
289;       SS:BP:  Menu handle
290;   Returns:
291;       Nothing
292;   Corrupts registers:
293;       AX
294;--------------------------------------------------------------------
295ALIGN JUMP_ALIGN
296IdeControllerMenu_InitializeToIdevarsOffsetInBX:
297    lea     ax, [bx+IDEVARS.drvParamsMaster]
298    mov     [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
299
300    lea     ax, [bx+IDEVARS.drvParamsSlave]
301    mov     [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
302
[153]303    lea     ax, [bx+IDEVARS.bDevice]
304    mov     [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[57]305
[481]306    lea     ax, [bx+IDEVARS.wBasePort]
[57]307    mov     [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]308
309    lea     ax, [bx+IDEVARS.bSerialPort]
[199]310    mov     [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[233]311
312    lea     ax, [bx+IDEVARS.bSerialBaud]
[199]313    mov     [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]314
[481]315    lea     ax, [bx+IDEVARS.wControlBlockPort]
[57]316    mov     [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[242]317
[233]318    lea     ax, [bx+IDEVARS.bSerialCOMPortChar]
[242]319    mov     [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[57]320
321    lea     ax, [bx+IDEVARS.bIRQ]
322    mov     [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
323    mov     [cs:g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
[199]324
[57]325    ret
326
327
328;--------------------------------------------------------------------
329; IdeControllerMenu_EnterMenuOrModifyItemVisibility
330;   Parameters:
331;       SS:BP:  Menu handle
332;   Returns:
333;       Nothing
334;   Corrupts registers:
335;       All, except BP
336;--------------------------------------------------------------------
337ALIGN JUMP_ALIGN
338IdeControllerMenu_EnterMenuOrModifyItemVisibility:
339    push    cs
340    pop     ds
[483]341    call    .EnableOrDisableControlBlockPort
[459]342    call    .DisableIRQchannelSelection
343    call    .EnableOrDisableEnableInterrupt
[199]344    call    .EnableOrDisableSerial
[57]345    mov     si, g_MenupageForIdeControllerMenu
346    jmp     Menupage_ChangeToNewMenupageInDSSI
347
[459]348
[57]349;--------------------------------------------------------------------
[483]350; .EnableOrDisableControlBlockPort
351;   Parameters:
352;       SS:BP:  Menu handle
353;   Returns:
354;       Nothing
355;   Corrupts registers:
356;       AX, BX
357;--------------------------------------------------------------------
358ALIGN JUMP_ALIGN
359.EnableOrDisableControlBlockPort:
360    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
361    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
362    mov     bx, g_MenuitemIdeControllerControlBlockAddress
363    cmp     al, DEVICE_8BIT_XTCF_PIO8
[536]364    jb      SHORT .EnableMenuitemFromCSBX   ; Not needed for XT-CF, JR-IDE/ISA and ADP50L
[483]365    jmp     SHORT .DisableMenuitemFromCSBX
366
367
368;--------------------------------------------------------------------
[459]369; .EnableOrDisableEnableInterrupt
[57]370;   Parameters:
371;       SS:BP:  Menu handle
372;   Returns:
373;       Nothing
374;   Corrupts registers:
375;       AX, BX
376;--------------------------------------------------------------------
377ALIGN JUMP_ALIGN
[459]378.EnableOrDisableEnableInterrupt:
379    call    Buffers_GetRomvarsFlagsToAX
380    mov     bx, g_MenuitemIdeControllerEnableInterrupt
381    test    ax, FLG_ROMVARS_MODULE_IRQ
382    jz      SHORT .DisableMenuitemFromCSBX
383
384    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
385    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
386    mov     bx, g_MenuitemIdeControllerEnableInterrupt
[481]387    cmp     al, DEVICE_8BIT_XTIDE_REV2
[459]388    jae     SHORT .DisableMenuitemFromCSBX
389
390    call    .EnableMenuitemFromCSBX
391    ; Fall to .EnableOrDisableIRQchannelSelection
392
393;--------------------------------------------------------------------
394; .EnableOrDisableIRQchannelSelection
395;   Parameters:
396;       SS:BP:  Menu handle
397;   Returns:
398;       Nothing
399;   Corrupts registers:
400;       AX, BX
401;--------------------------------------------------------------------
402ALIGN JUMP_ALIGN
403.EnableOrDisableIRQchannelSelection:
[57]404    mov     bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
405    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
406    mov     bx, g_MenuitemIdeControllerIdeIRQ
[109]407    test    al, al
[459]408    jnz     SHORT .EnableMenuitemFromCSBX
409.DisableIRQchannelSelection:
410    mov     bx, g_MenuitemIdeControllerIdeIRQ
411    ; Fall to .DisableMenuitemFromCSBX
[57]412
[459]413
[57]414;--------------------------------------------------------------------
[459]415; .DisableMenuitemFromCSBX
[57]416; .EnableMenuitemFromCSBX
417;   Parameters:
418;       CS:BX:  Ptr to MENUITEM
419;   Returns:
420;       Nothing
421;   Corrupts registers:
422;       Nothing
423;--------------------------------------------------------------------
424ALIGN JUMP_ALIGN
[459]425.DisableMenuitemFromCSBX:
426    and     BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
[57]427    ret
428
429ALIGN JUMP_ALIGN
[459]430.EnableMenuitemFromCSBX:
431    or      BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
[57]432    ret
433
[459]434
[199]435.EnableOrDisableSerial:
436    mov     bx, g_MenuitemIdeControllerSerialBaud
437    call    .DisableMenuitemFromCSBX
438
439    mov     bx, g_MenuitemIdeControllerSerialCOM
440    call    .DisableMenuitemFromCSBX
441
442    mov     bx, g_MenuitemIdeControllerSerialPort
443    call    .DisableMenuitemFromCSBX
[242]444
445    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]446    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
[459]447    cmp     al, DEVICE_SERIAL_PORT
[199]448    jnz     .DisableAllSerial
449
450    mov     bx, g_MenuitemIdeControllerSerialCOM
451    call    .EnableMenuitemFromCSBX
452
453    mov     bx, g_MenuitemIdeControllerSerialBaud
454    call    .EnableMenuitemFromCSBX
455
[242]456    mov     bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]457    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
458    mov     bx, g_MenuitemIdeControllerSerialPort
459    cmp     al,'x'
460    jz      .EnableMenuitemFromCSBX
461    jmp     .DisableMenuitemFromCSBX
462.DisableAllSerial:
463    ret
[242]464
[57]465;--------------------------------------------------------------------
466; MENUITEM activation functions (.fnActivate)
467;   Parameters:
468;       SS:BP:  Ptr to MENU
469;   Returns:
470;       Nothing
471;   Corrupts registers:
472;       All, except segments
473;--------------------------------------------------------------------
474ALIGN JUMP_ALIGN
475MasterDrive:
476    mov     bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
477    jmp     SHORT DisplayMasterSlaveMenu
478
479ALIGN JUMP_ALIGN
480SlaveDrive:
481    mov     bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
482    ; Fall to DisplayMasterSlaveMenu
483
484ALIGN JUMP_ALIGN
485DisplayMasterSlaveMenu:
[233]486;
487; block mode is not supported on serial drives, disable/enable the option as appropriate
488;
489    push    bx
[242]490    mov     bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[233]491    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
492    mov     bx, g_MenuitemMasterSlaveBlockModeTransfers
493    cmp     al,DEVICE_SERIAL_PORT
494    jz      .isSerial
495    or      BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
496    jmp     .isDone
[242]497.isSerial:
[233]498    and     BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
499.isDone:
500    pop     bx
[242]501
[57]502    call    MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
503    jmp     MasterSlaveMenu_EnterMenuOrModifyItemVisibility
[199]504
505;------------------------------------------------------------------------------------------
506;
507; Reader/Writer Routines
508;
509; For serial drives, we pack the port number and baud rate into a single byte, and thus
510; we need to take care to properly read/write just the bits we need.  In addition, since
511; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
[242]512; default the values stored in both these words when switching in and out of the Serial
[199]513; device choice.
514;
515; Writers:
516;   Parameters:
517;       AX:     Value that the MENUITEM system was interacting with
518;       ES:DI:  ROMVARS location where the value is to be stored
519;       DS:SI:  MENUITEM pointer
520;   Returns:
521;       AX:     Value to actually write to ROMVARS
522;   Corrupts registers:
523;       AX
524;
525; Readers:
526;   Parameters:
527;       AX:     Value read from the ROMVARS location
528;       ES:DI:  ROMVARS location where the value was just read from
529;       DS:SI:  MENUITEM pointer
530;   Returns:
531;       AX:     Value that the MENUITEM system will interact with and display
532;   Corrupts registers:
533;       AX
534;
[483]535ALIGN JUMP_ALIGN
536WriterForXTCFwindow:
537    mov     al, ah
538    xor     ah, ah
539    ret
[199]540
[483]541ALIGN JUMP_ALIGN
542ReaderForXTCFwindow:
543    mov     ah, al
544    xor     al, al
545    ret
546
547
[199]548;
549; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are
[242]550; changing in/out of a Serial device (since we use these bytes in radically different ways).
[199]551;
552ALIGN JUMP_ALIGN
553IdeControllerMenu_WriteDevice:
554        push    bx
555        push    di
[483]556        push    di
557        push    ax
[199]558
[483]559        ; Note! AL is the choice index, not device code
560        shl     ax, 1                               ; Selection to device code
561        mov     bl, [es:di]                         ; what is the current Device we are changing from?
562        sub     di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort    ; Get ready to set the Port addresses
563        cmp     al, DEVICE_SERIAL_PORT
564        je      SHORT .changingToSerial
565        cmp     al, DEVICE_8BIT_JRIDE_ISA
566        je      SHORT .ChangingToJrIdeIsa
[536]567        cmp     al, DEVICE_8BIT_ADP50L
568        je      SHORT .ChangingToADP50L
[242]569
[483]570        ; Restore ports to default values
571        cmp     al, DEVICE_8BIT_ATA                 ; Standard ATA controllers, including 8-bit mode
[399]572        mov     ax, DEVICE_ATA_PRIMARY_PORT         ; Defaults for 16-bit and better ATA devices
573        mov     bx, DEVICE_ATA_PRIMARY_PORTCTRL
[483]574        jbe     SHORT .writeNonSerial
[199]575
[546]576        mov     ax, DEVICE_XTIDE_DEFAULT_PORT       ; Defaults for 8-bit XTIDE and XT-CF devices
[483]577        mov     bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
578
[242]579.writeNonSerial:
[481]580        stosw                                       ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
[242]581        xchg    bx, ax
582        stosw
[483]583        jmp     SHORT .done
[199]584
[483]585.ChangingToJrIdeIsa:
[536]586        mov     ah, JRIDE_DEFAULT_SEGMENT_ADDRESS >> 8
587        SKIP2B  bx
588
589.ChangingToADP50L:
590        mov     ah, ADP50L_DEFAULT_BIOS_SEGMENT_ADDRESS >> 8
591        xor     al, al
[483]592        xor     bx, bx
593        jmp     SHORT .writeNonSerial
[199]594
[242]595.changingToSerial:
[483]596        cmp     bl, DEVICE_SERIAL_PORT
597        je      SHORT .done                         ; if we were already serial, nothing to do
[199]598
[483]599        mov     BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
[233]600
[483]601        mov     al, SERIAL_DEFAULT_COM
602        sub     di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
[199]603        call    IdeControllerMenu_SerialWriteCOM
[242]604        stosb
605
606.done:
[483]607        pop     ax
608        pop     di          ; IDEVARS.bDevice
[199]609        pop     di
610        pop     bx
611        ret
612
613;
[233]614; Doesn't modify COM character (unless it is not recognized, which would be an error case),
[242]615; But does update the port address based on COM port selection
616;
[199]617ALIGN JUMP_ALIGN
618IdeControllerMenu_SerialWriteCOM:
[233]619        push    ax
[199]620        push    bx
[233]621        push    si
[242]622
[233]623        mov     si,g_rgbChoiceToValueLookupForCOM
624        mov     bx,PackedCOMPortAddresses
[199]625
[233]626.loop:
627        mov     ah,[bx]
[199]628
[280]629        cmp     ah,(SERIAL_DEFAULT_CUSTOM_PORT >> 2)
[233]630        jz      .notFound
[242]631
[233]632        cmp     al,[si]
633        jz      .found
[242]634
[233]635        inc     si
636        inc     si
637        inc     bx
[242]638
[233]639        jmp     .loop
[199]640
[233]641.notFound:
642        mov     al, 'x'
[242]643
644.found:
[233]645        mov     [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
[199]646
[233]647        pop     si
[199]648        pop     bx
[233]649        pop     ax
[242]650
[199]651        ret
652
[242]653
[199]654;
[233]655; Packed Port (byte) -> Numeric Port (word)
[242]656;
[199]657ALIGN JUMP_ALIGN
[233]658IdeControllerMenu_SerialReadPort:
659        xor     ah,ah
[242]660        eSHL_IM ax, 2
[199]661        ret
662
663;
[233]664; Numeric Port (word) -> Packed Port (byte)
665; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
[199]666;
667ALIGN JUMP_ALIGN
[242]668IdeControllerMenu_SerialWritePort:
[199]669        push    bx
[233]670        push    si
[199]671
[242]672        eSHR_IM ax, 2
[233]673        and     al,0feh         ; force 8-byte boundary
[199]674
[242]675        mov     si,g_rgbChoiceToValueLookupForCOM
[233]676        mov     bx,PackedCOMPortAddresses           ; loop, looking for port address in known COM address list
677
678.loop:
679        mov     ah,[si]
680        cmp     ah,'x'
681        jz      .found
[242]682
[233]683        cmp     al,[bx]
684        jz      .found
[242]685
[233]686        inc     si
687        inc     si
[199]688        inc     bx
[242]689
[233]690        jmp     .loop
[199]691
[242]692.found:
[233]693        mov     [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
694
695        pop     si
[199]696        pop     bx
697
[233]698        ret
[199]699
Note: See TracBrowser for help on using the repository browser.