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

Last change on this file since 382 was 376, checked in by gregli@…, 12 years ago

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

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