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

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

Changes:

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