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
|
---|
21 | SECTION .data
|
---|
22 |
|
---|
23 | ALIGN WORD_ALIGN
|
---|
24 | g_MenupageForIdeControllerMenu:
|
---|
25 | istruc MENUPAGE
|
---|
26 | at MENUPAGE.fnEnter, dw IdeControllerMenu_EnterMenuOrModifyItemVisibility
|
---|
27 | at MENUPAGE.fnBack, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility
|
---|
28 | at MENUPAGE.wMenuitems, dw 11
|
---|
29 | iend
|
---|
30 |
|
---|
31 | g_MenuitemIdeControllerBackToConfigurationMenu:
|
---|
32 | istruc 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
|
---|
39 | iend
|
---|
40 |
|
---|
41 | g_MenuitemIdeControllerMasterDrive:
|
---|
42 | istruc 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
|
---|
49 | iend
|
---|
50 |
|
---|
51 | g_MenuitemIdeControllerSlaveDrive:
|
---|
52 | istruc 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
|
---|
59 | iend
|
---|
60 |
|
---|
61 | g_MenuitemIdeControllerDevice:
|
---|
62 | istruc 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
|
---|
76 | iend
|
---|
77 |
|
---|
78 | g_MenuitemIdeControllerCommandBlockAddress:
|
---|
79 | istruc 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
|
---|
91 | iend
|
---|
92 |
|
---|
93 | g_MenuitemIdeControllerControlBlockAddress:
|
---|
94 | istruc 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
|
---|
106 | iend
|
---|
107 |
|
---|
108 | g_MenuitemIdeControllerSerialCOM:
|
---|
109 | istruc 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
|
---|
123 | iend
|
---|
124 |
|
---|
125 | g_MenuitemIdeControllerSerialPort:
|
---|
126 | istruc 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
|
---|
140 | iend
|
---|
141 |
|
---|
142 | g_MenuitemIdeControllerSerialBaud:
|
---|
143 | istruc 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
|
---|
156 | iend
|
---|
157 |
|
---|
158 | g_MenuitemIdeControllerEnableInterrupt:
|
---|
159 | istruc 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_VISIBLE | 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
|
---|
172 | iend
|
---|
173 |
|
---|
174 | g_MenuitemIdeControllerIdeIRQ:
|
---|
175 | istruc 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
|
---|
187 | iend
|
---|
188 |
|
---|
189 | g_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
|
---|
197 | g_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 |
|
---|
207 | g_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)
|
---|
221 | g_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 |
|
---|
237 | SERIAL_DEFAULT_CUSTOM_PORT EQU 300h ; can't be any of the pre-defined COM values
|
---|
238 |
|
---|
239 | PackedCOMPortAddresses: ; 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)
|
---|
253 | SERIAL_DEFAULT_COM EQU '1'
|
---|
254 |
|
---|
255 | g_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
|
---|
264 | g_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
|
---|
274 | SERIAL_DEFAULT_BAUD EQU ((115200 / 9600) & 0xff)
|
---|
275 |
|
---|
276 | ; Section containing code
|
---|
277 | SECTION .text
|
---|
278 |
|
---|
279 | ;--------------------------------------------------------------------
|
---|
280 | ; IdeControllerMenu_InitializeToIdevarsOffsetInBX
|
---|
281 | ; Parameters:
|
---|
282 | ; SS:BP: Menu handle
|
---|
283 | ; Returns:
|
---|
284 | ; Nothing
|
---|
285 | ; Corrupts registers:
|
---|
286 | ; AX
|
---|
287 | ;--------------------------------------------------------------------
|
---|
288 | ALIGN JUMP_ALIGN
|
---|
289 | IdeControllerMenu_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 | ;--------------------------------------------------------------------
|
---|
330 | ALIGN JUMP_ALIGN
|
---|
331 | IdeControllerMenu_EnterMenuOrModifyItemVisibility:
|
---|
332 | push cs
|
---|
333 | pop ds
|
---|
334 | call .EnableOrDisableIRQ
|
---|
335 | call .EnableOrDisableSerial
|
---|
336 | mov si, g_MenupageForIdeControllerMenu
|
---|
337 | jmp Menupage_ChangeToNewMenupageInDSSI
|
---|
338 |
|
---|
339 | ;--------------------------------------------------------------------
|
---|
340 | ; .EnableOrDisableIRQ
|
---|
341 | ; Parameters:
|
---|
342 | ; SS:BP: Menu handle
|
---|
343 | ; Returns:
|
---|
344 | ; Nothing
|
---|
345 | ; Corrupts registers:
|
---|
346 | ; AX, BX
|
---|
347 | ;--------------------------------------------------------------------
|
---|
348 | ALIGN JUMP_ALIGN
|
---|
349 | .EnableOrDisableIRQ:
|
---|
350 | mov bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
351 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
352 | mov bx, g_MenuitemIdeControllerIdeIRQ
|
---|
353 | test al, al
|
---|
354 | jz SHORT .DisableMenuitemFromCSBX
|
---|
355 | ; Fall to .EnableMenuitemFromCSBX
|
---|
356 |
|
---|
357 | ;--------------------------------------------------------------------
|
---|
358 | ; .EnableMenuitemFromCSBX
|
---|
359 | ; .DisableMenuitemFromCSBX
|
---|
360 | ; Parameters:
|
---|
361 | ; CS:BX: Ptr to MENUITEM
|
---|
362 | ; Returns:
|
---|
363 | ; Nothing
|
---|
364 | ; Corrupts registers:
|
---|
365 | ; Nothing
|
---|
366 | ;--------------------------------------------------------------------
|
---|
367 | ALIGN JUMP_ALIGN
|
---|
368 | .EnableMenuitemFromCSBX:
|
---|
369 | or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
370 | ret
|
---|
371 |
|
---|
372 | ALIGN JUMP_ALIGN
|
---|
373 | .DisableMenuitemFromCSBX:
|
---|
374 | and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
|
---|
375 | ret
|
---|
376 |
|
---|
377 | .EnableOrDisableSerial:
|
---|
378 | mov bx, g_MenuitemIdeControllerCommandBlockAddress
|
---|
379 | call .DisableMenuitemFromCSBX
|
---|
380 |
|
---|
381 | mov bx, g_MenuitemIdeControllerControlBlockAddress
|
---|
382 | call .DisableMenuitemFromCSBX
|
---|
383 |
|
---|
384 | mov bx, g_MenuitemIdeControllerEnableInterrupt
|
---|
385 | call .DisableMenuitemFromCSBX
|
---|
386 |
|
---|
387 | mov bx, g_MenuitemIdeControllerSerialBaud
|
---|
388 | call .DisableMenuitemFromCSBX
|
---|
389 |
|
---|
390 | mov bx, g_MenuitemIdeControllerSerialCOM
|
---|
391 | call .DisableMenuitemFromCSBX
|
---|
392 |
|
---|
393 | mov bx, g_MenuitemIdeControllerSerialPort
|
---|
394 | call .DisableMenuitemFromCSBX
|
---|
395 |
|
---|
396 | mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
397 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
398 | cmp al,DEVICE_SERIAL_PORT
|
---|
399 | jnz .DisableAllSerial
|
---|
400 |
|
---|
401 | mov bx, g_MenuitemIdeControllerSerialCOM
|
---|
402 | call .EnableMenuitemFromCSBX
|
---|
403 |
|
---|
404 | mov bx, g_MenuitemIdeControllerSerialBaud
|
---|
405 | call .EnableMenuitemFromCSBX
|
---|
406 |
|
---|
407 | mov bx, [cs:g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
408 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
409 | mov bx, g_MenuitemIdeControllerSerialPort
|
---|
410 | cmp al,'x'
|
---|
411 | jz .EnableMenuitemFromCSBX
|
---|
412 | jmp .DisableMenuitemFromCSBX
|
---|
413 |
|
---|
414 | .DisableAllSerial:
|
---|
415 |
|
---|
416 | mov bx, g_MenuitemIdeControllerCommandBlockAddress
|
---|
417 | call .EnableMenuitemFromCSBX
|
---|
418 |
|
---|
419 | mov bx, g_MenuitemIdeControllerControlBlockAddress
|
---|
420 | call .EnableMenuitemFromCSBX
|
---|
421 |
|
---|
422 | mov bx, g_MenuitemIdeControllerEnableInterrupt
|
---|
423 | call .EnableMenuitemFromCSBX
|
---|
424 |
|
---|
425 | ret
|
---|
426 |
|
---|
427 | ;--------------------------------------------------------------------
|
---|
428 | ; MENUITEM activation functions (.fnActivate)
|
---|
429 | ; Parameters:
|
---|
430 | ; SS:BP: Ptr to MENU
|
---|
431 | ; Returns:
|
---|
432 | ; Nothing
|
---|
433 | ; Corrupts registers:
|
---|
434 | ; All, except segments
|
---|
435 | ;--------------------------------------------------------------------
|
---|
436 | ALIGN JUMP_ALIGN
|
---|
437 | MasterDrive:
|
---|
438 | mov bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
439 | jmp SHORT DisplayMasterSlaveMenu
|
---|
440 |
|
---|
441 | ALIGN JUMP_ALIGN
|
---|
442 | SlaveDrive:
|
---|
443 | mov bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
444 | ; Fall to DisplayMasterSlaveMenu
|
---|
445 |
|
---|
446 | ALIGN JUMP_ALIGN
|
---|
447 | DisplayMasterSlaveMenu:
|
---|
448 | ;
|
---|
449 | ; block mode is not supported on serial drives, disable/enable the option as appropriate
|
---|
450 | ;
|
---|
451 | push bx
|
---|
452 | mov bx, [cs:g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
453 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
454 | mov bx, g_MenuitemMasterSlaveBlockModeTransfers
|
---|
455 | cmp al,DEVICE_SERIAL_PORT
|
---|
456 | jz .isSerial
|
---|
457 | or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
458 | jmp .isDone
|
---|
459 | .isSerial:
|
---|
460 | and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
|
---|
461 | .isDone:
|
---|
462 | pop bx
|
---|
463 |
|
---|
464 | call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
|
---|
465 | jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility
|
---|
466 |
|
---|
467 | ;------------------------------------------------------------------------------------------
|
---|
468 | ;
|
---|
469 | ; Reader/Writer Routines
|
---|
470 | ;
|
---|
471 | ; For serial drives, we pack the port number and baud rate into a single byte, and thus
|
---|
472 | ; we need to take care to properly read/write just the bits we need. In addition, since
|
---|
473 | ; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
|
---|
474 | ; default the values stored in both these words when switching in and out of the Serial
|
---|
475 | ; device choice.
|
---|
476 | ;
|
---|
477 | ; Writers:
|
---|
478 | ; Parameters:
|
---|
479 | ; AX: Value that the MENUITEM system was interacting with
|
---|
480 | ; ES:DI: ROMVARS location where the value is to be stored
|
---|
481 | ; DS:SI: MENUITEM pointer
|
---|
482 | ; Returns:
|
---|
483 | ; AX: Value to actually write to ROMVARS
|
---|
484 | ; Corrupts registers:
|
---|
485 | ; AX
|
---|
486 | ;
|
---|
487 | ; Readers:
|
---|
488 | ; Parameters:
|
---|
489 | ; AX: Value read from the ROMVARS location
|
---|
490 | ; ES:DI: ROMVARS location where the value was just read from
|
---|
491 | ; DS:SI: MENUITEM pointer
|
---|
492 | ; Returns:
|
---|
493 | ; AX: Value that the MENUITEM system will interact with and display
|
---|
494 | ; Corrupts registers:
|
---|
495 | ; AX
|
---|
496 | ;
|
---|
497 |
|
---|
498 | ;
|
---|
499 | ; No change to Device byte, but use this opportunity to change defaults stored in wPort and wPortCtrl if we are
|
---|
500 | ; changing in/out of a Serial device (since we use these bytes in radically different ways).
|
---|
501 | ;
|
---|
502 | ALIGN JUMP_ALIGN
|
---|
503 | IdeControllerMenu_WriteDevice:
|
---|
504 | push ax
|
---|
505 | push bx
|
---|
506 | push di
|
---|
507 |
|
---|
508 | mov bl,[es:di] ; what is the current Device?
|
---|
509 |
|
---|
510 | add di,IDEVARS.wPort - IDEVARS.bDevice ; Get ready to set the Port addresses
|
---|
511 |
|
---|
512 | cmp al,DEVICE_SERIAL_PORT
|
---|
513 | jz .changingToSerial
|
---|
514 |
|
---|
515 | cmp bl,DEVICE_SERIAL_PORT
|
---|
516 | jnz .done ; if we weren't Serial before, nothing to do
|
---|
517 |
|
---|
518 | .changingFromSerial:
|
---|
519 | cmp al,DEVICE_16BIT_ATA
|
---|
520 |
|
---|
521 | mov ax,DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE devices
|
---|
522 | mov bx,DEVICE_XTIDE_DEFAULT_PORTCTRL
|
---|
523 |
|
---|
524 | jb .writeNonSerial
|
---|
525 |
|
---|
526 | mov ax, DEVICE_ATA_PRIMARY_PORT ; Defaults for 16-bit and better ATA devices
|
---|
527 | mov bx, DEVICE_ATA_PRIMARY_PORTCTRL
|
---|
528 |
|
---|
529 | .writeNonSerial:
|
---|
530 | stosw ; Store defaults in IDEVARS.wPort and IDEVARS.wPortCtrl
|
---|
531 | xchg bx, ax
|
---|
532 | stosw
|
---|
533 |
|
---|
534 | jmp .done
|
---|
535 |
|
---|
536 | .changingToSerial:
|
---|
537 | cmp bl,DEVICE_SERIAL_PORT
|
---|
538 | jz .done ; if we were already serial, nothing to do
|
---|
539 |
|
---|
540 | mov byte [es:di+IDEVARS.bSerialBaud-IDEVARS.wPort],SERIAL_DEFAULT_BAUD
|
---|
541 |
|
---|
542 | mov al,SERIAL_DEFAULT_COM
|
---|
543 | add di,IDEVARS.bSerialCOMPortChar-IDEVARS.wPort
|
---|
544 | call IdeControllerMenu_SerialWriteCOM
|
---|
545 | stosb
|
---|
546 |
|
---|
547 | .done:
|
---|
548 | pop di
|
---|
549 | pop bx
|
---|
550 | pop ax
|
---|
551 |
|
---|
552 | ret
|
---|
553 |
|
---|
554 | ;
|
---|
555 | ; Doesn't modify COM character (unless it is not recognized, which would be an error case),
|
---|
556 | ; But does update the port address based on COM port selection
|
---|
557 | ;
|
---|
558 | ALIGN JUMP_ALIGN
|
---|
559 | IdeControllerMenu_SerialWriteCOM:
|
---|
560 | push ax
|
---|
561 | push bx
|
---|
562 | push si
|
---|
563 |
|
---|
564 | mov si,g_rgbChoiceToValueLookupForCOM
|
---|
565 | mov bx,PackedCOMPortAddresses
|
---|
566 |
|
---|
567 | .loop:
|
---|
568 | mov ah,[bx]
|
---|
569 |
|
---|
570 | cmp ah,(SERIAL_DEFAULT_CUSTOM_PORT >> 2)
|
---|
571 | jz .notFound
|
---|
572 |
|
---|
573 | cmp al,[si]
|
---|
574 | jz .found
|
---|
575 |
|
---|
576 | inc si
|
---|
577 | inc si
|
---|
578 | inc bx
|
---|
579 |
|
---|
580 | jmp .loop
|
---|
581 |
|
---|
582 | .notFound:
|
---|
583 | mov al, 'x'
|
---|
584 |
|
---|
585 | .found:
|
---|
586 | mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
|
---|
587 |
|
---|
588 | pop si
|
---|
589 | pop bx
|
---|
590 | pop ax
|
---|
591 |
|
---|
592 | ret
|
---|
593 |
|
---|
594 |
|
---|
595 | ;
|
---|
596 | ; Packed Port (byte) -> Numeric Port (word)
|
---|
597 | ;
|
---|
598 | ALIGN JUMP_ALIGN
|
---|
599 | IdeControllerMenu_SerialReadPort:
|
---|
600 | xor ah,ah
|
---|
601 | eSHL_IM ax, 2
|
---|
602 | ret
|
---|
603 |
|
---|
604 | ;
|
---|
605 | ; Numeric Port (word) -> Packed Port (byte)
|
---|
606 | ; And convert from Custom to a defined COM port if we match one of the pre-defined COM port numbers
|
---|
607 | ;
|
---|
608 | ALIGN JUMP_ALIGN
|
---|
609 | IdeControllerMenu_SerialWritePort:
|
---|
610 | push bx
|
---|
611 | push si
|
---|
612 |
|
---|
613 | eSHR_IM ax, 2
|
---|
614 | and al,0feh ; force 8-byte boundary
|
---|
615 |
|
---|
616 | mov si,g_rgbChoiceToValueLookupForCOM
|
---|
617 | mov bx,PackedCOMPortAddresses ; loop, looking for port address in known COM address list
|
---|
618 |
|
---|
619 | .loop:
|
---|
620 | mov ah,[si]
|
---|
621 | cmp ah,'x'
|
---|
622 | jz .found
|
---|
623 |
|
---|
624 | cmp al,[bx]
|
---|
625 | jz .found
|
---|
626 |
|
---|
627 | inc si
|
---|
628 | inc si
|
---|
629 | inc bx
|
---|
630 |
|
---|
631 | jmp .loop
|
---|
632 |
|
---|
633 | .found:
|
---|
634 | mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
|
---|
635 |
|
---|
636 | pop si
|
---|
637 | pop bx
|
---|
638 |
|
---|
639 | ret
|
---|
640 |
|
---|