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

Last change on this file since 521 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
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-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.
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_SERIAL_PORT
217g_rgszValueToStringLookupForDevice:
218 dw g_szValueCfgDevice16b
219 dw g_szValueCfgDevice32b
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
227 dw g_szValueCfgDeviceSerial
228
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)
243g_rgszChoiceToStringLookupForCOM:
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
257 dw NULL
258
259SERIAL_DEFAULT_CUSTOM_PORT EQU 300h ; can't be any of the pre-defined COM values
260
261PackedCOMPortAddresses: ; COM1 - COMC (or COM12)
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'
276
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
296SERIAL_DEFAULT_BAUD EQU ((115200 / 9600) & 0xff)
297
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
318 lea ax, [bx+IDEVARS.bDevice]
319 mov [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
320
321 lea ax, [bx+IDEVARS.wBasePort]
322 mov [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
323
324 lea ax, [bx+IDEVARS.bSerialPort]
325 mov [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
326
327 lea ax, [bx+IDEVARS.bSerialBaud]
328 mov [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
329
330 lea ax, [bx+IDEVARS.wControlBlockPort]
331 mov [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
332
333 lea ax, [bx+IDEVARS.bXTCFcontrolRegister]
334 mov [cs:g_MenuitemIdeControllerXTCFwindow+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
335
336 lea ax, [bx+IDEVARS.bSerialCOMPortChar]
337 mov [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
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
342
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
359 call .EnableOrDisableControlBlockPort
360 call .DisableIRQchannelSelection
361 call .EnableOrDisableEnableInterrupt
362 call .EnableOrDisableXTCFwindow
363 call .EnableOrDisableSerial
364 mov si, g_MenupageForIdeControllerMenu
365 jmp Menupage_ChangeToNewMenupageInDSSI
366
367
368;--------------------------------------------------------------------
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
383 jb SHORT .EnableMenuitemFromCSBX ; Not needed for XT-CF and JR-IDE/ISA
384 jmp SHORT .DisableMenuitemFromCSBX
385
386
387;--------------------------------------------------------------------
388; .EnableOrDisableEnableInterrupt
389; Parameters:
390; SS:BP: Menu handle
391; Returns:
392; Nothing
393; Corrupts registers:
394; AX, BX
395;--------------------------------------------------------------------
396ALIGN JUMP_ALIGN
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
406 cmp al, DEVICE_8BIT_XTIDE_REV2
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:
423 mov bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
424 call Buffers_GetRomvarsValueToAXfromOffsetInBX
425 mov bx, g_MenuitemIdeControllerIdeIRQ
426 test al, al
427 jnz SHORT .EnableMenuitemFromCSBX
428.DisableIRQchannelSelection:
429 mov bx, g_MenuitemIdeControllerIdeIRQ
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
449 ; Fall to .DisableMenuitemFromCSBX
450
451
452;--------------------------------------------------------------------
453; .DisableMenuitemFromCSBX
454; .EnableMenuitemFromCSBX
455; Parameters:
456; CS:BX: Ptr to MENUITEM
457; Returns:
458; Nothing
459; Corrupts registers:
460; Nothing
461;--------------------------------------------------------------------
462ALIGN JUMP_ALIGN
463.DisableMenuitemFromCSBX:
464 and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
465 ret
466
467ALIGN JUMP_ALIGN
468.EnableMenuitemFromCSBX:
469 or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
470 ret
471
472
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
482
483 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
484 call Buffers_GetRomvarsValueToAXfromOffsetInBX
485 cmp al, DEVICE_SERIAL_PORT
486 jnz .DisableAllSerial
487
488 mov bx, g_MenuitemIdeControllerSerialCOM
489 call .EnableMenuitemFromCSBX
490
491 mov bx, g_MenuitemIdeControllerSerialBaud
492 call .EnableMenuitemFromCSBX
493
494 mov bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
495 call Buffers_GetRomvarsValueToAXfromOffsetInBX
496 mov bx, g_MenuitemIdeControllerSerialPort
497 cmp al,'x'
498 jz .EnableMenuitemFromCSBX
499 jmp .DisableMenuitemFromCSBX
500.DisableAllSerial:
501 ret
502
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:
524;
525; block mode is not supported on serial drives, disable/enable the option as appropriate
526;
527 push bx
528 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
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
535.isSerial:
536 and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
537.isDone:
538 pop bx
539
540 call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
541 jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility
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
550; default the values stored in both these words when switching in and out of the Serial
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;
573ALIGN JUMP_ALIGN
574WriterForXTCFwindow:
575 mov al, ah
576 xor ah, ah
577 ret
578
579ALIGN JUMP_ALIGN
580ReaderForXTCFwindow:
581 mov ah, al
582 xor al, al
583 ret
584
585
586;
587; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are
588; changing in/out of a Serial device (since we use these bytes in radically different ways).
589;
590ALIGN JUMP_ALIGN
591IdeControllerMenu_WriteDevice:
592 push bx
593 push di
594 push di
595 push ax
596
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
605
606 ; Restore ports to default values
607 cmp al, DEVICE_8BIT_ATA ; Standard ATA controllers, including 8-bit mode
608 mov ax, DEVICE_ATA_PRIMARY_PORT ; Defaults for 16-bit and better ATA devices
609 mov bx, DEVICE_ATA_PRIMARY_PORTCTRL
610 jbe SHORT .writeNonSerial
611
612 mov ax, DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE devices
613 mov bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
614
615.writeNonSerial:
616 stosw ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
617 xchg bx, ax
618 stosw
619 jmp SHORT .done
620
621.ChangingToJrIdeIsa:
622 mov ax, JRIDE_DEFAULT_SEGMENT_ADDRESS
623 xor bx, bx
624 jmp SHORT .writeNonSerial
625
626.changingToSerial:
627 cmp bl, DEVICE_SERIAL_PORT
628 je SHORT .done ; if we were already serial, nothing to do
629
630 mov BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
631
632 mov al, SERIAL_DEFAULT_COM
633 sub di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
634 call IdeControllerMenu_SerialWriteCOM
635 stosb
636
637.done:
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:
661 pop di
662 pop bx
663 ret
664
665;
666; Doesn't modify COM character (unless it is not recognized, which would be an error case),
667; But does update the port address based on COM port selection
668;
669ALIGN JUMP_ALIGN
670IdeControllerMenu_SerialWriteCOM:
671 push ax
672 push bx
673 push si
674
675 mov si,g_rgbChoiceToValueLookupForCOM
676 mov bx,PackedCOMPortAddresses
677
678.loop:
679 mov ah,[bx]
680
681 cmp ah,(SERIAL_DEFAULT_CUSTOM_PORT >> 2)
682 jz .notFound
683
684 cmp al,[si]
685 jz .found
686
687 inc si
688 inc si
689 inc bx
690
691 jmp .loop
692
693.notFound:
694 mov al, 'x'
695
696.found:
697 mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
698
699 pop si
700 pop bx
701 pop ax
702
703 ret
704
705
706;
707; Packed Port (byte) -> Numeric Port (word)
708;
709ALIGN JUMP_ALIGN
710IdeControllerMenu_SerialReadPort:
711 xor ah,ah
712 eSHL_IM ax, 2
713 ret
714
715;
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
718;
719ALIGN JUMP_ALIGN
720IdeControllerMenu_SerialWritePort:
721 push bx
722 push si
723
724 eSHR_IM ax, 2
725 and al,0feh ; force 8-byte boundary
726
727 mov si,g_rgbChoiceToValueLookupForCOM
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
734
735 cmp al,[bx]
736 jz .found
737
738 inc si
739 inc si
740 inc bx
741
742 jmp .loop
743
744.found:
745 mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
746
747 pop si
748 pop bx
749
750 ret
751
Note: See TracBrowser for help on using the repository browser.