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-2023 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 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
|
---|
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_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_16BIT_ATA
|
---|
191 | dw DEVICE_32BIT_ATA
|
---|
192 | dw DEVICE_8BIT_ATA
|
---|
193 | dw DEVICE_8BIT_XTIDE_REV1
|
---|
194 | dw DEVICE_8BIT_XTIDE_REV2
|
---|
195 | dw DEVICE_8BIT_XTIDE_REV2_OLIVETTI
|
---|
196 | dw DEVICE_8BIT_XTCF_PIO8
|
---|
197 | dw DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD
|
---|
198 | dw DEVICE_8BIT_XTCF_PIO16_WITH_BIU_OFFLOAD
|
---|
199 | dw DEVICE_8BIT_XTCF_DMA
|
---|
200 | dw DEVICE_8BIT_JRIDE_ISA
|
---|
201 | dw DEVICE_8BIT_ADP50L
|
---|
202 | dw DEVICE_SERIAL_PORT
|
---|
203 | g_rgszValueToStringLookupForDevice:
|
---|
204 | dw g_szValueCfgDevice16b
|
---|
205 | dw g_szValueCfgDevice32b
|
---|
206 | dw g_szValueCfgDevice8b
|
---|
207 | dw g_szValueCfgDeviceRev1
|
---|
208 | dw g_szValueCfgDeviceRev2
|
---|
209 | dw g_szValueCfgDeviceRev2Olivetti
|
---|
210 | dw g_szValueCfgDeviceXTCFPio8
|
---|
211 | dw g_szValueCfgDeviceXTCFPio8WithBIUOffload
|
---|
212 | dw g_szValueCfgDeviceXTCFPio16WithBIUOffload
|
---|
213 | dw g_szValueCfgDeviceXTCFDMA
|
---|
214 | dw g_szValueCfgDeviceJrIdeIsa
|
---|
215 | dw g_szValueCfgDeviceADP50L
|
---|
216 | dw g_szValueCfgDeviceSerial
|
---|
217 |
|
---|
218 | g_rgbChoiceToValueLookupForCOM:
|
---|
219 | dw '1'
|
---|
220 | dw '2'
|
---|
221 | dw '3'
|
---|
222 | dw '4'
|
---|
223 | dw '5'
|
---|
224 | dw '6'
|
---|
225 | dw '7'
|
---|
226 | dw '8'
|
---|
227 | dw '9'
|
---|
228 | dw 'A'
|
---|
229 | dw 'B'
|
---|
230 | dw 'C'
|
---|
231 | dw 'x' ; must be last entry (see reader/writer routines)
|
---|
232 | g_rgszChoiceToStringLookupForCOM:
|
---|
233 | dw g_szValueCfgCOM1
|
---|
234 | dw g_szValueCfgCOM2
|
---|
235 | dw g_szValueCfgCOM3
|
---|
236 | dw g_szValueCfgCOM4
|
---|
237 | dw g_szValueCfgCOM5
|
---|
238 | dw g_szValueCfgCOM6
|
---|
239 | dw g_szValueCfgCOM7
|
---|
240 | dw g_szValueCfgCOM8
|
---|
241 | dw g_szValueCfgCOM9
|
---|
242 | dw g_szValueCfgCOMA
|
---|
243 | dw g_szValueCfgCOMB
|
---|
244 | dw g_szValueCfgCOMC
|
---|
245 | dw g_szValueCfgCOMx
|
---|
246 | dw NULL
|
---|
247 |
|
---|
248 | SERIAL_DEFAULT_CUSTOM_PORT EQU 300h ; can't be any of the pre-defined COM values
|
---|
249 | SERIAL_DEFAULT_COM EQU '1'
|
---|
250 | SERIAL_DEFAULT_BAUD EQU ((115200 / 9600) & 0xff)
|
---|
251 |
|
---|
252 | PackedCOMPortAddresses: ; COM1 - COMC (or COM12)
|
---|
253 | db SERIAL_COM1_IOADDRESS >> 2
|
---|
254 | db SERIAL_COM2_IOADDRESS >> 2
|
---|
255 | db SERIAL_COM3_IOADDRESS >> 2
|
---|
256 | db SERIAL_COM4_IOADDRESS >> 2
|
---|
257 | db SERIAL_COM5_IOADDRESS >> 2
|
---|
258 | db SERIAL_COM6_IOADDRESS >> 2
|
---|
259 | db SERIAL_COM7_IOADDRESS >> 2
|
---|
260 | db SERIAL_COM8_IOADDRESS >> 2
|
---|
261 | db SERIAL_COM9_IOADDRESS >> 2
|
---|
262 | db SERIAL_COMA_IOADDRESS >> 2
|
---|
263 | db SERIAL_COMB_IOADDRESS >> 2
|
---|
264 | db SERIAL_COMC_IOADDRESS >> 2
|
---|
265 | db SERIAL_DEFAULT_CUSTOM_PORT >> 2 ; must be last entry (see reader/writer routines)
|
---|
266 |
|
---|
267 | g_rgbChoiceToValueLookupForBaud:
|
---|
268 | dw (115200 / 115200) & 0xff
|
---|
269 | dw (115200 / 57600) & 0xff
|
---|
270 | dw (115200 / 38400) & 0xff
|
---|
271 | dw (115200 / 28800) & 0xff
|
---|
272 | dw (115200 / 19200) & 0xff
|
---|
273 | dw (115200 / 9600) & 0xff
|
---|
274 | dw (115200 / 4800) & 0xff
|
---|
275 | dw (115200 / 2400) & 0xff
|
---|
276 | g_rgszChoiceToStringLookupForBaud:
|
---|
277 | dw g_szValueCfgBaud115_2
|
---|
278 | dw g_szValueCfgBaud57_6
|
---|
279 | dw g_szValueCfgBaud38_4
|
---|
280 | dw g_szValueCfgBaud28_8
|
---|
281 | dw g_szValueCfgBaud19_2
|
---|
282 | dw g_szValueCfgBaud9600
|
---|
283 | dw g_szValueCfgBaud4800
|
---|
284 | dw g_szValueCfgBaud2400
|
---|
285 | dw NULL
|
---|
286 |
|
---|
287 | ; Section containing code
|
---|
288 | SECTION .text
|
---|
289 |
|
---|
290 | ;--------------------------------------------------------------------
|
---|
291 | ; IdeControllerMenu_InitializeToIdevarsOffsetInBX
|
---|
292 | ; Parameters:
|
---|
293 | ; SS:BP: Menu handle
|
---|
294 | ; Returns:
|
---|
295 | ; Nothing
|
---|
296 | ; Corrupts registers:
|
---|
297 | ; AX
|
---|
298 | ;--------------------------------------------------------------------
|
---|
299 | ALIGN JUMP_ALIGN
|
---|
300 | IdeControllerMenu_InitializeToIdevarsOffsetInBX:
|
---|
301 | lea ax, [bx+IDEVARS.drvParamsMaster]
|
---|
302 | mov [g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
|
---|
303 |
|
---|
304 | lea ax, [bx+IDEVARS.drvParamsSlave]
|
---|
305 | mov [g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
|
---|
306 |
|
---|
307 | lea ax, [bx+IDEVARS.bDevice]
|
---|
308 | mov [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
|
---|
309 |
|
---|
310 | %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
311 | %if IDEVARS.wBasePort = 0
|
---|
312 | mov [g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], bx
|
---|
313 | %else
|
---|
314 | lea ax, [bx+IDEVARS.wBasePort]
|
---|
315 | mov [g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
|
---|
316 | %endif
|
---|
317 |
|
---|
318 | %if IDEVARS.bSerialPort = 0
|
---|
319 | mov [g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], bx
|
---|
320 | %else
|
---|
321 | lea ax, [bx+IDEVARS.bSerialPort]
|
---|
322 | mov [g_MenuitemIdeControllerSerialPort+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
|
---|
323 | %endif
|
---|
324 | %endif
|
---|
325 |
|
---|
326 | lea ax, [bx+IDEVARS.bSerialBaud]
|
---|
327 | mov [g_MenuitemIdeControllerSerialBaud+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
|
---|
328 |
|
---|
329 | lea ax, [bx+IDEVARS.wControlBlockPort]
|
---|
330 | mov [g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
|
---|
331 |
|
---|
332 | lea ax, [bx+IDEVARS.bSerialCOMPortChar]
|
---|
333 | mov [g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
|
---|
334 |
|
---|
335 | lea ax, [bx+IDEVARS.bIRQ]
|
---|
336 | mov [g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
|
---|
337 | mov [g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
|
---|
338 |
|
---|
339 | ret
|
---|
340 |
|
---|
341 |
|
---|
342 | ;--------------------------------------------------------------------
|
---|
343 | ; IdeControllerMenu_EnterMenuOrModifyItemVisibility
|
---|
344 | ; Parameters:
|
---|
345 | ; SS:BP: Menu handle
|
---|
346 | ; Returns:
|
---|
347 | ; Nothing
|
---|
348 | ; Corrupts registers:
|
---|
349 | ; All, except BP
|
---|
350 | ;--------------------------------------------------------------------
|
---|
351 | ALIGN JUMP_ALIGN
|
---|
352 | IdeControllerMenu_EnterMenuOrModifyItemVisibility:
|
---|
353 | push cs
|
---|
354 | pop ds
|
---|
355 | call .EnableOrDisableCommandBlockPort
|
---|
356 | call .EnableOrDisableControlBlockPort
|
---|
357 | call .DisableIRQchannelSelection
|
---|
358 | call .EnableOrDisableEnableInterrupt
|
---|
359 | call .EnableOrDisableSerial
|
---|
360 | mov si, g_MenupageForIdeControllerMenu
|
---|
361 | jmp Menupage_ChangeToNewMenupageInDSSI
|
---|
362 |
|
---|
363 |
|
---|
364 | ;--------------------------------------------------------------------
|
---|
365 | ; .EnableOrDisableCommandBlockPort
|
---|
366 | ; Parameters:
|
---|
367 | ; SS:BP: Menu handle
|
---|
368 | ; Returns:
|
---|
369 | ; Nothing
|
---|
370 | ; Corrupts registers:
|
---|
371 | ; AX, BX
|
---|
372 | ;--------------------------------------------------------------------
|
---|
373 | ALIGN JUMP_ALIGN
|
---|
374 | .EnableOrDisableCommandBlockPort:
|
---|
375 | mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
376 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
377 | mov bx, g_MenuitemIdeControllerCommandBlockAddress
|
---|
378 | cmp al, DEVICE_SERIAL_PORT
|
---|
379 | je SHORT .DisableMenuitemFromCSBX
|
---|
380 | jmp SHORT .EnableMenuitemFromCSBX
|
---|
381 |
|
---|
382 |
|
---|
383 | ;--------------------------------------------------------------------
|
---|
384 | ; .EnableOrDisableControlBlockPort
|
---|
385 | ; Parameters:
|
---|
386 | ; SS:BP: Menu handle
|
---|
387 | ; Returns:
|
---|
388 | ; Nothing
|
---|
389 | ; Corrupts registers:
|
---|
390 | ; AX, BX
|
---|
391 | ;--------------------------------------------------------------------
|
---|
392 | ALIGN JUMP_ALIGN
|
---|
393 | .EnableOrDisableControlBlockPort:
|
---|
394 | mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
395 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
396 | mov bx, g_MenuitemIdeControllerControlBlockAddress
|
---|
397 | cmp al, DEVICE_8BIT_XTCF_PIO8
|
---|
398 | jb SHORT .EnableMenuitemFromCSBX ; Not needed for XT-CF, JR-IDE/ISA and ADP50L
|
---|
399 | jmp SHORT .DisableMenuitemFromCSBX
|
---|
400 |
|
---|
401 |
|
---|
402 | ;--------------------------------------------------------------------
|
---|
403 | ; .EnableOrDisableEnableInterrupt
|
---|
404 | ; Parameters:
|
---|
405 | ; SS:BP: Menu handle
|
---|
406 | ; Returns:
|
---|
407 | ; Nothing
|
---|
408 | ; Corrupts registers:
|
---|
409 | ; AX, BX
|
---|
410 | ;--------------------------------------------------------------------
|
---|
411 | ALIGN JUMP_ALIGN
|
---|
412 | .EnableOrDisableEnableInterrupt:
|
---|
413 | call Buffers_GetRomvarsFlagsToAX
|
---|
414 | mov bx, g_MenuitemIdeControllerEnableInterrupt
|
---|
415 | test ax, FLG_ROMVARS_MODULE_IRQ
|
---|
416 | jz SHORT .DisableMenuitemFromCSBX
|
---|
417 |
|
---|
418 | mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
419 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
420 | mov bx, g_MenuitemIdeControllerEnableInterrupt
|
---|
421 | cmp al, DEVICE_8BIT_XTCF_PIO8
|
---|
422 | jae SHORT .DisableMenuitemFromCSBX
|
---|
423 |
|
---|
424 | call EnableMenuitemFromCSBX
|
---|
425 | ; Fall to .EnableOrDisableIRQchannelSelection
|
---|
426 |
|
---|
427 | ;--------------------------------------------------------------------
|
---|
428 | ; .EnableOrDisableIRQchannelSelection
|
---|
429 | ; Parameters:
|
---|
430 | ; SS:BP: Menu handle
|
---|
431 | ; Returns:
|
---|
432 | ; Nothing
|
---|
433 | ; Corrupts registers:
|
---|
434 | ; AX, BX
|
---|
435 | ;--------------------------------------------------------------------
|
---|
436 | ALIGN JUMP_ALIGN
|
---|
437 | .EnableOrDisableIRQchannelSelection:
|
---|
438 | mov bx, [g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
439 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
440 | mov bx, g_MenuitemIdeControllerIdeIRQ
|
---|
441 | test al, al
|
---|
442 | jnz SHORT .EnableMenuitemFromCSBX
|
---|
443 | .DisableIRQchannelSelection:
|
---|
444 | mov bx, g_MenuitemIdeControllerIdeIRQ
|
---|
445 | ; Fall to .DisableMenuitemFromCSBX
|
---|
446 |
|
---|
447 |
|
---|
448 | ;--------------------------------------------------------------------
|
---|
449 | ; .DisableMenuitemFromCSBX
|
---|
450 | ; .EnableMenuitemFromCSBX
|
---|
451 | ; Parameters:
|
---|
452 | ; CS:BX: Ptr to MENUITEM
|
---|
453 | ; Returns:
|
---|
454 | ; Nothing
|
---|
455 | ; Corrupts registers:
|
---|
456 | ; Nothing
|
---|
457 | ;--------------------------------------------------------------------
|
---|
458 | ALIGN JUMP_ALIGN
|
---|
459 | .DisableMenuitemFromCSBX:
|
---|
460 | jmp DisableMenuitemFromCSBX
|
---|
461 |
|
---|
462 | ALIGN JUMP_ALIGN
|
---|
463 | .EnableMenuitemFromCSBX:
|
---|
464 | jmp EnableMenuitemFromCSBX
|
---|
465 |
|
---|
466 |
|
---|
467 | ;--------------------------------------------------------------------
|
---|
468 | ; .EnableOrDisableSerial
|
---|
469 | ; Parameters:
|
---|
470 | ; SS:BP: Menu handle
|
---|
471 | ; Returns:
|
---|
472 | ; Nothing
|
---|
473 | ; Corrupts registers:
|
---|
474 | ; AX, BX
|
---|
475 | ;--------------------------------------------------------------------
|
---|
476 | .EnableOrDisableSerial:
|
---|
477 | mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
478 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
479 | cmp al, DEVICE_SERIAL_PORT
|
---|
480 | mov ax, DisableMenuitemFromCSBX
|
---|
481 | jne SHORT .DisableSerialControllerMenuitems
|
---|
482 | mov ax, EnableMenuitemFromCSBX
|
---|
483 | call .EnableSerialControllerMenuitems
|
---|
484 | mov bx, [g_MenuitemIdeControllerSerialCOM+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
485 | call Buffers_GetRomvarsValueToAXfromOffsetInBX
|
---|
486 | cmp al, 'x'
|
---|
487 | mov ax, DisableMenuitemFromCSBX
|
---|
488 | jne SHORT .DisableCustomPortMenuitem
|
---|
489 | ret
|
---|
490 | .DisableSerialControllerMenuitems:
|
---|
491 | .EnableSerialControllerMenuitems:
|
---|
492 | mov bx, g_MenuitemIdeControllerSerialCOM
|
---|
493 | call ax
|
---|
494 | mov bx, g_MenuitemIdeControllerSerialBaud
|
---|
495 | call ax
|
---|
496 | .DisableCustomPortMenuitem:
|
---|
497 | mov bx, g_MenuitemIdeControllerSerialPort
|
---|
498 | jmp ax
|
---|
499 |
|
---|
500 |
|
---|
501 | ;--------------------------------------------------------------------
|
---|
502 | ; MENUITEM activation functions (.fnActivate)
|
---|
503 | ; Parameters:
|
---|
504 | ; SS:BP: Ptr to MENU
|
---|
505 | ; Returns:
|
---|
506 | ; Nothing
|
---|
507 | ; Corrupts registers:
|
---|
508 | ; All, except segments
|
---|
509 | ;--------------------------------------------------------------------
|
---|
510 | ALIGN JUMP_ALIGN
|
---|
511 | MasterDrive:
|
---|
512 | mov bx, g_MenuitemMasterSlaveDisableDetection
|
---|
513 | call DisableMenuitemFromCSBX
|
---|
514 | mov bx, [g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
515 | jmp SHORT DisplayMasterSlaveMenu
|
---|
516 |
|
---|
517 | ALIGN JUMP_ALIGN
|
---|
518 | SlaveDrive:
|
---|
519 | mov bx, g_MenuitemMasterSlaveDisableDetection
|
---|
520 | call EnableMenuitemFromCSBX
|
---|
521 | mov bx, [g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
|
---|
522 | ; Fall to DisplayMasterSlaveMenu
|
---|
523 |
|
---|
524 | DisplayMasterSlaveMenu:
|
---|
525 | call MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
|
---|
526 | jmp MasterSlaveMenu_EnterMenuOrModifyItemVisibility
|
---|
527 |
|
---|
528 |
|
---|
529 | ;--------------------------------------------------------------------
|
---|
530 | ; IdeControllerMenu_WriteDevice
|
---|
531 | ;
|
---|
532 | ; Sets default values to ports and other device dependent stuff
|
---|
533 | ;
|
---|
534 | ; Parameters:
|
---|
535 | ; AX: IDE controller/Device type menu choice index
|
---|
536 | ; ES:DI: Ptr to IDEVARS.bDevice
|
---|
537 | ; DS:SI: MENUITEM pointer
|
---|
538 | ; Returns:
|
---|
539 | ; AX: IDE controller/Device type menu choice index
|
---|
540 | ; Corrupts registers:
|
---|
541 | ; BX, DX
|
---|
542 | ;--------------------------------------------------------------------
|
---|
543 | ALIGN JUMP_ALIGN
|
---|
544 | IdeControllerMenu_WriteDevice:
|
---|
545 | push di
|
---|
546 | push ax
|
---|
547 |
|
---|
548 | mov bl, [es:di] ; What is the current Device we are changing from?
|
---|
549 | sub di, BYTE IDEVARS.bDevice - IDEVARS.wBasePort ; Get ready to set the Port addresses
|
---|
550 |
|
---|
551 | ; Note! AL is the choice index, not device code
|
---|
552 | eSHL_IM al, 1 ; Selection to device code
|
---|
553 | jz SHORT .StandardIdeDevice ; DEVICE_16BIT_ATA
|
---|
554 |
|
---|
555 | cmp al, DEVICE_8BIT_ATA
|
---|
556 | ja SHORT .NotStandardIdeDevice
|
---|
557 | jb SHORT .AdvancedAtaDevice ; DEVICE_32BIT_ATA
|
---|
558 | test BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE
|
---|
559 | jmp SHORT .CheckZF
|
---|
560 |
|
---|
561 | .AdvancedAtaDevice:
|
---|
562 | test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_ADVANCED_ATA >> 8
|
---|
563 | .CheckZF:
|
---|
564 | jz SHORT .SupportForDeviceNotAvailable
|
---|
565 |
|
---|
566 | ; Standard ATA controllers, including 8-bit mode
|
---|
567 | .StandardIdeDevice:
|
---|
568 | ; Enable IRQ for standard ATA, but only if MODULE_IRQ is included
|
---|
569 |
|
---|
570 | lea ax, [di-ROMVARS.ideVars0+IDEVARS.wBasePort]
|
---|
571 | mov bl, IDEVARS_size
|
---|
572 | div bl
|
---|
573 |
|
---|
574 | test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_IRQ >> 8
|
---|
575 | jz SHORT .DoNotEnableIrq
|
---|
576 |
|
---|
577 | mov bx, .rgbDefaultIrqForStdIde ; Enable interrupt for primary and secondary IDE
|
---|
578 | push ax
|
---|
579 | xlat
|
---|
580 | mov [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], al
|
---|
581 | pop ax
|
---|
582 |
|
---|
583 | .DoNotEnableIrq:
|
---|
584 | mov bx, .rgbLowByteOfStdIdeInterfacePorts
|
---|
585 | xlat
|
---|
586 | mov ah, 1 ; DEVICE_ATA_*_PORT >> 8
|
---|
587 | mov bh, 3 ; DEVICE_ATA_*_PORTCTRL >> 8
|
---|
588 | mov bl, al
|
---|
589 | jmp SHORT .WriteNonSerial
|
---|
590 |
|
---|
591 | .rgbLowByteOfStdIdeInterfacePorts: ; Defaults for 16-bit and better ATA devices
|
---|
592 | db DEVICE_ATA_PRIMARY_PORT & 0FFh
|
---|
593 | db DEVICE_ATA_SECONDARY_PORT & 0FFh
|
---|
594 | db DEVICE_ATA_TERTIARY_PORT & 0FFh
|
---|
595 | db DEVICE_ATA_QUATERNARY_PORT & 0FFh
|
---|
596 | .rgbDefaultIrqForStdIde:
|
---|
597 | db 14
|
---|
598 | db 15
|
---|
599 | db 0 ; These can vary so lets disable by default
|
---|
600 | db 0
|
---|
601 |
|
---|
602 | .NotStandardIdeDevice:
|
---|
603 | cmp al, DEVICE_SERIAL_PORT
|
---|
604 | jb SHORT .NotSerialDevice
|
---|
605 | test BYTE [es:ROMVARS.wFlags+1], FLG_ROMVARS_MODULE_SERIAL >> 8
|
---|
606 | jnz SHORT .ChangingToSerial
|
---|
607 |
|
---|
608 | .SupportForDeviceNotAvailable:
|
---|
609 | mov dx, g_szUnsupportedDevice
|
---|
610 | call Dialogs_DisplayErrorFromCSDX
|
---|
611 |
|
---|
612 | ; Restore device type to the previous value
|
---|
613 | pop ax ; Get choice index from stack
|
---|
614 | mov al, bl ; Previous device type to AL
|
---|
615 | shr al, 1 ; Device code to choice index
|
---|
616 | pop di
|
---|
617 | ret
|
---|
618 |
|
---|
619 | .NotSerialDevice:
|
---|
620 | ; Remaining device types all require MODULE_8BIT_IDE or MODULE_8BIT_IDE_ADVANCED
|
---|
621 | test BYTE [es:ROMVARS.wFlags], FLG_ROMVARS_MODULE_8BIT_IDE | FLG_ROMVARS_MODULE_8BIT_IDE_ADVANCED
|
---|
622 | jz SHORT .SupportForDeviceNotAvailable
|
---|
623 |
|
---|
624 | ; We know MODULE_8BIT_IDE is included
|
---|
625 | lahf ; Save the PF
|
---|
626 | cmp al, DEVICE_8BIT_XTIDE_REV2_OLIVETTI
|
---|
627 | jbe SHORT .ChangingToXTIDEorXTCF
|
---|
628 | sahf ; Restore the PF
|
---|
629 | jpo SHORT .SupportForDeviceNotAvailable ; Jump if no MODULE_8BIT_IDE_ADVANCED
|
---|
630 | cmp al, DEVICE_8BIT_JRIDE_ISA
|
---|
631 | je SHORT .ChangingToJrIdeIsa
|
---|
632 | cmp al, DEVICE_8BIT_ADP50L
|
---|
633 | je SHORT .ChangingToADP50L
|
---|
634 |
|
---|
635 | .ChangingToXTIDEorXTCF:
|
---|
636 | mov ax, DEVICE_XTIDE_DEFAULT_PORT ; Defaults for 8-bit XTIDE and XT-CF devices
|
---|
637 | mov bx, DEVICE_XTIDE_DEFAULT_PORTCTRL
|
---|
638 |
|
---|
639 | ; XT-CF does not support IRQ so it must be disabled (IRQ setting is not visible for XT-CF)
|
---|
640 | ; XTIDE does not use IRQs by default
|
---|
641 | mov BYTE [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], 0
|
---|
642 |
|
---|
643 | .WriteNonSerial:
|
---|
644 | stosw ; Store defaults in IDEVARS.wBasePort and IDEVARS.wBasePortCtrl
|
---|
645 | xchg bx, ax
|
---|
646 | stosw
|
---|
647 | jmp SHORT .Done
|
---|
648 |
|
---|
649 | .ChangingToJrIdeIsa:
|
---|
650 | mov ah, JRIDE_DEFAULT_SEGMENT_ADDRESS >> 8
|
---|
651 | SKIP2B bx
|
---|
652 |
|
---|
653 | .ChangingToADP50L:
|
---|
654 | mov ah, ADP50L_DEFAULT_BIOS_SEGMENT_ADDRESS >> 8
|
---|
655 | xor al, al
|
---|
656 | xor bx, bx
|
---|
657 | jmp SHORT .WriteNonSerial
|
---|
658 |
|
---|
659 | .ChangingToSerial:
|
---|
660 | ;
|
---|
661 | ; For serial drives, we pack the port number and baud rate into a single byte, and thus
|
---|
662 | ; we need to take care to properly read/write just the bits we need. In addition, since
|
---|
663 | ; we use the Port/PortCtrl bytes in a special way for serial drives, we need to properly
|
---|
664 | ; default the values stored in both these words when switching in and out of the Serial
|
---|
665 | ; device choice.
|
---|
666 | ;
|
---|
667 | mov al, SERIAL_DEFAULT_COM
|
---|
668 | mov BYTE [es:di+IDEVARS.bSerialBaud-IDEVARS.wBasePort], SERIAL_DEFAULT_BAUD
|
---|
669 | mov [es:di+IDEVARS.bIRQ-IDEVARS.wBasePort], ah ; Clear .bIRQ to keep the boot menu from printing it
|
---|
670 |
|
---|
671 | sub di, IDEVARS.wBasePort - IDEVARS.bSerialCOMPortChar
|
---|
672 | call IdeControllerMenu_SerialWriteCOM
|
---|
673 | stosb
|
---|
674 |
|
---|
675 | .Done:
|
---|
676 | pop ax
|
---|
677 | pop di
|
---|
678 | ret
|
---|
679 |
|
---|
680 |
|
---|
681 | ;--------------------------------------------------------------------
|
---|
682 | ; IdeControllerMenu_SerialWriteCOM
|
---|
683 | ;
|
---|
684 | ; Updates the port address based on COM port selection
|
---|
685 | ;
|
---|
686 | ; Parameters:
|
---|
687 | ; AL: COM port
|
---|
688 | ; ES:DI: Ptr to IDEVARS.bSerialCOMPortChar
|
---|
689 | ; DS:SI: MENUITEM pointer
|
---|
690 | ; Returns:
|
---|
691 | ; Nothing
|
---|
692 | ; Corrupts registers:
|
---|
693 | ; BX
|
---|
694 | ;--------------------------------------------------------------------
|
---|
695 | ALIGN JUMP_ALIGN
|
---|
696 | IdeControllerMenu_SerialWriteCOM:
|
---|
697 | push ax
|
---|
698 | push si
|
---|
699 |
|
---|
700 | mov bx, PackedCOMPortAddresses - 1
|
---|
701 | mov si, g_rgbChoiceToValueLookupForCOM - 2
|
---|
702 |
|
---|
703 | .Loop:
|
---|
704 | inc bx
|
---|
705 | inc si
|
---|
706 | inc si
|
---|
707 |
|
---|
708 | mov ah, [bx]
|
---|
709 | cmp ah, SERIAL_DEFAULT_CUSTOM_PORT >> 2
|
---|
710 | je SHORT .NotFound
|
---|
711 |
|
---|
712 | cmp al, [si]
|
---|
713 | jne SHORT .Loop
|
---|
714 |
|
---|
715 | .NotFound:
|
---|
716 | mov [es:di+IDEVARS.bSerialPort-IDEVARS.bSerialCOMPortChar], ah
|
---|
717 |
|
---|
718 | pop si
|
---|
719 | pop ax
|
---|
720 | ret
|
---|
721 |
|
---|
722 |
|
---|
723 | ;--------------------------------------------------------------------
|
---|
724 | ; IdeControllerMenu_SerialReadPort
|
---|
725 | ;
|
---|
726 | ; Packed Port (byte) -> Numeric Port (word)
|
---|
727 | ;
|
---|
728 | ; Parameters:
|
---|
729 | ; AX: Value read from the ROMVARS location
|
---|
730 | ; ES:DI: ROMVARS location where the value was just read from
|
---|
731 | ; DS:SI: MENUITEM pointer
|
---|
732 | ; Returns:
|
---|
733 | ; AX: Value that the MENUITEM system will interact with and display
|
---|
734 | ; Corrupts registers:
|
---|
735 | ; Nothing
|
---|
736 | ;--------------------------------------------------------------------
|
---|
737 | ALIGN JUMP_ALIGN
|
---|
738 | IdeControllerMenu_SerialReadPort:
|
---|
739 | xor ah, ah
|
---|
740 | eSHL_IM ax, 2
|
---|
741 | ret
|
---|
742 |
|
---|
743 |
|
---|
744 | ;--------------------------------------------------------------------
|
---|
745 | ; IdeControllerMenu_SerialWritePort
|
---|
746 | ;
|
---|
747 | ; Numeric Port (word) -> Packed Port (byte)
|
---|
748 | ;
|
---|
749 | ; And convert from Custom to a defined COM port if we
|
---|
750 | ; match one of the pre-defined COM port numbers
|
---|
751 | ;
|
---|
752 | ; Parameters:
|
---|
753 | ; AX: Value that the MENUITEM system was interacting with
|
---|
754 | ; ES:DI: ROMVARS location where the value is to be stored
|
---|
755 | ; DS:SI: MENUITEM pointer
|
---|
756 | ; Returns:
|
---|
757 | ; AX: Value to actually write to ROMVARS
|
---|
758 | ; Corrupts registers:
|
---|
759 | ; BX
|
---|
760 | ;--------------------------------------------------------------------
|
---|
761 | ALIGN JUMP_ALIGN
|
---|
762 | IdeControllerMenu_SerialWritePort:
|
---|
763 | push si
|
---|
764 |
|
---|
765 | eSHR_IM ax, 2
|
---|
766 | and al, 0FEh ; Force 8-byte boundary
|
---|
767 |
|
---|
768 | mov si, g_rgbChoiceToValueLookupForCOM - 2
|
---|
769 | mov bx, PackedCOMPortAddresses - 1 ; Loop, looking for port address in known COM address list
|
---|
770 |
|
---|
771 | .Loop:
|
---|
772 | inc si
|
---|
773 | inc si
|
---|
774 | inc bx
|
---|
775 |
|
---|
776 | mov ah, [si]
|
---|
777 | cmp ah, 'x'
|
---|
778 | je SHORT .Found
|
---|
779 |
|
---|
780 | cmp al, [bx]
|
---|
781 | jne SHORT .Loop
|
---|
782 |
|
---|
783 | .Found:
|
---|
784 | mov [es:di+IDEVARS.bSerialCOMPortChar-IDEVARS.bSerialPort], ah
|
---|
785 |
|
---|
786 | pop si
|
---|
787 | ret
|
---|
788 |
|
---|