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

Last change on this file since 614 was 614, checked in by Krister Nordvall, 3 years ago

Changes:

  • BIOSDRVS should now build again (broke in r613).
  • Removed the NO_ATAID_CORRECTION define from the Tiny build.
  • Added a new configuration option to skip detection of slave drives.
  • Made FLASH_SIGNATURE 2 bytes shorter to free up ROM space.
  • "Auto Configure" in XTIDECFG should now detect if running on an Olivetti M24, AT&T PC6300, Xerox 6060 or Logabax Persona 1600 and automatically select the fastest compatible transfer mode/device type for any IDE controllers found in the system.
  • Cleaned out some duplicate/unused definitions.
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_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
478 call Buffers_GetRomvarsValueToAXfromOffsetInBX
479 cmp al, DEVICE_SERIAL_PORT
480 mov ax, DisableMenuitemFromCSBX
481 jne SHORT .DisableSerialControllerMenuitems
482 mov ax, EnableMenuitemFromCSBX
483 call .EnableSerialControllerMenuitems
484 mov bx, [g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
485 call Buffers_GetRomvarsValueToAXfromOffsetInBX
486 cmp al, 'x'
487 mov ax, DisableMenuitemFromCSBX
488 jne SHORT .DisableCustomPortMenuitem
489 ret
490.DisableSerialControllerMenuitems:
491.EnableSerialControllerMenuitems:
492 mov bx, g_MenuitemIdeControllerSerialCOM
493 call ax
494 mov bx, g_MenuitemIdeControllerSerialBaud
495 call ax
496.DisableCustomPortMenuitem:
497 mov bx, g_MenuitemIdeControllerSerialPort
498 jmp ax
499
500
501;--------------------------------------------------------------------
502; MENUITEM activation functions (.fnActivate)
503; Parameters:
504; SS:BP: Ptr to MENU
505; Returns:
506; Nothing
507; Corrupts registers:
508; All, except segments
509;--------------------------------------------------------------------
510ALIGN JUMP_ALIGN
511MasterDrive:
512 mov bx, g_MenuitemMasterSlaveDisableDetection
513 call DisableMenuitemFromCSBX
514 mov bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
515 jmp SHORT DisplayMasterSlaveMenu
516
517ALIGN JUMP_ALIGN
518SlaveDrive:
519 mov bx, g_MenuitemMasterSlaveDisableDetection
520 call EnableMenuitemFromCSBX
521 mov bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
522 ; Fall to DisplayMasterSlaveMenu
523
524DisplayMasterSlaveMenu:
525 call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
526 jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility
527
528
529;--------------------------------------------------------------------
530; IdeControllerMenu_WriteDevice
531;
532; Sets default values to ports and other device dependent stuff
533;
534; Parameters:
535; AX: IDE controller/Device type menu choice index
536; ES:DI: Ptr to IDEVARS.bDevice
537; DS:SI: MENUITEM pointer
538; Returns:
539; AX: IDE controller/Device type menu choice index
540; Corrupts registers:
541; BX, DX
542;--------------------------------------------------------------------
543ALIGN JUMP_ALIGN
544IdeControllerMenu_WriteDevice:
545 push di
546 push ax
547
548 mov bl, [es:di] ; What is the current Device we are changing from?
549 sub di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort ; Get ready to set the Port addresses
550
551 ; Note! AL is the choice index, not device code
552 eSHL_IM al, 1 ; Selection to device code
553 jz SHORT .StandardIdeDevice ; DEVICE_16BIT_ATA
554
555 cmp al, DEVICE_8BIT_ATA
556 ja SHORT .NotStandardIdeDevice
557 jb SHORT .AdvancedAtaDevice ; DEVICE_32BIT_ATA
558 test BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE
559 jmp SHORT .CheckZF
560
561.AdvancedAtaDevice:
562 test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_ADVANCED_ATA >> 8
563.CheckZF:
564 jz SHORT .SupportForDeviceNotAvailable
565
566 ; Standard ATA controllers, including 8-bit mode
567.StandardIdeDevice:
568 ; Enable IRQ for standard ATA
569
570 lea ax, [di-ROMVARS.ideVars0+IDEVARS.wBasePort]
571 mov bl, IDEVARS_size
572 div bl
573 push ax
574 mov bx, .rgbDefaultIrqForStdIde ; Enable interrupt for primary and secondary IDE
575 xlat
576 mov [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], al
577 pop ax
578 sub bx, BYTE .rgbDefaultIrqForStdIde - .rgbLowByteOfStdIdeInterfacePorts
579 xlat ; DS=CS so no segment override needed
580 mov ah, 1 ; DEVICE_ATA_*_PORT >> 8
581 mov bh, 3 ; DEVICE_ATA_*_PORTCTRL >> 8
582 mov bl, al
583 jmp SHORT .WriteNonSerial
584
585.rgbLowByteOfStdIdeInterfacePorts: ; Defaults for 16-bit and better ATA devices
586 db DEVICE_ATA_PRIMARY_PORT & 0FFh
587 db DEVICE_ATA_SECONDARY_PORT & 0FFh
588 db DEVICE_ATA_TERTIARY_PORT & 0FFh
589 db DEVICE_ATA_QUATERNARY_PORT & 0FFh
590.rgbDefaultIrqForStdIde:
591 db 14
592 db 15
593 db 0 ; These can vary so lets disable by default
594 db 0
595
596.NotStandardIdeDevice:
597 cmp al, DEVICE_SERIAL_PORT
598 jb SHORT .NotSerialDevice
599 test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_SERIAL >> 8
600 jnz SHORT .ChangingToSerial
601
602.SupportForDeviceNotAvailable:
603 mov dx, g_szUnsupportedDevice
604 call Dialogs_DisplayErrorFromCSDX
605
606 ; Restore device type to the previous value
607 pop ax ; Get choice index from stack
608 mov al, bl ; Previous device type to AL
609 shr al, 1 ; Device code to choice index
610 pop di
611 ret
612
613.NotSerialDevice:
614 ; Remaining device types all require MODULE_8BIT_IDE or MODULE_8BIT_IDE_ADVANCED
615 test BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE | FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED
616 jz SHORT .SupportForDeviceNotAvailable
617
618 ; We know MODULE_8BIT_IDE is included
619 lahf ; Save the PF
620 cmp al, DEVICE_8BIT_XTIDE_REV2_OLIVETTI
621 jbe SHORT .ChangingToXTIDEorXTCF
622 sahf ; Restore the PF
623 jpo SHORT .SupportForDeviceNotAvailable ; Jump if no MODULE_8BIT_IDE_ADVANCED
624 cmp al, DEVICE_8BIT_JRIDE_ISA
625 je SHORT .ChangingToJrIdeIsa
626 cmp al, DEVICE_8BIT_ADP50L
627 je SHORT .ChangingToADP50L
628
629.ChangingToXTIDEorXTCF:
630 mov ax, DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE and XT-CF devices
631 mov bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
632
633 ; XT-CF does not support IRQ so it must be disabled (IRQ setting is not visible for XT-CF)
634 ; XTIDE does not use IRQs by default
635 mov BYTE [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], 0
636
637.WriteNonSerial:
638 stosw ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
639 xchg bx, ax
640 stosw
641 jmp SHORT .Done
642
643.ChangingToJrIdeIsa:
644 mov ah, JRIDE_DEFAULT_SEGMENT_ADDRESS >> 8
645 SKIP2B bx
646
647.ChangingToADP50L:
648 mov ah, ADP50L_DEFAULT_BIOS_SEGMENT_ADDRESS >> 8
649 xor al, al
650 xor bx, bx
651 jmp SHORT .WriteNonSerial
652
653.ChangingToSerial:
654;
655; For serial drives, we pack the port number and baud rate into a single byte, and thus
656; we need to take care to properly read/write just the bits we need. In addition, since
657; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
658; default the values stored in both these words when switching in and out of the Serial
659; device choice.
660;
661 mov al, SERIAL_DEFAULT_COM
662 mov BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
663 mov [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], ah ; Clear .bIRQ to keep the boot menu from printing it
664
665 sub di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
666 call IdeControllerMenu_SerialWriteCOM
667 stosb
668
669.Done:
670 pop ax
671 pop di
672 ret
673
674
675;--------------------------------------------------------------------
676; IdeControllerMenu_SerialWriteCOM
677;
678; Updates the port address based on COM port selection
679;
680; Parameters:
681; AL: COM port
682; ES:DI: Ptr to IDEVARS.bSerialCOMPortChar
683; DS:SI: MENUITEM pointer
684; Returns:
685; Nothing
686; Corrupts registers:
687; BX
688;--------------------------------------------------------------------
689ALIGN JUMP_ALIGN
690IdeControllerMenu_SerialWriteCOM:
691 push ax
692 push si
693
694 mov bx, PackedCOMPortAddresses - 1
695 mov si, g_rgbChoiceToValueLookupForCOM - 2
696
697.Loop:
698 inc bx
699 inc si
700 inc si
701
702 mov ah, [bx]
703 cmp ah, SERIAL_DEFAULT_CUSTOM_PORT >> 2
704 je SHORT .NotFound
705
706 cmp al, [si]
707 jne SHORT .Loop
708
709.NotFound:
710 mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
711
712 pop si
713 pop ax
714 ret
715
716
717;--------------------------------------------------------------------
718; IdeControllerMenu_SerialReadPort
719;
720; Packed Port (byte) -> Numeric Port (word)
721;
722; Parameters:
723; AX: Value read from the ROMVARS location
724; ES:DI: ROMVARS location where the value was just read from
725; DS:SI: MENUITEM pointer
726; Returns:
727; AX: Value that the MENUITEM system will interact with and display
728; Corrupts registers:
729; Nothing
730;--------------------------------------------------------------------
731ALIGN JUMP_ALIGN
732IdeControllerMenu_SerialReadPort:
733 xor ah, ah
734 eSHL_IM ax, 2
735 ret
736
737
738;--------------------------------------------------------------------
739; IdeControllerMenu_SerialWritePort
740;
741; Numeric Port (word) -> Packed Port (byte)
742;
743; And convert from Custom to a defined COM port if we
744; match one of the pre-defined COM port numbers
745;
746; Parameters:
747; AX: Value that the MENUITEM system was interacting with
748; ES:DI: ROMVARS location where the value is to be stored
749; DS:SI: MENUITEM pointer
750; Returns:
751; AX: Value to actually write to ROMVARS
752; Corrupts registers:
753; BX
754;--------------------------------------------------------------------
755ALIGN JUMP_ALIGN
756IdeControllerMenu_SerialWritePort:
757 push si
758
759 eSHR_IM ax, 2
760 and al, 0FEh ; Force 8-byte boundary
761
762 mov si, g_rgbChoiceToValueLookupForCOM - 2
763 mov bx, PackedCOMPortAddresses - 1 ; Loop, looking for port address in known COM address list
764
765.Loop:
766 inc si
767 inc si
768 inc bx
769
770 mov ah, [si]
771 cmp ah, 'x'
772 je SHORT .Found
773
774 cmp al, [bx]
775 jne SHORT .Loop
776
777.Found:
778 mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
779
780 pop si
781 ret
782
Note: See TracBrowser for help on using the repository browser.