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