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

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

Changes to Configurator v2:

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