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

Last change on this file since 314 was 286, checked in by aitotat@…, 13 years ago

Changes to Configurator v2:

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