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