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

Last change on this file since 595 was 592, checked in by Krister Nordvall, 6 years ago

Changes:

  • The problem with NASM in the previous revision (r591) has been fixed.
  • The colors used by the boot menu and hotkey bar can now be customized by selecting one of a number of pre-defined color themes. Suggestions for additional themes are more than welcome!
  • Large builds are now 10 KB. Small builds are still 8 KB with the exception of the Tiny build which is now 4 KB. In other words, builds are now as small as possible to make it easier to combine them with other BIOSes.
  • Added code to the library to improve drive error handling. XTIDECFG can now handle "Drive Not Ready" errors.
  • Fixed a couple of potential bugs in AtaID.asm (AtaID_GetMaxPioModeToAXandMinCycleTimeToCX); 1) ATA1.bPioMode was treated as a WORD variable. 2) ATA2.bPIOSupp was assumed to be non-zero which would result in PIO mode 3 being returned if the assumption was wrong.
  • Made the same changes in the equivalent function used by BIOSDRVS (DisplayPioModeInformationUsingAtaInfoFromDSBX in AtaInfo.asm).
  • Fixed a bug from r587 in PDC20x30.asm in PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX.
  • Fixed a bug from r523 in XTIDECFG where Auto Configure would only set the IRQ on one IDE interface on AT-builds.
  • XTIDECFG will now restore the default settings for the "Serial port virtual device" when reselecting it in the list of device types. This makes it behave consistently for all device types.
  • The eAAM macro is now used regardless if USE_UNDOC_INTEL is defined or not because it is apparently supported on all processors including the NEC V20/V30 CPUs.
  • Renamed the EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS define to EXCLUDE_FROM_XUB.
  • Added a define to exclude unused library code from BIOSDRVS (EXCLUDE_FROM_BIOSDRVS). This makes it a lot smaller than in previous revisions.
  • All unnecessary CLD-instructions are now under a new define 'CLD_NEEDED' which is only enabled for the BIOS. It is disabled for XTIDECFG and BIOSDRVS but can be enabled if needed by adding this define to the respective makefile. This change was made because these unnecessary instructions are wasteful and should never be needed. In fact, they only serve to hide bugs (in other peoples code) which I strongly believe should be avoided. I recommend people making their own BIOSes from source to not use this define as it's extremely unlikely to be needed.
  • Updated the copyright info in SerDrive and changed an URL to point to the new site.
  • Updated the copyright info and version number in BIOSDRVS.
  • Updated the copyright info in XTIDECFG.
  • Optimizations in general.
File size: 18.8 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 10
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_MenuitemMasterSlaveBlockModeTransfers:
42istruc MENUITEM
43 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
44 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
45 at MENUITEM.szName, dw g_szItemDrvBlockMode
46 at MENUITEM.szQuickInfo, dw g_szNfoDrvBlockMode
47 at MENUITEM.szHelp, dw g_szHelpDrvBlockMode
48 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | 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_szDlgDrvBlockMode
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_BLOCKMODE
55iend
56
57g_MenuitemMasterSlaveChsTranslateMode:
58istruc MENUITEM
59 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
60 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
61 at MENUITEM.szName, dw g_szItemDrvXlateMode
62 at MENUITEM.szQuickInfo, dw g_szNfoDrvXlateMode
63 at MENUITEM.szHelp, dw g_szNfoDrvXlateMode
64 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MASKVALUE
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_szDlgDrvXlateMode
68 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiseXlateMode
69 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForXlateMode
70 at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForXlateMode
71 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw MASK_DRVPARAMS_TRANSLATEMODE
72 at MENUITEM.itemValue + ITEM_VALUE.bFieldPosition, db TRANSLATEMODE_FIELD_POSITION
73iend
74
75g_MenuitemMasterSlaveWriteCache:
76istruc MENUITEM
77 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
78 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
79 at MENUITEM.szName, dw g_szItemDrvWriteCache
80 at MENUITEM.szQuickInfo, dw g_szNfoDrvWriteCache
81 at MENUITEM.szHelp, dw g_szHelpDrvWriteCache
82 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MASKVALUE
83 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
84 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
85 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvWriteCache
86 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiseWrCache
87 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForWriteCache
88 at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForWriteCache
89 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw MASK_DRVPARAMS_WRITECACHE
90 at MENUITEM.itemValue + ITEM_VALUE.bFieldPosition, db 0
91iend
92
93g_MenuitemMasterSlaveUserCHS:
94istruc MENUITEM
95 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
96 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
97 at MENUITEM.szName, dw g_szItemDrvUserCHS
98 at MENUITEM.szQuickInfo, dw g_szNfoDrvUserCHS
99 at MENUITEM.szHelp, dw g_szHelpDrvUserCHS
100 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
101 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
102 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
103 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvUserCHS
104 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
105 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
106 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_DRVPARAMS_USERCHS
107 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw MasterSlaveMenu_WriteCHSFlag
108iend
109
110g_MenuitemMasterSlaveCylinders:
111istruc MENUITEM
112 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
113 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
114 at MENUITEM.szName, dw g_szItemDrvCyls
115 at MENUITEM.szQuickInfo, dw g_szNfoDrvCyls
116 at MENUITEM.szHelp, dw g_szNfoDrvCyls
117 at MENUITEM.bFlags, db NULL
118 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
119 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
120 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvCyls
121 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
122 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw MAX_PCHS_CYLINDERS
123%define MASTERSLAVE_CYLINDERS_DEFAULT 1024 ; Max L-CHS Cylinders
124iend
125
126g_MenuitemMasterSlaveHeads:
127istruc MENUITEM
128 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
129 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
130 at MENUITEM.szName, dw g_szItemDrvHeads
131 at MENUITEM.szQuickInfo, dw g_szNfoDrvHeads
132 at MENUITEM.szHelp, dw g_szNfoDrvHeads
133 at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE
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_szDlgDrvHeads
137 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
138 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw MAX_PCHS_HEADS
139%define MASTERSLAVE_HEADS_DEFAULT MAX_PCHS_HEADS
140iend
141
142g_MenuitemMasterSlaveSectors:
143istruc MENUITEM
144 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
145 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
146 at MENUITEM.szName, dw g_szItemDrvSect
147 at MENUITEM.szQuickInfo, dw g_szNfoDrvSect
148 at MENUITEM.szHelp, dw g_szNfoDrvSect
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_szDlgDrvSect
153 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
154 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw MAX_PCHS_SECTORS_PER_TRACK
155%define MASTERSLAVE_SECTORS_DEFAULT MAX_PCHS_SECTORS_PER_TRACK
156iend
157
158g_MenuitemMasterSlaveUserLBA:
159istruc MENUITEM
160 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
161 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
162 at MENUITEM.szName, dw g_szItemDrvUserLBA
163 at MENUITEM.szQuickInfo, dw g_szNfoDrvUserLBA
164 at MENUITEM.szHelp, dw g_szHelpDrvUserLBA
165 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | 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_szDlgDrvUserLBA
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 FLG_DRVPARAMS_USERLBA
172 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw MasterSlaveMenu_WriteLBAFlag
173iend
174
175g_MenuitemMasterSlaveUserLbaValue:
176istruc MENUITEM
177 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
178 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
179 at MENUITEM.szName, dw g_szItemDrvLbaSectors
180 at MENUITEM.szQuickInfo, dw g_szNfoDrvLbaSectors
181 at MENUITEM.szHelp, dw g_szNfoDrvLbaSectors
182 at MENUITEM.bFlags, db NULL
183 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
184 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
185 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvLbaSectors
186 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 16 ; 8 GiB (but a little more than L-CHS limit)
187 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 10000000h / (1024 * 1024) ; Limit to 28-bit LBA
188 at MENUITEM.itemValue + ITEM_VALUE.fnValueReader, dw ValueReaderForUserLbaValue
189 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw ValueWriterForUserLbaValue
190%define MASTERSLAVE_USERLBA_DEFAULT 64 ; 32 GiB (max supported by Win95)
191iend
192
193
194g_rgwChoiceToValueLookupForWriteCache:
195 dw DEFAULT_WRITE_CACHE
196 dw DISABLE_WRITE_CACHE
197 dw ENABLE_WRITE_CACHE
198g_rgszChoiceToStringLookupForWriteCache:
199 dw g_szValueBootDispModeDefault
200 dw g_szValueDrvWrCaDis
201 dw g_szValueDrvWrCaEn
202
203g_rgwChoiceToValueLookupForXlateMode:
204 dw TRANSLATEMODE_NORMAL
205 dw TRANSLATEMODE_LARGE
206 dw TRANSLATEMODE_ASSISTED_LBA
207 dw TRANSLATEMODE_AUTO
208g_rgszChoiceToStringLookupForXlateMode:
209 dw g_szValueDrvXlateNormal
210 dw g_szValueDrvXlateLarge
211 dw g_szValueDrvXlateLBA
212 dw g_szValueDrvXlateAuto
213
214
215; Section containing code
216SECTION .text
217
218;--------------------------------------------------------------------
219; MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
220; Parameters:
221; SS:BP: Menu handle
222; Returns:
223; Nothing
224; Corrupts registers:
225; AX
226;--------------------------------------------------------------------
227ALIGN JUMP_ALIGN
228MasterSlaveMenu_InitializeToDrvparamsOffsetInBX:
229 push ds
230
231 push cs
232 pop ds
233
234%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
235%if DRVPARAMS.wFlags = 0
236 mov ax, bx
237%else
238 lea ax, [bx+DRVPARAMS.wFlags]
239%endif
240%endif
241 mov [g_MenuitemMasterSlaveBlockModeTransfers+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
242 mov [g_MenuitemMasterSlaveChsTranslateMode+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
243 mov [g_MenuitemMasterSlaveWriteCache+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
244 mov [g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
245 mov [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
246
247 lea ax, [bx+DRVPARAMS.wCylinders]
248 mov [g_MenuitemMasterSlaveCylinders+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
249
250 lea ax, [bx+DRVPARAMS.bHeads]
251 mov [g_MenuitemMasterSlaveHeads+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
252
253 lea ax, [bx+DRVPARAMS.bSect]
254 mov [g_MenuitemMasterSlaveSectors+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
255
256 lea ax, [bx+DRVPARAMS.dwMaximumLBA]
257 mov [g_MenuitemMasterSlaveUserLbaValue+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
258
259 pop ds
260 ret
261
262
263;--------------------------------------------------------------------
264; MasterSlaveMenu_EnterMenuOrModifyItemVisibility
265; Parameters:
266; SS:BP: Menu handle
267; Returns:
268; Nothing
269; Corrupts registers:
270; All, except BP
271;--------------------------------------------------------------------
272ALIGN JUMP_ALIGN
273MasterSlaveMenu_EnterMenuOrModifyItemVisibility:
274 push cs
275 pop ds
276 call .EnableOrDisableUserCHSandLBA
277 call .EnableOrDisableCHandS
278 call .EnableOrDisableUserLbaValue
279 mov si, g_MenupageForMasterSlaveMenu
280 jmp Menupage_ChangeToNewMenupageInDSSI
281
282
283;--------------------------------------------------------------------
284; .EnableOrDisableUserCHSandLBA
285; Parameters:
286; SS:BP: Menu handle
287; Returns:
288; Nothing
289; Corrupts registers:
290; AX, BX
291;--------------------------------------------------------------------
292ALIGN JUMP_ALIGN
293.EnableOrDisableUserCHSandLBA:
294 mov bx, [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
295 call Buffers_GetRomvarsValueToAXfromOffsetInBX
296 test al, FLG_DRVPARAMS_USERLBA
297 jnz SHORT .DisableCHSandEnableLBA
298 test al, FLG_DRVPARAMS_USERCHS
299 jnz SHORT .EnableCHSandDisableLBA
300
301 ; Enable both
302 mov bx, g_MenuitemMasterSlaveUserCHS
303 call EnableMenuitemFromCSBX
304 mov bx, g_MenuitemMasterSlaveUserLBA
305 jmp SHORT .EnableMenuitemFromCSBX
306
307ALIGN JUMP_ALIGN
308.EnableCHSandDisableLBA:
309 mov bx, g_MenuitemMasterSlaveUserCHS
310 call EnableMenuitemFromCSBX
311 mov bx, g_MenuitemMasterSlaveUserLBA
312 jmp SHORT .DisableMenuitemFromCSBX
313
314ALIGN JUMP_ALIGN
315.DisableCHSandEnableLBA:
316 mov bx, g_MenuitemMasterSlaveUserLBA
317 call EnableMenuitemFromCSBX
318 mov bx, g_MenuitemMasterSlaveUserCHS
319 jmp SHORT .DisableMenuitemFromCSBX
320
321
322;--------------------------------------------------------------------
323; .EnableOrDisableCHandS
324; Parameters:
325; SS:BP: Menu handle
326; Returns:
327; Nothing
328; Corrupts registers:
329; AX, BX
330;--------------------------------------------------------------------
331ALIGN JUMP_ALIGN
332.EnableOrDisableCHandS:
333 mov bx, [g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
334 call Buffers_GetRomvarsValueToAXfromOffsetInBX
335 test al, FLG_DRVPARAMS_USERCHS
336 jz SHORT .DisableCHandS
337 test al, FLG_DRVPARAMS_USERLBA
338 jnz SHORT .DisableCHandS
339
340 mov bx, g_MenuitemMasterSlaveCylinders
341 call EnableMenuitemFromCSBX
342 mov bx, g_MenuitemMasterSlaveHeads
343 call EnableMenuitemFromCSBX
344 mov bx, g_MenuitemMasterSlaveSectors
345 jmp SHORT .EnableMenuitemFromCSBX
346
347ALIGN JUMP_ALIGN
348.DisableCHandS:
349 mov bx, g_MenuitemMasterSlaveCylinders
350 call DisableMenuitemFromCSBX
351 mov bx, g_MenuitemMasterSlaveHeads
352 call DisableMenuitemFromCSBX
353 mov bx, g_MenuitemMasterSlaveSectors
354 jmp SHORT .DisableMenuitemFromCSBX
355
356
357;--------------------------------------------------------------------
358; .EnableOrDisableUserLbaValue
359; Parameters:
360; SS:BP: Menu handle
361; Returns:
362; Nothing
363; Corrupts registers:
364; AX, BX
365;--------------------------------------------------------------------
366ALIGN JUMP_ALIGN
367.EnableOrDisableUserLbaValue:
368 mov bx, [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
369 call Buffers_GetRomvarsValueToAXfromOffsetInBX
370 mov bx, g_MenuitemMasterSlaveUserLbaValue
371 test al, FLG_DRVPARAMS_USERCHS
372 jnz SHORT .DisableMenuitemFromCSBX
373 test al, FLG_DRVPARAMS_USERLBA
374 jz SHORT .DisableMenuitemFromCSBX
375 ; Fall to .EnableMenuitemFromCSBX
376
377
378;--------------------------------------------------------------------
379; .EnableMenuitemFromCSBX
380; .DisableMenuitemFromCSBX
381; Parameters:
382; CS:BX: Ptr to MENUITEM
383; Returns:
384; Nothing
385; Corrupts registers:
386; Nothing
387;--------------------------------------------------------------------
388ALIGN JUMP_ALIGN
389.EnableMenuitemFromCSBX:
390 jmp EnableMenuitemFromCSBX
391
392ALIGN JUMP_ALIGN
393.DisableMenuitemFromCSBX:
394 jmp DisableMenuitemFromCSBX
395
396
397;--------------------------------------------------------------------
398; MENUITEM value reader functions
399; Parameters:
400; AX: Value from MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
401; DS:SI: Ptr to MENUITEM
402; ES:DI: Ptr to value variable
403; Returns:
404; AX: Value with possible modifications
405; Corrupts registers:
406; Nothing
407;--------------------------------------------------------------------
408ALIGN JUMP_ALIGN
409ValueReaderForUserLbaValue:
410 push dx
411
412 mov ax, 1
413 cwd ; DX:AX = 1
414 add ax, [es:di]
415 adc dx, [es:di+2] ; User defined LBA28 limit added
416
417 xchg ax, dx ; SHR 16
418 eSHR_IM ax, 4 ; SHR 4 => AX = DX:AX / (1024*1024)
419
420 pop dx
421 ret
422
423
424;--------------------------------------------------------------------
425; MENUITEM value writer functions
426; Parameters:
427; AX: Value to be written to MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
428; DS:SI: Ptr to MENUITEM
429; ES:DI: Ptr to value variable
430; Returns:
431; AX: Value to be stored
432; Corrupts registers:
433; Nothing
434;--------------------------------------------------------------------
435ALIGN JUMP_ALIGN
436ValueWriterForUserLbaValue:
437 push dx
438
439 xor dx, dx
440 eSHL_IM ax, 4
441 xchg dx, ax ; DX:AX now holds AX * 1024 * 1024
442
443 sub ax, BYTE 1 ; Decrement DX:AX by one
444 sbb dx, BYTE 0 ; (necessary since maximum LBA28 sector count is 0FFF FFFFh)
445
446 mov [es:di+2], dx ; Store DX by ourselves
447 pop dx
448 ret ; AX will be stored by our menu system
449
450;
451; No change to CHS flag, but we use this opportunity to change defaults stored in the CHS values if we are
452; changing in/out of user CHS settings (since we use these bytes in different ways with the LBA setting).
453;
454ALIGN JUMP_ALIGN
455MasterSlaveMenu_WriteCHSFlag:
456 test BYTE [es:di], FLG_DRVPARAMS_USERCHS
457 jnz SHORT .AlreadySet
458
459 push ax
460 push di
461 push si
462
463 mov ax, MASTERSLAVE_CYLINDERS_DEFAULT
464 mov si, g_MenuitemMasterSlaveCylinders
465 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
466
467 mov ax, MASTERSLAVE_HEADS_DEFAULT
468 mov si, g_MenuitemMasterSlaveHeads
469 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
470
471 mov ax, MASTERSLAVE_SECTORS_DEFAULT
472 mov si, g_MenuitemMasterSlaveSectors
473 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
474
475 pop si
476 pop di
477 pop ax
478
479.AlreadySet:
480 ret
481
482;
483; No change to LBA flag, but we use this opportunity to change defaults stored in the LBA value if we are
484; changing in/out of user LBA settings (since we use these bytes in different ways with the CHS setting).
485;
486ALIGN JUMP_ALIGN
487MasterSlaveMenu_WriteLBAFlag:
488 test BYTE [es:di], FLG_DRVPARAMS_USERLBA
489 jnz SHORT .AlreadySet
490
491 push ax
492 push di
493 push si
494
495 mov ax, MASTERSLAVE_USERLBA_DEFAULT
496 mov si, g_MenuitemMasterSlaveUserLbaValue
497 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
498
499 pop si
500 pop di
501 pop ax
502
503.AlreadySet:
504 ret
505
Note: See TracBrowser for help on using the repository browser.