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

Last change on this file since 549 was 546, checked in by aitotat@…, 12 years ago

Changes to Configurator v2:

  • Integrated XT-CFv3 support by James Pearce.
File size: 23.2 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_XTCF_PIO8
196 dw DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
197 dw DEVICE_8BIT_XTCF_DMA
198 dw DEVICE_8BIT_JRIDE_ISA
199 dw DEVICE_8BIT_ADP50L
200 dw DEVICE_SERIAL_PORT
201g_rgszValueToStringLookupForDevice:
202 dw g_szValueCfgDevice16b
203 dw g_szValueCfgDevice32b
204 dw g_szValueCfgDevice8b
205 dw g_szValueCfgDeviceRev1
206 dw g_szValueCfgDeviceRev2
207 dw g_szValueCfgDeviceXTCFPio8
208 dw g_szValueCfgDeviceXTCFPio8WithBIUOffload
209 dw g_szValueCfgDeviceXTCFDMA
210 dw g_szValueCfgDeviceJrIdeIsa
211 dw g_szValueCfgDeviceADP50L
212 dw g_szValueCfgDeviceSerial
213
214g_rgbChoiceToValueLookupForCOM:
215 dw '1'
216 dw '2'
217 dw '3'
218 dw '4'
219 dw '5'
220 dw '6'
221 dw '7'
222 dw '8'
223 dw '9'
224 dw 'A'
225 dw 'B'
226 dw 'C'
227 dw 'x' ; must be last entry (see reader/write routines)
228g_rgszChoiceToStringLookupForCOM:
229 dw g_szValueCfgCOM1
230 dw g_szValueCfgCOM2
231 dw g_szValueCfgCOM3
232 dw g_szValueCfgCOM4
233 dw g_szValueCfgCOM5
234 dw g_szValueCfgCOM6
235 dw g_szValueCfgCOM7
236 dw g_szValueCfgCOM8
237 dw g_szValueCfgCOM9
238 dw g_szValueCfgCOMA
239 dw g_szValueCfgCOMB
240 dw g_szValueCfgCOMC
241 dw g_szValueCfgCOMx
242 dw NULL
243
244SERIAL_DEFAULT_CUSTOM_PORT EQU 300h ; can't be any of the pre-defined COM values
245
246PackedCOMPortAddresses: ; COM1 - COMC (or COM12)
247 db SERIAL_COM1_IOADDRESS >> 2
248 db SERIAL_COM2_IOADDRESS >> 2
249 db SERIAL_COM3_IOADDRESS >> 2
250 db SERIAL_COM4_IOADDRESS >> 2
251 db SERIAL_COM5_IOADDRESS >> 2
252 db SERIAL_COM6_IOADDRESS >> 2
253 db SERIAL_COM7_IOADDRESS >> 2
254 db SERIAL_COM8_IOADDRESS >> 2
255 db SERIAL_COM9_IOADDRESS >> 2
256 db SERIAL_COMA_IOADDRESS >> 2
257 db SERIAL_COMB_IOADDRESS >> 2
258 db SERIAL_COMC_IOADDRESS >> 2
259 db SERIAL_DEFAULT_CUSTOM_PORT >> 2 ; must be last entry (see reader/writer routines)
260SERIAL_DEFAULT_COM EQU '1'
261
262g_rgbChoiceToValueLookupForBaud:
263 dw (115200 / 115200) & 0xff
264 dw (115200 / 57600) & 0xff
265 dw (115200 / 38400) & 0xff
266 dw (115200 / 28800) & 0xff
267 dw (115200 / 19200) & 0xff
268 dw (115200 / 9600) & 0xff
269 dw (115200 / 4800) & 0xff
270 dw (115200 / 2400) & 0xff
271g_rgszChoiceToStringLookupForBaud:
272 dw g_szValueCfgBaud115_2
273 dw g_szValueCfgBaud57_6
274 dw g_szValueCfgBaud38_4
275 dw g_szValueCfgBaud28_8
276 dw g_szValueCfgBaud19_2
277 dw g_szValueCfgBaud9600
278 dw g_szValueCfgBaud4800
279 dw g_szValueCfgBaud2400
280 dw NULL
281SERIAL_DEFAULT_BAUD EQU ((115200 / 9600) & 0xff)
282
283; Section containing code
284SECTION .text
285
286;--------------------------------------------------------------------
287; IdeControllerMenu_InitializeToIdevarsOffsetInBX
288; Parameters:
289; SS:BP: Menu handle
290; Returns:
291; Nothing
292; Corrupts registers:
293; AX
294;--------------------------------------------------------------------
295ALIGN JUMP_ALIGN
296IdeControllerMenu_InitializeToIdevarsOffsetInBX:
297 lea ax, [bx+IDEVARS.drvParamsMaster]
298 mov [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
299
300 lea ax, [bx+IDEVARS.drvParamsSlave]
301 mov [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
302
303 lea ax, [bx+IDEVARS.bDevice]
304 mov [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
305
306 lea ax, [bx+IDEVARS.wBasePort]
307 mov [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
308
309 lea ax, [bx+IDEVARS.bSerialPort]
310 mov [cs:g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
311
312 lea ax, [bx+IDEVARS.bSerialBaud]
313 mov [cs:g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
314
315 lea ax, [bx+IDEVARS.wControlBlockPort]
316 mov [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
317
318 lea ax, [bx+IDEVARS.bSerialCOMPortChar]
319 mov [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
320
321 lea ax, [bx+IDEVARS.bIRQ]
322 mov [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
323 mov [cs:g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
324
325 ret
326
327
328;--------------------------------------------------------------------
329; IdeControllerMenu_EnterMenuOrModifyItemVisibility
330; Parameters:
331; SS:BP: Menu handle
332; Returns:
333; Nothing
334; Corrupts registers:
335; All, except BP
336;--------------------------------------------------------------------
337ALIGN JUMP_ALIGN
338IdeControllerMenu_EnterMenuOrModifyItemVisibility:
339 push cs
340 pop ds
341 call .EnableOrDisableControlBlockPort
342 call .DisableIRQchannelSelection
343 call .EnableOrDisableEnableInterrupt
344 call .EnableOrDisableSerial
345 mov si, g_MenupageForIdeControllerMenu
346 jmp Menupage_ChangeToNewMenupageInDSSI
347
348
349;--------------------------------------------------------------------
350; .EnableOrDisableControlBlockPort
351; Parameters:
352; SS:BP: Menu handle
353; Returns:
354; Nothing
355; Corrupts registers:
356; AX, BX
357;--------------------------------------------------------------------
358ALIGN JUMP_ALIGN
359.EnableOrDisableControlBlockPort:
360 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
361 call Buffers_GetRomvarsValueToAXfromOffsetInBX
362 mov bx, g_MenuitemIdeControllerControlBlockAddress
363 cmp al, DEVICE_8BIT_XTCF_PIO8
364 jb SHORT .EnableMenuitemFromCSBX ; Not needed for XT-CF, JR-IDE/ISA and ADP50L
365 jmp SHORT .DisableMenuitemFromCSBX
366
367
368;--------------------------------------------------------------------
369; .EnableOrDisableEnableInterrupt
370; Parameters:
371; SS:BP: Menu handle
372; Returns:
373; Nothing
374; Corrupts registers:
375; AX, BX
376;--------------------------------------------------------------------
377ALIGN JUMP_ALIGN
378.EnableOrDisableEnableInterrupt:
379 call Buffers_GetRomvarsFlagsToAX
380 mov bx, g_MenuitemIdeControllerEnableInterrupt
381 test ax, FLG_ROMVARS_MODULE_IRQ
382 jz SHORT .DisableMenuitemFromCSBX
383
384 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
385 call Buffers_GetRomvarsValueToAXfromOffsetInBX
386 mov bx, g_MenuitemIdeControllerEnableInterrupt
387 cmp al, DEVICE_8BIT_XTIDE_REV2
388 jae SHORT .DisableMenuitemFromCSBX
389
390 call .EnableMenuitemFromCSBX
391 ; Fall to .EnableOrDisableIRQchannelSelection
392
393;--------------------------------------------------------------------
394; .EnableOrDisableIRQchannelSelection
395; Parameters:
396; SS:BP: Menu handle
397; Returns:
398; Nothing
399; Corrupts registers:
400; AX, BX
401;--------------------------------------------------------------------
402ALIGN JUMP_ALIGN
403.EnableOrDisableIRQchannelSelection:
404 mov bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
405 call Buffers_GetRomvarsValueToAXfromOffsetInBX
406 mov bx, g_MenuitemIdeControllerIdeIRQ
407 test al, al
408 jnz SHORT .EnableMenuitemFromCSBX
409.DisableIRQchannelSelection:
410 mov bx, g_MenuitemIdeControllerIdeIRQ
411 ; Fall to .DisableMenuitemFromCSBX
412
413
414;--------------------------------------------------------------------
415; .DisableMenuitemFromCSBX
416; .EnableMenuitemFromCSBX
417; Parameters:
418; CS:BX: Ptr to MENUITEM
419; Returns:
420; Nothing
421; Corrupts registers:
422; Nothing
423;--------------------------------------------------------------------
424ALIGN JUMP_ALIGN
425.DisableMenuitemFromCSBX:
426 and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
427 ret
428
429ALIGN JUMP_ALIGN
430.EnableMenuitemFromCSBX:
431 or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
432 ret
433
434
435.EnableOrDisableSerial:
436 mov bx, g_MenuitemIdeControllerSerialBaud
437 call .DisableMenuitemFromCSBX
438
439 mov bx, g_MenuitemIdeControllerSerialCOM
440 call .DisableMenuitemFromCSBX
441
442 mov bx, g_MenuitemIdeControllerSerialPort
443 call .DisableMenuitemFromCSBX
444
445 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
446 call Buffers_GetRomvarsValueToAXfromOffsetInBX
447 cmp al, DEVICE_SERIAL_PORT
448 jnz .DisableAllSerial
449
450 mov bx, g_MenuitemIdeControllerSerialCOM
451 call .EnableMenuitemFromCSBX
452
453 mov bx, g_MenuitemIdeControllerSerialBaud
454 call .EnableMenuitemFromCSBX
455
456 mov bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
457 call Buffers_GetRomvarsValueToAXfromOffsetInBX
458 mov bx, g_MenuitemIdeControllerSerialPort
459 cmp al,'x'
460 jz .EnableMenuitemFromCSBX
461 jmp .DisableMenuitemFromCSBX
462.DisableAllSerial:
463 ret
464
465;--------------------------------------------------------------------
466; MENUITEM activation functions (.fnActivate)
467; Parameters:
468; SS:BP: Ptr to MENU
469; Returns:
470; Nothing
471; Corrupts registers:
472; All, except segments
473;--------------------------------------------------------------------
474ALIGN JUMP_ALIGN
475MasterDrive:
476 mov bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
477 jmp SHORT DisplayMasterSlaveMenu
478
479ALIGN JUMP_ALIGN
480SlaveDrive:
481 mov bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
482 ; Fall to DisplayMasterSlaveMenu
483
484ALIGN JUMP_ALIGN
485DisplayMasterSlaveMenu:
486;
487; block mode is not supported on serial drives, disable/enable the option as appropriate
488;
489 push bx
490 mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
491 call Buffers_GetRomvarsValueToAXfromOffsetInBX
492 mov bx, g_MenuitemMasterSlaveBlockModeTransfers
493 cmp al,DEVICE_SERIAL_PORT
494 jz .isSerial
495 or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
496 jmp .isDone
497.isSerial:
498 and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
499.isDone:
500 pop bx
501
502 call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
503 jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility
504
505;------------------------------------------------------------------------------------------
506;
507; Reader/Writer Routines
508;
509; For serial drives, we pack the port number and baud rate into a single byte, and thus
510; we need to take care to properly read/write just the bits we need. In addition, since
511; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
512; default the values stored in both these words when switching in and out of the Serial
513; device choice.
514;
515; Writers:
516; Parameters:
517; AX: Value that the MENUITEM system was interacting with
518; ES:DI: ROMVARS location where the value is to be stored
519; DS:SI: MENUITEM pointer
520; Returns:
521; AX: Value to actually write to ROMVARS
522; Corrupts registers:
523; AX
524;
525; Readers:
526; Parameters:
527; AX: Value read from the ROMVARS location
528; ES:DI: ROMVARS location where the value was just read from
529; DS:SI: MENUITEM pointer
530; Returns:
531; AX: Value that the MENUITEM system will interact with and display
532; Corrupts registers:
533; AX
534;
535ALIGN JUMP_ALIGN
536WriterForXTCFwindow:
537 mov al, ah
538 xor ah, ah
539 ret
540
541ALIGN JUMP_ALIGN
542ReaderForXTCFwindow:
543 mov ah, al
544 xor al, al
545 ret
546
547
548;
549; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are
550; changing in/out of a Serial device (since we use these bytes in radically different ways).
551;
552ALIGN JUMP_ALIGN
553IdeControllerMenu_WriteDevice:
554 push bx
555 push di
556 push di
557 push ax
558
559 ; Note! AL is the choice index, not device code
560 shl ax, 1 ; Selection to device code
561 mov bl, [es:di] ; what is the current Device we are changing from?
562 sub di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort ; Get ready to set the Port addresses
563 cmp al, DEVICE_SERIAL_PORT
564 je SHORT .changingToSerial
565 cmp al, DEVICE_8BIT_JRIDE_ISA
566 je SHORT .ChangingToJrIdeIsa
567 cmp al, DEVICE_8BIT_ADP50L
568 je SHORT .ChangingToADP50L
569
570 ; Restore ports to default values
571 cmp al, DEVICE_8BIT_ATA ; Standard ATA controllers, including 8-bit mode
572 mov ax, DEVICE_ATA_PRIMARY_PORT ; Defaults for 16-bit and better ATA devices
573 mov bx, DEVICE_ATA_PRIMARY_PORTCTRL
574 jbe SHORT .writeNonSerial
575
576 mov ax, DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE and XT-CF devices
577 mov bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
578
579.writeNonSerial:
580 stosw ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
581 xchg bx, ax
582 stosw
583 jmp SHORT .done
584
585.ChangingToJrIdeIsa:
586 mov ah, JRIDE_DEFAULT_SEGMENT_ADDRESS >> 8
587 SKIP2B bx
588
589.ChangingToADP50L:
590 mov ah, ADP50L_DEFAULT_BIOS_SEGMENT_ADDRESS >> 8
591 xor al, al
592 xor bx, bx
593 jmp SHORT .writeNonSerial
594
595.changingToSerial:
596 cmp bl, DEVICE_SERIAL_PORT
597 je SHORT .done ; if we were already serial, nothing to do
598
599 mov BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
600
601 mov al, SERIAL_DEFAULT_COM
602 sub di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
603 call IdeControllerMenu_SerialWriteCOM
604 stosb
605
606.done:
607 pop ax
608 pop di ; IDEVARS.bDevice
609 pop di
610 pop bx
611 ret
612
613;
614; Doesn't modify COM character (unless it is not recognized, which would be an error case),
615; But does update the port address based on COM port selection
616;
617ALIGN JUMP_ALIGN
618IdeControllerMenu_SerialWriteCOM:
619 push ax
620 push bx
621 push si
622
623 mov si,g_rgbChoiceToValueLookupForCOM
624 mov bx,PackedCOMPortAddresses
625
626.loop:
627 mov ah,[bx]
628
629 cmp ah,(SERIAL_DEFAULT_CUSTOM_PORT >> 2)
630 jz .notFound
631
632 cmp al,[si]
633 jz .found
634
635 inc si
636 inc si
637 inc bx
638
639 jmp .loop
640
641.notFound:
642 mov al, 'x'
643
644.found:
645 mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
646
647 pop si
648 pop bx
649 pop ax
650
651 ret
652
653
654;
655; Packed Port (byte) -> Numeric Port (word)
656;
657ALIGN JUMP_ALIGN
658IdeControllerMenu_SerialReadPort:
659 xor ah,ah
660 eSHL_IM ax, 2
661 ret
662
663;
664; Numeric Port (word) -> Packed Port (byte)
665; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
666;
667ALIGN JUMP_ALIGN
668IdeControllerMenu_SerialWritePort:
669 push bx
670 push si
671
672 eSHR_IM ax, 2
673 and al,0feh ; force 8-byte boundary
674
675 mov si,g_rgbChoiceToValueLookupForCOM
676 mov bx,PackedCOMPortAddresses ; loop, looking for port address in known COM address list
677
678.loop:
679 mov ah,[si]
680 cmp ah,'x'
681 jz .found
682
683 cmp al,[bx]
684 jz .found
685
686 inc si
687 inc si
688 inc bx
689
690 jmp .loop
691
692.found:
693 mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
694
695 pop si
696 pop bx
697
698 ret
699
Note: See TracBrowser for help on using the repository browser.