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

Last change on this file since 603 was 601, checked in by Krister Nordvall, 6 years ago

Changes:

  • Building the BIOS now works again.
  • Added a new IDE device type/transfer mode for use only with XT-IDE rev 2+ (or Chuck(G)-modded rev 1) cards installed in any of the following machines: Olivetti M24, AT&T PC6300, Xerox 6060 and Logabax Persona 1600. This new transfer mode is slightly faster than the regular XT-IDE rev 1 device type and requires that the card is configured for High Speed mode (or, in case of the card being a rev 1 card, has the Chuck(G) mod done). The new device type is called "XTIDE rev 2 (Olivetti M24)" in XTIDECFG.
  • Made some minor improvements to the library code that handles 'Drive Not Ready' errors in XTIDECFG.
  • Optimizations.
File size: 26.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 11
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_rgwChoiceToValueLookupForDevice:
190 dw DEVICE_16BIT_ATA
191 dw DEVICE_32BIT_ATA
192 dw DEVICE_8BIT_ATA
193 dw DEVICE_8BIT_XTIDE_REV1
194 dw DEVICE_8BIT_XTIDE_REV2
195 dw DEVICE_8BIT_XTIDE_REV2_OLIVETTI
196 dw DEVICE_8BIT_XTCF_PIO8
197 dw DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
198 dw DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD
199 dw DEVICE_8BIT_XTCF_DMA
200 dw DEVICE_8BIT_JRIDE_ISA
201 dw DEVICE_8BIT_ADP50L
202 dw DEVICE_SERIAL_PORT
203g_rgszValueToStringLookupForDevice:
204 dw g_szValueCfgDevice16b
205 dw g_szValueCfgDevice32b
206 dw g_szValueCfgDevice8b
207 dw g_szValueCfgDeviceRev1
208 dw g_szValueCfgDeviceRev2
209 dw g_szValueCfgDeviceRev2Olivetti
210 dw g_szValueCfgDeviceXTCFPio8
211 dw g_szValueCfgDeviceXTCFPio8WithBIUOffload
212 dw g_szValueCfgDeviceXTCFPio16WithBIUOffload
213 dw g_szValueCfgDeviceXTCFDMA
214 dw g_szValueCfgDeviceJrIdeIsa
215 dw g_szValueCfgDeviceADP50L
216 dw g_szValueCfgDeviceSerial
217
218g_rgbChoiceToValueLookupForCOM:
219 dw '1'
220 dw '2'
221 dw '3'
222 dw '4'
223 dw '5'
224 dw '6'
225 dw '7'
226 dw '8'
227 dw '9'
228 dw 'A'
229 dw 'B'
230 dw 'C'
231 dw 'x' ; must be last entry (see reader/write routines)
232g_rgszChoiceToStringLookupForCOM:
233 dw g_szValueCfgCOM1
234 dw g_szValueCfgCOM2
235 dw g_szValueCfgCOM3
236 dw g_szValueCfgCOM4
237 dw g_szValueCfgCOM5
238 dw g_szValueCfgCOM6
239 dw g_szValueCfgCOM7
240 dw g_szValueCfgCOM8
241 dw g_szValueCfgCOM9
242 dw g_szValueCfgCOMA
243 dw g_szValueCfgCOMB
244 dw g_szValueCfgCOMC
245 dw g_szValueCfgCOMx
246 dw NULL
247
248SERIAL_DEFAULT_CUSTOM_PORT EQU 300h ; can't be any of the pre-defined COM values
249SERIAL_DEFAULT_COM EQU '1'
250SERIAL_DEFAULT_BAUD EQU ((115200 / 9600) & 0xff)
251
252PackedCOMPortAddresses: ; COM1 - COMC (or COM12)
253 db SERIAL_COM1_IOADDRESS >> 2
254 db SERIAL_COM2_IOADDRESS >> 2
255 db SERIAL_COM3_IOADDRESS >> 2
256 db SERIAL_COM4_IOADDRESS >> 2
257 db SERIAL_COM5_IOADDRESS >> 2
258 db SERIAL_COM6_IOADDRESS >> 2
259 db SERIAL_COM7_IOADDRESS >> 2
260 db SERIAL_COM8_IOADDRESS >> 2
261 db SERIAL_COM9_IOADDRESS >> 2
262 db SERIAL_COMA_IOADDRESS >> 2
263 db SERIAL_COMB_IOADDRESS >> 2
264 db SERIAL_COMC_IOADDRESS >> 2
265 db SERIAL_DEFAULT_CUSTOM_PORT >> 2 ; must be last entry (see reader/writer routines)
266
267g_rgbChoiceToValueLookupForBaud:
268 dw (115200 / 115200) & 0xff
269 dw (115200 / 57600) & 0xff
270 dw (115200 / 38400) & 0xff
271 dw (115200 / 28800) & 0xff
272 dw (115200 / 19200) & 0xff
273 dw (115200 / 9600) & 0xff
274 dw (115200 / 4800) & 0xff
275 dw (115200 / 2400) & 0xff
276g_rgszChoiceToStringLookupForBaud:
277 dw g_szValueCfgBaud115_2
278 dw g_szValueCfgBaud57_6
279 dw g_szValueCfgBaud38_4
280 dw g_szValueCfgBaud28_8
281 dw g_szValueCfgBaud19_2
282 dw g_szValueCfgBaud9600
283 dw g_szValueCfgBaud4800
284 dw g_szValueCfgBaud2400
285 dw NULL
286
287; Section containing code
288SECTION .text
289
290;--------------------------------------------------------------------
291; IdeControllerMenu_InitializeToIdevarsOffsetInBX
292; Parameters:
293; SS:BP: Menu handle
294; Returns:
295; Nothing
296; Corrupts registers:
297; AX
298;--------------------------------------------------------------------
299ALIGN JUMP_ALIGN
300IdeControllerMenu_InitializeToIdevarsOffsetInBX:
301 lea ax, [bx+IDEVARS.drvParamsMaster]
302 mov [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
303
304 lea ax, [bx+IDEVARS.drvParamsSlave]
305 mov [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
306
307 lea ax, [bx+IDEVARS.bDevice]
308 mov [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
309
310%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
311%if IDEVARS.wBasePort = 0
312 mov [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], bx
313%else
314 lea ax, [bx+IDEVARS.wBasePort]
315 mov [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
316%endif
317
318%if IDEVARS.bSerialPort = 0
319 mov [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], bx
320%else
321 lea ax, [bx+IDEVARS.bSerialPort]
322 mov [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
323%endif
324%endif
325
326 lea ax, [bx+IDEVARS.bSerialBaud]
327 mov [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
328
329 lea ax, [bx+IDEVARS.wControlBlockPort]
330 mov [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
331
332 lea ax, [bx+IDEVARS.bSerialCOMPortChar]
333 mov [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
334
335 lea ax, [bx+IDEVARS.bIRQ]
336 mov [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
337 mov [cs:g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
338
339 ret
340
341
342;--------------------------------------------------------------------
343; IdeControllerMenu_EnterMenuOrModifyItemVisibility
344; Parameters:
345; SS:BP: Menu handle
346; Returns:
347; Nothing
348; Corrupts registers:
349; All, except BP
350;--------------------------------------------------------------------
351ALIGN JUMP_ALIGN
352IdeControllerMenu_EnterMenuOrModifyItemVisibility:
353 push cs
354 pop ds
355 call .EnableOrDisableCommandBlockPort
356 call .EnableOrDisableControlBlockPort
357 call .DisableIRQchannelSelection
358 call .EnableOrDisableEnableInterrupt
359 call .EnableOrDisableSerial
360 mov si, g_MenupageForIdeControllerMenu
361 jmp Menupage_ChangeToNewMenupageInDSSI
362
363
364;--------------------------------------------------------------------
365; .EnableOrDisableCommandBlockPort
366; Parameters:
367; SS:BP: Menu handle
368; Returns:
369; Nothing
370; Corrupts registers:
371; AX, BX
372;--------------------------------------------------------------------
373ALIGN JUMP_ALIGN
374.EnableOrDisableCommandBlockPort:
375 mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
376 call Buffers_GetRomvarsValueToAXfromOffsetInBX
377 mov bx, g_MenuitemIdeControllerCommandBlockAddress
378 cmp al, DEVICE_SERIAL_PORT
379 je SHORT .DisableMenuitemFromCSBX
380 jmp SHORT .EnableMenuitemFromCSBX
381
382
383;--------------------------------------------------------------------
384; .EnableOrDisableControlBlockPort
385; Parameters:
386; SS:BP: Menu handle
387; Returns:
388; Nothing
389; Corrupts registers:
390; AX, BX
391;--------------------------------------------------------------------
392ALIGN JUMP_ALIGN
393.EnableOrDisableControlBlockPort:
394 mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
395 call Buffers_GetRomvarsValueToAXfromOffsetInBX
396 mov bx, g_MenuitemIdeControllerControlBlockAddress
397 cmp al, DEVICE_8BIT_XTCF_PIO8
398 jb SHORT .EnableMenuitemFromCSBX ; Not needed for XT-CF, JR-IDE/ISA and ADP50L
399 jmp SHORT .DisableMenuitemFromCSBX
400
401
402;--------------------------------------------------------------------
403; .EnableOrDisableEnableInterrupt
404; Parameters:
405; SS:BP: Menu handle
406; Returns:
407; Nothing
408; Corrupts registers:
409; AX, BX
410;--------------------------------------------------------------------
411ALIGN JUMP_ALIGN
412.EnableOrDisableEnableInterrupt:
413 call Buffers_GetRomvarsFlagsToAX
414 mov bx, g_MenuitemIdeControllerEnableInterrupt
415 test ax, FLG_ROMVARS_MODULE_IRQ
416 jz SHORT .DisableMenuitemFromCSBX
417
418 mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
419 call Buffers_GetRomvarsValueToAXfromOffsetInBX
420 mov bx, g_MenuitemIdeControllerEnableInterrupt
421 cmp al, DEVICE_8BIT_XTCF_PIO8
422 jae SHORT .DisableMenuitemFromCSBX
423
424 call EnableMenuitemFromCSBX
425 ; Fall to .EnableOrDisableIRQchannelSelection
426
427;--------------------------------------------------------------------
428; .EnableOrDisableIRQchannelSelection
429; Parameters:
430; SS:BP: Menu handle
431; Returns:
432; Nothing
433; Corrupts registers:
434; AX, BX
435;--------------------------------------------------------------------
436ALIGN JUMP_ALIGN
437.EnableOrDisableIRQchannelSelection:
438 mov bx, [g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
439 call Buffers_GetRomvarsValueToAXfromOffsetInBX
440 mov bx, g_MenuitemIdeControllerIdeIRQ
441 test al, al
442 jnz SHORT .EnableMenuitemFromCSBX
443.DisableIRQchannelSelection:
444 mov bx, g_MenuitemIdeControllerIdeIRQ
445 ; Fall to .DisableMenuitemFromCSBX
446
447
448;--------------------------------------------------------------------
449; .DisableMenuitemFromCSBX
450; .EnableMenuitemFromCSBX
451; Parameters:
452; CS:BX: Ptr to MENUITEM
453; Returns:
454; Nothing
455; Corrupts registers:
456; Nothing
457;--------------------------------------------------------------------
458ALIGN JUMP_ALIGN
459.DisableMenuitemFromCSBX:
460 jmp DisableMenuitemFromCSBX
461
462ALIGN JUMP_ALIGN
463.EnableMenuitemFromCSBX:
464 jmp EnableMenuitemFromCSBX
465
466
467;--------------------------------------------------------------------
468; .EnableOrDisableSerial
469; Parameters:
470; SS:BP: Menu handle
471; Returns:
472; Nothing
473; Corrupts registers:
474; AX, BX
475;--------------------------------------------------------------------
476.EnableOrDisableSerial:
477 mov bx, g_MenuitemIdeControllerSerialBaud
478 call DisableMenuitemFromCSBX
479
480 mov bx, g_MenuitemIdeControllerSerialCOM
481 call DisableMenuitemFromCSBX
482
483 mov bx, g_MenuitemIdeControllerSerialPort
484 call DisableMenuitemFromCSBX
485
486 mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
487 call Buffers_GetRomvarsValueToAXfromOffsetInBX
488 cmp al, DEVICE_SERIAL_PORT
489 jne SHORT .DisableAllSerial
490
491 mov bx, g_MenuitemIdeControllerSerialCOM
492 call EnableMenuitemFromCSBX
493
494 mov bx, g_MenuitemIdeControllerSerialBaud
495 call EnableMenuitemFromCSBX
496
497 mov bx, [g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
498 call Buffers_GetRomvarsValueToAXfromOffsetInBX
499 mov bx, g_MenuitemIdeControllerSerialPort
500 cmp al, 'x'
501 je SHORT .EnableMenuitemFromCSBX
502 jmp SHORT .DisableMenuitemFromCSBX
503.DisableAllSerial:
504 ret
505
506
507;--------------------------------------------------------------------
508; MENUITEM activation functions (.fnActivate)
509; Parameters:
510; SS:BP: Ptr to MENU
511; Returns:
512; Nothing
513; Corrupts registers:
514; All, except segments
515;--------------------------------------------------------------------
516ALIGN JUMP_ALIGN
517MasterDrive:
518 mov bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
519 jmp SHORT DisplayMasterSlaveMenu
520
521ALIGN JUMP_ALIGN
522SlaveDrive:
523 mov bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
524 ; Fall to DisplayMasterSlaveMenu
525
526ALIGN JUMP_ALIGN
527DisplayMasterSlaveMenu:
528;
529; "Block Mode Transfers" and "Internal Write Cache" are not supported on serial drives, disable/enable the options as appropriate
530;
531 push bx
532 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
533 call Buffers_GetRomvarsValueToAXfromOffsetInBX
534 mov bx, g_MenuitemMasterSlaveBlockModeTransfers
535
536 cmp al, DEVICE_SERIAL_PORT
537 je .isSerial
538
539 call EnableMenuitemFromCSBX
540 mov bx, g_MenuitemMasterSlaveWriteCache
541 call EnableMenuitemFromCSBX
542 jmp .isDone
543
544.isSerial:
545 call DisableMenuitemFromCSBX
546 mov bx, g_MenuitemMasterSlaveWriteCache
547 call DisableMenuitemFromCSBX
548
549.isDone:
550 pop bx
551
552 call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
553 jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility
554
555
556;--------------------------------------------------------------------
557; IdeControllerMenu_WriteDevice
558;
559; Sets default values to ports and other device dependent stuff
560;
561; Parameters:
562; AX: IDE controller/Device type menu choice index
563; ES:DI: Ptr to IDEVARS.bDevice
564; DS:SI: MENUITEM pointer
565; Returns:
566; AX: IDE controller/Device type menu choice index
567; Corrupts registers:
568; BX, DX
569;--------------------------------------------------------------------
570ALIGN JUMP_ALIGN
571IdeControllerMenu_WriteDevice:
572 push di
573 push ax
574
575 mov bl, [es:di] ; What is the current Device we are changing from?
576 sub di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort ; Get ready to set the Port addresses
577
578 ; Note! AL is the choice index, not device code
579 eSHL_IM al, 1 ; Selection to device code
580 jz SHORT .StandardIdeDevice ; DEVICE_16BIT_ATA
581
582 cmp al, DEVICE_8BIT_ATA
583 ja SHORT .NotStandardIdeDevice
584 jb SHORT .AdvancedAtaDevice ; DEVICE_32BIT_ATA
585 test BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE
586 jmp SHORT .CheckZF
587
588.AdvancedAtaDevice:
589 test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_ADVANCED_ATA >> 8
590.CheckZF:
591 jz SHORT .SupportForDeviceNotAvailable
592
593 ; Standard ATA controllers, including 8-bit mode
594.StandardIdeDevice:
595 lea ax, [di-ROMVARS.ideVars0+IDEVARS.wBasePort]
596 mov bl, IDEVARS_size
597 div bl
598 mov bx, .rgbLowByteOfStdIdeInterfacePorts
599 xlat ; DS=CS so no segment override needed
600 mov ah, 1 ; DEVICE_ATA_*_PORT >> 8
601 mov bh, 3 ; DEVICE_ATA_*_PORTCTRL >> 8
602 mov bl, al
603 jmp SHORT .WriteNonSerial
604
605.rgbLowByteOfStdIdeInterfacePorts: ; Defaults for 16-bit and better ATA devices
606 db DEVICE_ATA_PRIMARY_PORT & 0FFh
607 db DEVICE_ATA_SECONDARY_PORT & 0FFh
608 db DEVICE_ATA_TERTIARY_PORT & 0FFh
609 db DEVICE_ATA_QUATERNARY_PORT & 0FFh
610
611.NotStandardIdeDevice:
612 cmp al, DEVICE_SERIAL_PORT
613 jb SHORT .NotSerialDevice
614 test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_SERIAL >> 8
615 jnz SHORT .ChangingToSerial
616
617.SupportForDeviceNotAvailable:
618 mov dx, g_szUnsupportedDevice
619 call Dialogs_DisplayErrorFromCSDX
620
621 ; Restore device type to the previous value
622 pop ax ; Get choice index from stack
623 mov al, bl ; Previous device type to AL
624 shr al, 1 ; Device code to choice index
625 pop di
626 ret
627
628.NotSerialDevice:
629 ; Remaining device types all require MODULE_8BIT_IDE or MODULE_8BIT_IDE_ADVANCED
630 test BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE | FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED
631 jz SHORT .SupportForDeviceNotAvailable
632
633 ; We know MODULE_8BIT_IDE is included
634 lahf ; Save the PF
635 cmp al, DEVICE_8BIT_XTIDE_REV2_OLIVETTI
636 jbe SHORT .ChangingToXTIDEorXTCF
637 sahf ; Restore the PF
638 jpo SHORT .SupportForDeviceNotAvailable ; Jump if no MODULE_8BIT_IDE_ADVANCED
639 cmp al, DEVICE_8BIT_JRIDE_ISA
640 je SHORT .ChangingToJrIdeIsa
641 cmp al, DEVICE_8BIT_ADP50L
642 je SHORT .ChangingToADP50L
643
644.ChangingToXTIDEorXTCF:
645 mov ax, DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE and XT-CF devices
646 mov bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
647
648.WriteNonSerial:
649 stosw ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
650 xchg bx, ax
651 stosw
652 jmp SHORT .Done
653
654.ChangingToJrIdeIsa:
655 mov ah, JRIDE_DEFAULT_SEGMENT_ADDRESS >> 8
656 SKIP2B bx
657
658.ChangingToADP50L:
659 mov ah, ADP50L_DEFAULT_BIOS_SEGMENT_ADDRESS >> 8
660 xor al, al
661 xor bx, bx
662 jmp SHORT .WriteNonSerial
663
664.ChangingToSerial:
665;
666; For serial drives, we pack the port number and baud rate into a single byte, and thus
667; we need to take care to properly read/write just the bits we need. In addition, since
668; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
669; default the values stored in both these words when switching in and out of the Serial
670; device choice.
671;
672 mov al, SERIAL_DEFAULT_COM
673 mov BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
674 mov [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], ah ; Clear .bIRQ to keep the boot menu from printing it
675
676 sub di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
677 call IdeControllerMenu_SerialWriteCOM
678 stosb
679
680.Done:
681 pop ax
682 pop di
683 ret
684
685
686;--------------------------------------------------------------------
687; IdeControllerMenu_SerialWriteCOM
688;
689; Updates the port address based on COM port selection
690;
691; Parameters:
692; AL: COM port
693; ES:DI: Ptr to IDEVARS.bSerialCOMPortChar
694; DS:SI: MENUITEM pointer
695; Returns:
696; Nothing
697; Corrupts registers:
698; BX
699;--------------------------------------------------------------------
700ALIGN JUMP_ALIGN
701IdeControllerMenu_SerialWriteCOM:
702 push ax
703 push si
704
705 mov bx, PackedCOMPortAddresses - 1
706 mov si, g_rgbChoiceToValueLookupForCOM - 2
707
708.Loop:
709 inc bx
710 inc si
711 inc si
712
713 mov ah, [bx]
714 cmp ah, SERIAL_DEFAULT_CUSTOM_PORT >> 2
715 je SHORT .NotFound
716
717 cmp al, [si]
718 jne SHORT .Loop
719
720.NotFound:
721 mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
722
723 pop si
724 pop ax
725 ret
726
727
728;--------------------------------------------------------------------
729; IdeControllerMenu_SerialReadPort
730;
731; Packed Port (byte) -> Numeric Port (word)
732;
733; Parameters:
734; AX: Value read from the ROMVARS location
735; ES:DI: ROMVARS location where the value was just read from
736; DS:SI: MENUITEM pointer
737; Returns:
738; AX: Value that the MENUITEM system will interact with and display
739; Corrupts registers:
740; Nothing
741;--------------------------------------------------------------------
742ALIGN JUMP_ALIGN
743IdeControllerMenu_SerialReadPort:
744 xor ah, ah
745 eSHL_IM ax, 2
746 ret
747
748
749;--------------------------------------------------------------------
750; IdeControllerMenu_SerialWritePort
751;
752; Numeric Port (word) -> Packed Port (byte)
753;
754; And convert from Custom to a defined COM port if we
755; match one of the pre-defined COM port numbers
756;
757; Parameters:
758; AX: Value that the MENUITEM system was interacting with
759; ES:DI: ROMVARS location where the value is to be stored
760; DS:SI: MENUITEM pointer
761; Returns:
762; AX: Value to actually write to ROMVARS
763; Corrupts registers:
764; BX
765;--------------------------------------------------------------------
766ALIGN JUMP_ALIGN
767IdeControllerMenu_SerialWritePort:
768 push si
769
770 eSHR_IM ax, 2
771 and al, 0FEh ; Force 8-byte boundary
772
773 mov si, g_rgbChoiceToValueLookupForCOM - 2
774 mov bx, PackedCOMPortAddresses - 1 ; Loop, looking for port address in known COM address list
775
776.Loop:
777 inc si
778 inc si
779 inc bx
780
781 mov ah, [si]
782 cmp ah, 'x'
783 je SHORT .Found
784
785 cmp al, [bx]
786 jne SHORT .Loop
787
788.Found:
789 mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
790
791 pop si
792 ret
793
Note: See TracBrowser for help on using the repository browser.