source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MasterSlaveMenu.asm

Last change on this file was 614, checked in by Krister Nordvall, 3 years ago

Changes:

  • BIOSDRVS should now build again (broke in r613).
  • Removed the NO_ATAID_CORRECTION define from the Tiny build.
  • Added a new configuration option to skip detection of slave drives.
  • Made FLASH_SIGNATURE 2 bytes shorter to free up ROM space.
  • "Auto Configure" in XTIDECFG should now detect if running on an Olivetti M24, AT&T PC6300, Xerox 6060 or Logabax Persona 1600 and automatically select the fastest compatible transfer mode/device type for any IDE controllers found in the system.
  • Cleaned out some duplicate/unused definitions.
File size: 21.6 KB
Line 
1; Project name : XTIDE Universal BIOS Configurator v2
2; Description : "Master/Slave Drive" menu structs and functions.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 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
21SECTION .data
22
23ALIGN WORD_ALIGN
24g_MenupageForMasterSlaveMenu:
25istruc MENUPAGE
26 at MENUPAGE.fnEnter, dw MasterSlaveMenu_EnterMenuOrModifyItemVisibility
27 at MENUPAGE.fnBack, dw IdeControllerMenu_EnterMenuOrModifyItemVisibility
28 at MENUPAGE.wMenuitems, dw 11
29iend
30
31g_MenuitemMasterSlaveBackToIdeControllerMenu:
32istruc MENUITEM
33 at MENUITEM.fnActivate, dw IdeControllerMenu_EnterMenuOrModifyItemVisibility
34 at MENUITEM.szName, dw g_szItemDrvBackToIde
35 at MENUITEM.szQuickInfo, dw g_szItemDrvBackToIde
36 at MENUITEM.szHelp, dw g_szItemDrvBackToIde
37 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
38 at MENUITEM.bType, db TYPE_MENUITEM_PAGEBACK
39iend
40
41g_MenuitemMasterSlaveDisableDetection:
42istruc MENUITEM
43 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
44 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
45 at MENUITEM.szName, dw g_szItemDrvDisableDetection
46 at MENUITEM.szQuickInfo, dw g_szNfoDrvDisableDetection
47 at MENUITEM.szHelp, dw g_szHelpDrvDisableDetection
48 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
49 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
50 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
51 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvDisableDetection
52 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
53 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
54 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_DRVPARAMS_DO_NOT_DETECT
55iend
56
57g_MenuitemMasterSlaveBlockModeTransfers:
58istruc MENUITEM
59 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
60 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
61 at MENUITEM.szName, dw g_szItemDrvBlockMode
62 at MENUITEM.szQuickInfo, dw g_szNfoDrvBlockMode
63 at MENUITEM.szHelp, dw g_szHelpDrvBlockMode
64 at MENUITEM.bFlags, db FLG_MENUITEM_FLAGVALUE
65 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
66 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
67 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvBlockMode
68 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
69 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
70 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_DRVPARAMS_BLOCKMODE
71iend
72
73g_MenuitemMasterSlaveChsTranslateMode:
74istruc MENUITEM
75 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
76 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
77 at MENUITEM.szName, dw g_szItemDrvXlateMode
78 at MENUITEM.szQuickInfo, dw g_szNfoDrvXlateMode
79 at MENUITEM.szHelp, dw g_szNfoDrvXlateMode
80 at MENUITEM.bFlags, db FLG_MENUITEM_MASKVALUE
81 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
82 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
83 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvXlateMode
84 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceXlateMode
85 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForXlateMode
86 at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForXlateMode
87 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw MASK_DRVPARAMS_TRANSLATEMODE
88 at MENUITEM.itemValue + ITEM_VALUE.bFieldPosition, db TRANSLATEMODE_FIELD_POSITION
89iend
90
91g_MenuitemMasterSlaveWriteCache:
92istruc MENUITEM
93 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
94 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
95 at MENUITEM.szName, dw g_szItemDrvWriteCache
96 at MENUITEM.szQuickInfo, dw g_szNfoDrvWriteCache
97 at MENUITEM.szHelp, dw g_szHelpDrvWriteCache
98 at MENUITEM.bFlags, db FLG_MENUITEM_MASKVALUE
99 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
100 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
101 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvWriteCache
102 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceWrCache
103 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForWriteCache
104 at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForWriteCache
105 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw MASK_DRVPARAMS_WRITECACHE
106 at MENUITEM.itemValue + ITEM_VALUE.bFieldPosition, db 0
107iend
108
109g_MenuitemMasterSlaveUserCHS:
110istruc MENUITEM
111 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
112 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
113 at MENUITEM.szName, dw g_szItemDrvUserCHS
114 at MENUITEM.szQuickInfo, dw g_szNfoDrvUserCHS
115 at MENUITEM.szHelp, dw g_szHelpDrvUserCHS
116 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
117 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
118 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
119 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvUserCHS
120 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
121 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
122 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_DRVPARAMS_USERCHS
123 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw MasterSlaveMenu_WriteCHSFlag
124iend
125
126g_MenuitemMasterSlaveCylinders:
127istruc MENUITEM
128 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
129 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
130 at MENUITEM.szName, dw g_szItemDrvCyls
131 at MENUITEM.szQuickInfo, dw g_szNfoDrvCyls
132 at MENUITEM.szHelp, dw g_szNfoDrvCyls
133 at MENUITEM.bFlags, db NULL
134 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
135 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
136 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvCyls
137 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
138 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw MAX_PCHS_CYLINDERS
139%define MASTERSLAVE_CYLINDERS_DEFAULT 1024 ; Max L-CHS Cylinders
140iend
141
142g_MenuitemMasterSlaveHeads:
143istruc MENUITEM
144 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
145 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
146 at MENUITEM.szName, dw g_szItemDrvHeads
147 at MENUITEM.szQuickInfo, dw g_szNfoDrvHeads
148 at MENUITEM.szHelp, dw g_szNfoDrvHeads
149 at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE
150 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
151 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
152 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvHeads
153 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
154 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw MAX_PCHS_HEADS
155%define MASTERSLAVE_HEADS_DEFAULT MAX_PCHS_HEADS
156iend
157
158g_MenuitemMasterSlaveSectors:
159istruc MENUITEM
160 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
161 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
162 at MENUITEM.szName, dw g_szItemDrvSect
163 at MENUITEM.szQuickInfo, dw g_szNfoDrvSect
164 at MENUITEM.szHelp, dw g_szNfoDrvSect
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_szDlgDrvSect
169 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
170 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw MAX_PCHS_SECTORS_PER_TRACK
171%define MASTERSLAVE_SECTORS_DEFAULT MAX_PCHS_SECTORS_PER_TRACK
172iend
173
174g_MenuitemMasterSlaveUserLBA:
175istruc MENUITEM
176 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
177 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
178 at MENUITEM.szName, dw g_szItemDrvUserLBA
179 at MENUITEM.szQuickInfo, dw g_szNfoDrvUserLBA
180 at MENUITEM.szHelp, dw g_szHelpDrvUserLBA
181 at MENUITEM.bFlags, db FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
182 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
183 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
184 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvUserLBA
185 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
186 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
187 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_DRVPARAMS_USERLBA
188 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw MasterSlaveMenu_WriteLBAFlag
189iend
190
191g_MenuitemMasterSlaveUserLbaValue:
192istruc MENUITEM
193 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
194 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
195 at MENUITEM.szName, dw g_szItemDrvLbaSectors
196 at MENUITEM.szQuickInfo, dw g_szNfoDrvLbaSectors
197 at MENUITEM.szHelp, dw g_szNfoDrvLbaSectors
198 at MENUITEM.bFlags, db NULL
199 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
200 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
201 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvLbaSectors
202 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 16 ; 8 GiB (but a little more than L-CHS limit)
203 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 10000000h / (1024 * 1024) ; Limit to 28-bit LBA
204 at MENUITEM.itemValue + ITEM_VALUE.fnValueReader, dw ValueReaderForUserLbaValue
205 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw ValueWriterForUserLbaValue
206%define MASTERSLAVE_USERLBA_DEFAULT 64 ; 32 GiB (max supported by Win95)
207iend
208
209
210g_rgwChoiceToValueLookupForWriteCache:
211 dw DEFAULT_WRITE_CACHE
212 dw DISABLE_WRITE_CACHE
213 dw ENABLE_WRITE_CACHE
214g_rgszChoiceToStringLookupForWriteCache:
215 dw g_szValueBootDispModeDefault
216 dw g_szValueDrvWrCaDis
217 dw g_szValueDrvWrCaEn
218
219g_rgwChoiceToValueLookupForXlateMode:
220 dw TRANSLATEMODE_NORMAL
221 dw TRANSLATEMODE_LARGE
222 dw TRANSLATEMODE_ASSISTED_LBA
223 dw TRANSLATEMODE_AUTO
224g_rgszChoiceToStringLookupForXlateMode:
225 dw g_szValueDrvXlateNormal
226 dw g_szValueDrvXlateLarge
227 dw g_szValueDrvXlateLBA
228 dw g_szValueDrvXlateAuto
229
230
231; Section containing code
232SECTION .text
233
234;--------------------------------------------------------------------
235; MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
236; Parameters:
237; SS:BP: Menu handle
238; Returns:
239; Nothing
240; Corrupts registers:
241; AX
242;--------------------------------------------------------------------
243ALIGN JUMP_ALIGN
244MasterSlaveMenu_InitializeToDrvparamsOffsetInBX:
245 push ds
246
247 push cs
248 pop ds
249
250%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
251%if DRVPARAMS.wFlags = 0
252 mov ax, bx
253%else
254 lea ax, [bx+DRVPARAMS.wFlags]
255%endif
256%endif
257 mov [g_MenuitemMasterSlaveDisableDetection+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
258 mov [g_MenuitemMasterSlaveBlockModeTransfers+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
259 mov [g_MenuitemMasterSlaveChsTranslateMode+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
260 mov [g_MenuitemMasterSlaveWriteCache+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
261 mov [g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
262 mov [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
263
264 lea ax, [bx+DRVPARAMS.wCylinders]
265 mov [g_MenuitemMasterSlaveCylinders+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
266
267 lea ax, [bx+DRVPARAMS.bHeads]
268 mov [g_MenuitemMasterSlaveHeads+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
269
270 lea ax, [bx+DRVPARAMS.bSect]
271 mov [g_MenuitemMasterSlaveSectors+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
272
273 lea ax, [bx+DRVPARAMS.dwMaximumLBA]
274 mov [g_MenuitemMasterSlaveUserLbaValue+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
275
276 pop ds
277 ret
278
279
280;--------------------------------------------------------------------
281; MasterSlaveMenu_EnterMenuOrModifyItemVisibility
282; Parameters:
283; SS:BP: Menu handle
284; Returns:
285; Nothing
286; Corrupts registers:
287; All, except BP
288;--------------------------------------------------------------------
289ALIGN JUMP_ALIGN
290MasterSlaveMenu_EnterMenuOrModifyItemVisibility:
291 push cs
292 pop ds
293 mov bx, [g_MenuitemMasterSlaveDisableDetection+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
294 call Buffers_GetRomvarsValueToAXfromOffsetInBX
295 mov si, g_MenupageForMasterSlaveMenu
296 ePUSH_T bx, Menupage_ChangeToNewMenupageInDSSI
297 test al, FLG_DRVPARAMS_DO_NOT_DETECT
298 jnz SHORT .DisableAllItemsOnThisMenuExceptDisableDetection
299 call .EnableOrDisableItemsDependingOnControllerBeingSerialOrNot
300 call .EnableOrDisableUserCHSandLBA
301 call .EnableOrDisableCHandS
302 jmp .EnableOrDisableUserLbaValue
303
304
305;--------------------------------------------------------------------
306; .EnableOrDisableItemsDependingOnControllerBeingSerialOrNot
307; Parameters:
308; SS:BP: Menu handle
309; Returns:
310; Nothing
311; Corrupts registers:
312; AX, BX
313;--------------------------------------------------------------------
314ALIGN JUMP_ALIGN
315.EnableOrDisableItemsDependingOnControllerBeingSerialOrNot:
316 mov bx, [g_MenuitemIdeControllerDevice+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
317 call Buffers_GetRomvarsValueToAXfromOffsetInBX
318 mov bx, g_MenuitemMasterSlaveChsTranslateMode
319 call EnableMenuitemFromCSBX
320 cmp al, DEVICE_SERIAL_PORT
321 je SHORT .DisableAllItemsNotApplicableToSerialDrives
322 mov bx, g_MenuitemMasterSlaveBlockModeTransfers
323 call EnableMenuitemFromCSBX
324 mov bx, g_MenuitemMasterSlaveWriteCache
325 jmp EnableMenuitemFromCSBX
326
327
328;--------------------------------------------------------------------
329; .DisableAllItemsOnThisMenuExceptDisableDetection
330; .DisableAllItemsNotApplicableToSerialDrives
331; Parameters:
332; SS:BP: Menu handle
333; Returns:
334; Nothing
335; Corrupts registers:
336; AX, BX
337;--------------------------------------------------------------------
338ALIGN JUMP_ALIGN
339.DisableAllItemsOnThisMenuExceptDisableDetection:
340 mov bx, g_MenuitemMasterSlaveChsTranslateMode
341 call DisableMenuitemFromCSBX
342 mov bx, g_MenuitemMasterSlaveUserCHS
343 call DisableMenuitemFromCSBX
344 call .DisableCHandS
345 mov bx, g_MenuitemMasterSlaveUserLBA
346 call DisableMenuitemFromCSBX
347 mov bx, g_MenuitemMasterSlaveUserLbaValue
348 call DisableMenuitemFromCSBX
349.DisableAllItemsNotApplicableToSerialDrives:
350 mov bx, g_MenuitemMasterSlaveBlockModeTransfers
351 call DisableMenuitemFromCSBX
352 mov bx, g_MenuitemMasterSlaveWriteCache
353 jmp SHORT .DisableMenuitemFromCSBX
354
355
356;--------------------------------------------------------------------
357; .EnableOrDisableUserCHSandLBA
358; Parameters:
359; SS:BP: Menu handle
360; Returns:
361; Nothing
362; Corrupts registers:
363; AX, BX
364;--------------------------------------------------------------------
365ALIGN JUMP_ALIGN
366.EnableOrDisableUserCHSandLBA:
367 mov bx, [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
368 call Buffers_GetRomvarsValueToAXfromOffsetInBX
369 test al, FLG_DRVPARAMS_USERLBA
370 jnz SHORT .DisableCHSandEnableLBA
371 test al, FLG_DRVPARAMS_USERCHS
372 jnz SHORT .EnableCHSandDisableLBA
373
374 ; Enable both
375 mov bx, g_MenuitemMasterSlaveUserCHS
376 call EnableMenuitemFromCSBX
377 mov bx, g_MenuitemMasterSlaveUserLBA
378 jmp SHORT .EnableMenuitemFromCSBX
379
380ALIGN JUMP_ALIGN
381.EnableCHSandDisableLBA:
382 mov bx, g_MenuitemMasterSlaveUserCHS
383 call EnableMenuitemFromCSBX
384 mov bx, g_MenuitemMasterSlaveUserLBA
385 jmp SHORT .DisableMenuitemFromCSBX
386
387ALIGN JUMP_ALIGN
388.DisableCHSandEnableLBA:
389 mov bx, g_MenuitemMasterSlaveUserLBA
390 call EnableMenuitemFromCSBX
391 mov bx, g_MenuitemMasterSlaveUserCHS
392 jmp SHORT .DisableMenuitemFromCSBX
393
394
395;--------------------------------------------------------------------
396; .EnableOrDisableCHandS
397; Parameters:
398; SS:BP: Menu handle
399; Returns:
400; Nothing
401; Corrupts registers:
402; AX, BX
403;--------------------------------------------------------------------
404ALIGN JUMP_ALIGN
405.EnableOrDisableCHandS:
406 mov bx, [g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
407 call Buffers_GetRomvarsValueToAXfromOffsetInBX
408 test al, FLG_DRVPARAMS_USERCHS
409 jz SHORT .DisableCHandS
410 test al, FLG_DRVPARAMS_USERLBA
411 jnz SHORT .DisableCHandS
412
413 mov ax, EnableMenuitemFromCSBX
414 jmp SHORT .EnableCHandS
415
416.DisableCHandS:
417 mov ax, DisableMenuitemFromCSBX
418.EnableCHandS:
419 mov bx, g_MenuitemMasterSlaveCylinders
420 call ax
421 mov bx, g_MenuitemMasterSlaveHeads
422 call ax
423 mov bx, g_MenuitemMasterSlaveSectors
424 jmp ax
425
426
427;--------------------------------------------------------------------
428; .EnableOrDisableUserLbaValue
429; Parameters:
430; SS:BP: Menu handle
431; Returns:
432; Nothing
433; Corrupts registers:
434; AX, BX
435;--------------------------------------------------------------------
436ALIGN JUMP_ALIGN
437.EnableOrDisableUserLbaValue:
438 mov bx, [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
439 call Buffers_GetRomvarsValueToAXfromOffsetInBX
440 mov bx, g_MenuitemMasterSlaveUserLbaValue
441 test al, FLG_DRVPARAMS_USERCHS
442 jnz SHORT .DisableMenuitemFromCSBX
443 test al, FLG_DRVPARAMS_USERLBA
444 jz SHORT .DisableMenuitemFromCSBX
445 ; Fall to .EnableMenuitemFromCSBX
446
447
448;--------------------------------------------------------------------
449; .EnableMenuitemFromCSBX
450; .DisableMenuitemFromCSBX
451; Parameters:
452; CS:BX: Ptr to MENUITEM
453; Returns:
454; Nothing
455; Corrupts registers:
456; Nothing
457;--------------------------------------------------------------------
458ALIGN JUMP_ALIGN
459.EnableMenuitemFromCSBX:
460 jmp EnableMenuitemFromCSBX
461
462ALIGN JUMP_ALIGN
463.DisableMenuitemFromCSBX:
464 jmp DisableMenuitemFromCSBX
465
466
467;--------------------------------------------------------------------
468; MENUITEM value reader functions
469; Parameters:
470; AX: Value from MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
471; DS:SI: Ptr to MENUITEM
472; ES:DI: Ptr to value variable
473; Returns:
474; AX: Value with possible modifications
475; Corrupts registers:
476; Nothing
477;--------------------------------------------------------------------
478ALIGN JUMP_ALIGN
479ValueReaderForUserLbaValue:
480 push dx
481
482 mov ax, 1
483 cwd ; DX:AX = 1
484 add ax, [es:di]
485 adc dx, [es:di+2] ; User defined LBA28 limit added
486
487 xchg ax, dx ; SHR 16
488 eSHR_IM ax, 4 ; SHR 4 => AX = DX:AX / (1024*1024)
489
490 pop dx
491 ret
492
493
494;--------------------------------------------------------------------
495; MENUITEM value writer functions
496; Parameters:
497; AX: Value to be written to MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
498; DS:SI: Ptr to MENUITEM
499; ES:DI: Ptr to value variable
500; Returns:
501; AX: Value to be stored
502; Corrupts registers:
503; Nothing
504;--------------------------------------------------------------------
505ALIGN JUMP_ALIGN
506ValueWriterForUserLbaValue:
507 push dx
508
509 xor dx, dx
510 eSHL_IM ax, 4
511 xchg dx, ax ; DX:AX now holds AX * 1024 * 1024
512
513 sub ax, BYTE 1 ; Decrement DX:AX by one
514 sbb dx, BYTE 0 ; (necessary since maximum LBA28 sector count is 0FFF FFFFh)
515
516 mov [es:di+2], dx ; Store DX by ourselves
517 pop dx
518 ret ; AX will be stored by our menu system
519
520;
521; No change to CHS flag, but we use this opportunity to change defaults stored in the CHS values if we are
522; changing in/out of user CHS settings (since we use these bytes in different ways with the LBA setting).
523;
524ALIGN JUMP_ALIGN
525MasterSlaveMenu_WriteCHSFlag:
526 test BYTE [es:di], FLG_DRVPARAMS_USERCHS
527 jnz SHORT .AlreadySet
528
529 push ax
530 push di
531 push si
532
533 mov ax, MASTERSLAVE_CYLINDERS_DEFAULT
534 mov si, g_MenuitemMasterSlaveCylinders
535 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
536
537 mov ax, MASTERSLAVE_HEADS_DEFAULT
538 mov si, g_MenuitemMasterSlaveHeads
539 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
540
541 mov ax, MASTERSLAVE_SECTORS_DEFAULT
542 mov si, g_MenuitemMasterSlaveSectors
543 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
544
545 pop si
546 pop di
547 pop ax
548
549.AlreadySet:
550 ret
551
552;
553; No change to LBA flag, but we use this opportunity to change defaults stored in the LBA value if we are
554; changing in/out of user LBA settings (since we use these bytes in different ways with the CHS setting).
555;
556ALIGN JUMP_ALIGN
557MasterSlaveMenu_WriteLBAFlag:
558 test BYTE [es:di], FLG_DRVPARAMS_USERLBA
559 jnz SHORT .AlreadySet
560
561 push ax
562 push di
563 push si
564
565 mov ax, MASTERSLAVE_USERLBA_DEFAULT
566 mov si, g_MenuitemMasterSlaveUserLbaValue
567 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
568
569 pop si
570 pop di
571 pop ax
572
573.AlreadySet:
574 ret
575
Note: See TracBrowser for help on using the repository browser.