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

Last change on this file since 493 was 491, checked in by krille_n_@…, 12 years ago

Changes:

  • Added a new define (USE_UNDOC_INTEL) that enables optimizations possible by using undocumented instructions available on all Intel processors and truly compatible clones. AFAIK the only exceptions are the NEC V-series and the Sony CXQ70108 processors so this option should be safe for use on the AT builds.
  • Building BIOSDRVS or the BIOS without MODULE_STRINGS_COMPRESSED would fail due to the recent code exclusions so I changed them a bit. Also fixed the mistaken change to Main.asm
  • Changed the Tandy specific info in Configuration_FullMode.txt so it matches the info in the Wiki.
  • Optimizations and fixes in general.
File size: 26.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
[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
[483]85 at MENUITEM.bFlags, db NULL
[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 .EnableOrDisableCommandBlockPort
360 call .EnableOrDisableControlBlockPort
[459]361 call .DisableIRQchannelSelection
362 call .EnableOrDisableEnableInterrupt
[483]363 call .EnableOrDisableXTCFwindow
[199]364 call .EnableOrDisableSerial
[57]365 mov si, g_MenupageForIdeControllerMenu
366 jmp Menupage_ChangeToNewMenupageInDSSI
367
[459]368
[57]369;--------------------------------------------------------------------
[483]370; .EnableOrDisableCommandBlockPort
371; Parameters:
372; SS:BP: Menu handle
373; Returns:
374; Nothing
375; Corrupts registers:
376; AX, BX
377;--------------------------------------------------------------------
378ALIGN JUMP_ALIGN
379.EnableOrDisableCommandBlockPort:
380 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
381 call Buffers_GetRomvarsValueToAXfromOffsetInBX
382 mov bx, g_MenuitemIdeControllerCommandBlockAddress
383 cmp al, DEVICE_8BIT_XTCF_PIO8
384 jb SHORT .EnableMenuitemFromCSBX
385 cmp al, DEVICE_SERIAL_PORT
386 je SHORT .DisableMenuitemFromCSBX
387 cmp al, DEVICE_8BIT_XTCF_MEMMAP
388 ja SHORT .EnableMenuitemFromCSBX
389 jmp SHORT .DisableMenuitemFromCSBX
390
[491]391
[483]392;--------------------------------------------------------------------
393; .EnableOrDisableControlBlockPort
394; Parameters:
395; SS:BP: Menu handle
396; Returns:
397; Nothing
398; Corrupts registers:
399; AX, BX
400;--------------------------------------------------------------------
401ALIGN JUMP_ALIGN
402.EnableOrDisableControlBlockPort:
403 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
404 call Buffers_GetRomvarsValueToAXfromOffsetInBX
405 mov bx, g_MenuitemIdeControllerControlBlockAddress
406 cmp al, DEVICE_8BIT_XTCF_PIO8
407 jb SHORT .EnableMenuitemFromCSBX
408 jmp SHORT .DisableMenuitemFromCSBX
409
410
411;--------------------------------------------------------------------
[459]412; .EnableOrDisableEnableInterrupt
[57]413; Parameters:
414; SS:BP: Menu handle
415; Returns:
416; Nothing
417; Corrupts registers:
418; AX, BX
419;--------------------------------------------------------------------
420ALIGN JUMP_ALIGN
[459]421.EnableOrDisableEnableInterrupt:
422 call Buffers_GetRomvarsFlagsToAX
423 mov bx, g_MenuitemIdeControllerEnableInterrupt
424 test ax, FLG_ROMVARS_MODULE_IRQ
425 jz SHORT .DisableMenuitemFromCSBX
426
427 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
428 call Buffers_GetRomvarsValueToAXfromOffsetInBX
429 mov bx, g_MenuitemIdeControllerEnableInterrupt
[481]430 cmp al, DEVICE_8BIT_XTIDE_REV2
[459]431 jae SHORT .DisableMenuitemFromCSBX
432
433 call .EnableMenuitemFromCSBX
434 ; Fall to .EnableOrDisableIRQchannelSelection
435
436;--------------------------------------------------------------------
437; .EnableOrDisableIRQchannelSelection
438; Parameters:
439; SS:BP: Menu handle
440; Returns:
441; Nothing
442; Corrupts registers:
443; AX, BX
444;--------------------------------------------------------------------
445ALIGN JUMP_ALIGN
446.EnableOrDisableIRQchannelSelection:
[57]447 mov bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
448 call Buffers_GetRomvarsValueToAXfromOffsetInBX
449 mov bx, g_MenuitemIdeControllerIdeIRQ
[109]450 test al, al
[459]451 jnz SHORT .EnableMenuitemFromCSBX
452.DisableIRQchannelSelection:
453 mov bx, g_MenuitemIdeControllerIdeIRQ
[483]454 jmp SHORT .DisableMenuitemFromCSBX
455
456
457;--------------------------------------------------------------------
458; .EnableOrDisableXTCFwindow
459; Parameters:
460; SS:BP: Menu handle
461; Returns:
462; Nothing
463; Corrupts registers:
464; AX, BX
465;--------------------------------------------------------------------
466ALIGN JUMP_ALIGN
467.EnableOrDisableXTCFwindow:
468 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
469 call Buffers_GetRomvarsValueToAXfromOffsetInBX
470 mov bx, g_MenuitemIdeControllerXTCFwindow
471 cmp al, DEVICE_8BIT_XTCF_MEMMAP
472 je SHORT .EnableMenuitemFromCSBX
[459]473 ; Fall to .DisableMenuitemFromCSBX
[57]474
[459]475
[57]476;--------------------------------------------------------------------
[459]477; .DisableMenuitemFromCSBX
[57]478; .EnableMenuitemFromCSBX
479; Parameters:
480; CS:BX: Ptr to MENUITEM
481; Returns:
482; Nothing
483; Corrupts registers:
484; Nothing
485;--------------------------------------------------------------------
486ALIGN JUMP_ALIGN
[459]487.DisableMenuitemFromCSBX:
488 and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
[57]489 ret
490
491ALIGN JUMP_ALIGN
[459]492.EnableMenuitemFromCSBX:
493 or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
[57]494 ret
495
[459]496
[199]497.EnableOrDisableSerial:
498 mov bx, g_MenuitemIdeControllerSerialBaud
499 call .DisableMenuitemFromCSBX
500
501 mov bx, g_MenuitemIdeControllerSerialCOM
502 call .DisableMenuitemFromCSBX
503
504 mov bx, g_MenuitemIdeControllerSerialPort
505 call .DisableMenuitemFromCSBX
[242]506
507 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]508 call Buffers_GetRomvarsValueToAXfromOffsetInBX
[459]509 cmp al, DEVICE_SERIAL_PORT
[199]510 jnz .DisableAllSerial
511
512 mov bx, g_MenuitemIdeControllerSerialCOM
513 call .EnableMenuitemFromCSBX
514
515 mov bx, g_MenuitemIdeControllerSerialBaud
516 call .EnableMenuitemFromCSBX
517
[242]518 mov bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[199]519 call Buffers_GetRomvarsValueToAXfromOffsetInBX
520 mov bx, g_MenuitemIdeControllerSerialPort
521 cmp al,'x'
522 jz .EnableMenuitemFromCSBX
523 jmp .DisableMenuitemFromCSBX
524.DisableAllSerial:
525 ret
[242]526
[57]527;--------------------------------------------------------------------
528; MENUITEM activation functions (.fnActivate)
529; Parameters:
530; SS:BP: Ptr to MENU
531; Returns:
532; Nothing
533; Corrupts registers:
534; All, except segments
535;--------------------------------------------------------------------
536ALIGN JUMP_ALIGN
537MasterDrive:
538 mov bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
539 jmp SHORT DisplayMasterSlaveMenu
540
541ALIGN JUMP_ALIGN
542SlaveDrive:
543 mov bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
544 ; Fall to DisplayMasterSlaveMenu
545
546ALIGN JUMP_ALIGN
547DisplayMasterSlaveMenu:
[233]548;
549; block mode is not supported on serial drives, disable/enable the option as appropriate
550;
551 push bx
[242]552 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
[233]553 call Buffers_GetRomvarsValueToAXfromOffsetInBX
554 mov bx, g_MenuitemMasterSlaveBlockModeTransfers
555 cmp al,DEVICE_SERIAL_PORT
556 jz .isSerial
557 or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
558 jmp .isDone
[242]559.isSerial:
[233]560 and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
561.isDone:
562 pop bx
[242]563
[57]564 call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
565 jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility
[199]566
567;------------------------------------------------------------------------------------------
568;
569; Reader/Writer Routines
570;
571; For serial drives, we pack the port number and baud rate into a single byte, and thus
572; we need to take care to properly read/write just the bits we need. In addition, since
573; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
[242]574; default the values stored in both these words when switching in and out of the Serial
[199]575; device choice.
576;
577; Writers:
578; Parameters:
579; AX: Value that the MENUITEM system was interacting with
580; ES:DI: ROMVARS location where the value is to be stored
581; DS:SI: MENUITEM pointer
582; Returns:
583; AX: Value to actually write to ROMVARS
584; Corrupts registers:
585; AX
586;
587; Readers:
588; Parameters:
589; AX: Value read from the ROMVARS location
590; ES:DI: ROMVARS location where the value was just read from
591; DS:SI: MENUITEM pointer
592; Returns:
593; AX: Value that the MENUITEM system will interact with and display
594; Corrupts registers:
595; AX
596;
[483]597ALIGN JUMP_ALIGN
598WriterForXTCFwindow:
599 mov al, ah
600 xor ah, ah
601 ret
[199]602
[483]603ALIGN JUMP_ALIGN
604ReaderForXTCFwindow:
605 mov ah, al
606 xor al, al
607 ret
608
609
[199]610;
611; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are
[242]612; changing in/out of a Serial device (since we use these bytes in radically different ways).
[199]613;
614ALIGN JUMP_ALIGN
615IdeControllerMenu_WriteDevice:
616 push bx
617 push di
[483]618 push di
619 push ax
[199]620
[483]621 ; Note! AL is the choice index, not device code
622 shl ax, 1 ; Selection to device code
623 mov bl, [es:di] ; what is the current Device we are changing from?
624 sub di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort ; Get ready to set the Port addresses
625 cmp al, DEVICE_SERIAL_PORT
626 je SHORT .changingToSerial
627 cmp al, DEVICE_8BIT_JRIDE_ISA
628 je SHORT .ChangingToJrIdeIsa
[242]629
[483]630 ; Restore ports to default values
631 cmp al, DEVICE_8BIT_ATA ; Standard ATA controllers, including 8-bit mode
[399]632 mov ax, DEVICE_ATA_PRIMARY_PORT ; Defaults for 16-bit and better ATA devices
633 mov bx, DEVICE_ATA_PRIMARY_PORTCTRL
[483]634 jbe SHORT .writeNonSerial
[199]635
[483]636 mov ax, DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE devices
637 mov bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
638
[242]639.writeNonSerial:
[481]640 stosw ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
[242]641 xchg bx, ax
642 stosw
[483]643 jmp SHORT .done
[199]644
[483]645.ChangingToJrIdeIsa:
646 mov ax, JRIDE_DEFAULT_SEGMENT_ADDRESS
647 xor bx, bx
648 jmp SHORT .writeNonSerial
[199]649
[242]650.changingToSerial:
[483]651 cmp bl, DEVICE_SERIAL_PORT
652 je SHORT .done ; if we were already serial, nothing to do
[199]653
[483]654 mov BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
[233]655
[483]656 mov al, SERIAL_DEFAULT_COM
657 sub di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
[199]658 call IdeControllerMenu_SerialWriteCOM
[242]659 stosb
660
661.done:
[483]662 ; See if we are changing to XT-CF. If we are, store
663 ; byte for Control Register.
664 pop ax
665 pop di ; IDEVARS.bDevice
666 sub di, BYTE IDEVARS.bDevice - IDEVARS.bXTCFcontrolRegister ; IDEVARS.bXTCFcontrolRegister
667 cmp al, DEVICE_8BIT_XTCF_PIO8 >> 1
668 je SHORT .ChangingToPioModeXTCF
669 cmp al, DEVICE_8BIT_XTCF_DMA >> 1
670 je SHORT .ChangingToDmaModeXTCF
671 cmp al, DEVICE_8BIT_XTCF_MEMMAP >> 1
672 jne SHORT .NoNeedToChangeXTCFsettings
673
674 ; XT-CF Memory Mapped Mode
675 mov WORD [es:di], DEFAULT_XTCF_SECTOR_WINDOW_SEGMENT >> 8 ; Store word to clear Control Block Port high byte
676 jmp SHORT .NoNeedToChangeXTCFsettings
677.ChangingToPioModeXTCF:
678 mov BYTE [es:di], XTCF_8BIT_PIO_MODE
679 jmp SHORT .NoNeedToChangeXTCFsettings
680.ChangingToDmaModeXTCF:
681 mov BYTE [es:di], XTCF_DMA_MODE
682 ; Fall to .NoNeedToChangeXTCFsettings
683
684.NoNeedToChangeXTCFsettings:
[199]685 pop di
686 pop bx
687 ret
688
689;
[233]690; Doesn't modify COM character (unless it is not recognized, which would be an error case),
[242]691; But does update the port address based on COM port selection
692;
[199]693ALIGN JUMP_ALIGN
694IdeControllerMenu_SerialWriteCOM:
[233]695 push ax
[199]696 push bx
[233]697 push si
[242]698
[233]699 mov si,g_rgbChoiceToValueLookupForCOM
700 mov bx,PackedCOMPortAddresses
[199]701
[233]702.loop:
703 mov ah,[bx]
[199]704
[280]705 cmp ah,(SERIAL_DEFAULT_CUSTOM_PORT >> 2)
[233]706 jz .notFound
[242]707
[233]708 cmp al,[si]
709 jz .found
[242]710
[233]711 inc si
712 inc si
713 inc bx
[242]714
[233]715 jmp .loop
[199]716
[233]717.notFound:
718 mov al, 'x'
[242]719
720.found:
[233]721 mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
[199]722
[233]723 pop si
[199]724 pop bx
[233]725 pop ax
[242]726
[199]727 ret
728
[242]729
[199]730;
[233]731; Packed Port (byte) -> Numeric Port (word)
[242]732;
[199]733ALIGN JUMP_ALIGN
[233]734IdeControllerMenu_SerialReadPort:
735 xor ah,ah
[242]736 eSHL_IM ax, 2
[199]737 ret
738
739;
[233]740; Numeric Port (word) -> Packed Port (byte)
741; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
[199]742;
743ALIGN JUMP_ALIGN
[242]744IdeControllerMenu_SerialWritePort:
[199]745 push bx
[233]746 push si
[199]747
[242]748 eSHR_IM ax, 2
[233]749 and al,0feh ; force 8-byte boundary
[199]750
[242]751 mov si,g_rgbChoiceToValueLookupForCOM
[233]752 mov bx,PackedCOMPortAddresses ; loop, looking for port address in known COM address list
753
754.loop:
755 mov ah,[si]
756 cmp ah,'x'
757 jz .found
[242]758
[233]759 cmp al,[bx]
760 jz .found
[242]761
[233]762 inc si
763 inc si
[199]764 inc bx
[242]765
[233]766 jmp .loop
[199]767
[242]768.found:
[233]769 mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
770
771 pop si
[199]772 pop bx
773
[233]774 ret
[199]775
Note: See TracBrowser for help on using the repository browser.