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

Last change on this file since 575 was 567, checked in by krille_n_@…, 11 years ago

Changes:

  • Renamed MODULE_FEATURE_SETS to MODULE_POWER_MANAGEMENT.
  • Renamed MODULE_VERY_LATE_INITIALIZATION to MODULE_VERY_LATE_INIT and removed it from the official builds.
  • Removed the code that skips detection of slave drives on XT-CF controllers since slave drives can be used with Lo-tech ISA CompactFlash boards.
  • Added autodetection of the SVC ADP50L controller to XTIDECFG.
  • The autodetection of XT-CF controllers now requires MODULE_8BIT_IDE_ADVANCED in the loaded BIOS.
  • Fixed a bug in XTIDECFG from r502 where the "Base (cmd block) address" menu option would be displayed when a serial device was selected as the IDE controller.
  • XTIDECFG would display the "Enable interrupt" menu option for the XTIDE r1 but not for the XTIDE r2. It's now displayed for both controller types.
  • Disabled the "Internal Write Cache" menu option in the Master/Slave Drive menus for serial device type drives.
  • Optimizations and other fixes.
File size: 18.7 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
198
199g_rgszChoiceToStringLookupForWriteCache:
200 dw g_szValueBootDispModeDefault
201 dw g_szValueDrvWrCaDis
202 dw g_szValueDrvWrCaEn
203
204g_rgwChoiceToValueLookupForXlateMode:
205 dw TRANSLATEMODE_NORMAL
206 dw TRANSLATEMODE_LARGE
207 dw TRANSLATEMODE_ASSISTED_LBA
208 dw TRANSLATEMODE_AUTO
209
210g_rgszChoiceToStringLookupForXlateMode:
211 dw g_szValueDrvXlateNormal
212 dw g_szValueDrvXlateLarge
213 dw g_szValueDrvXlateLBA
214 dw g_szValueDrvXlateAuto
215
216
217; Section containing code
218SECTION .text
219
220;--------------------------------------------------------------------
221; MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
222; Parameters:
223; SS:BP: Menu handle
224; Returns:
225; Nothing
226; Corrupts registers:
227; AX
228;--------------------------------------------------------------------
229ALIGN JUMP_ALIGN
230MasterSlaveMenu_InitializeToDrvparamsOffsetInBX:
231 lea ax, [bx+DRVPARAMS.wFlags]
232 mov [cs:g_MenuitemMasterSlaveBlockModeTransfers+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
233 mov [cs:g_MenuitemMasterSlaveChsTranslateMode+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
234 mov [cs:g_MenuitemMasterSlaveWriteCache+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
235 mov [cs:g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
236 mov [cs:g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
237
238 lea ax, [bx+DRVPARAMS.wCylinders]
239 mov [cs:g_MenuitemMasterSlaveCylinders+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
240
241 lea ax, [bx+DRVPARAMS.bHeads]
242 mov [cs:g_MenuitemMasterSlaveHeads+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
243
244 lea ax, [bx+DRVPARAMS.bSect]
245 mov [cs:g_MenuitemMasterSlaveSectors+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
246
247 lea ax, [bx+DRVPARAMS.dwMaximumLBA]
248 mov [cs:g_MenuitemMasterSlaveUserLbaValue+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
249 ret
250
251
252;--------------------------------------------------------------------
253; MasterSlaveMenu_EnterMenuOrModifyItemVisibility
254; Parameters:
255; SS:BP: Menu handle
256; Returns:
257; Nothing
258; Corrupts registers:
259; All, except BP
260;--------------------------------------------------------------------
261ALIGN JUMP_ALIGN
262MasterSlaveMenu_EnterMenuOrModifyItemVisibility:
263 push cs
264 pop ds
265 call .EnableOrDisableUserCHSandLBA
266 call .EnableOrDisableCHandS
267 call .EnableOrDisableUserLbaValue
268 mov si, g_MenupageForMasterSlaveMenu
269 jmp Menupage_ChangeToNewMenupageInDSSI
270
271
272;--------------------------------------------------------------------
273; .EnableOrDisableUserCHSandLBA
274; Parameters:
275; SS:BP: Menu handle
276; Returns:
277; Nothing
278; Corrupts registers:
279; AX, BX
280;--------------------------------------------------------------------
281ALIGN JUMP_ALIGN
282.EnableOrDisableUserCHSandLBA:
283 mov bx, [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
284 call Buffers_GetRomvarsValueToAXfromOffsetInBX
285 test ax, FLG_DRVPARAMS_USERLBA
286 jnz SHORT .DisableCHSandEnableLBA
287 test ax, FLG_DRVPARAMS_USERCHS
288 jnz SHORT .EnableCHSandDisableLBA
289
290 ; Enable both
291 mov bx, g_MenuitemMasterSlaveUserCHS
292 call EnableMenuitemFromCSBX
293 mov bx, g_MenuitemMasterSlaveUserLBA
294 jmp SHORT .EnableMenuitemFromCSBX
295
296ALIGN JUMP_ALIGN
297.EnableCHSandDisableLBA:
298 mov bx, g_MenuitemMasterSlaveUserCHS
299 call EnableMenuitemFromCSBX
300 mov bx, g_MenuitemMasterSlaveUserLBA
301 jmp SHORT .DisableMenuitemFromCSBX
302
303ALIGN JUMP_ALIGN
304.DisableCHSandEnableLBA:
305 mov bx, g_MenuitemMasterSlaveUserLBA
306 call EnableMenuitemFromCSBX
307 mov bx, g_MenuitemMasterSlaveUserCHS
308 jmp SHORT .DisableMenuitemFromCSBX
309
310
311;--------------------------------------------------------------------
312; .EnableOrDisableCHandS
313; Parameters:
314; SS:BP: Menu handle
315; Returns:
316; Nothing
317; Corrupts registers:
318; AX, BX
319;--------------------------------------------------------------------
320ALIGN JUMP_ALIGN
321.EnableOrDisableCHandS:
322 mov bx, [cs:g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
323 call Buffers_GetRomvarsValueToAXfromOffsetInBX
324 test ax, FLG_DRVPARAMS_USERCHS
325 jz SHORT .DisableCHandS
326 test ax, FLG_DRVPARAMS_USERLBA
327 jnz SHORT .DisableCHandS
328
329 mov bx, g_MenuitemMasterSlaveCylinders
330 call EnableMenuitemFromCSBX
331 mov bx, g_MenuitemMasterSlaveHeads
332 call EnableMenuitemFromCSBX
333 mov bx, g_MenuitemMasterSlaveSectors
334 jmp SHORT .EnableMenuitemFromCSBX
335
336ALIGN JUMP_ALIGN
337.DisableCHandS:
338 mov bx, g_MenuitemMasterSlaveCylinders
339 call DisableMenuitemFromCSBX
340 mov bx, g_MenuitemMasterSlaveHeads
341 call DisableMenuitemFromCSBX
342 mov bx, g_MenuitemMasterSlaveSectors
343 jmp SHORT .DisableMenuitemFromCSBX
344
345
346;--------------------------------------------------------------------
347; .EnableOrDisableUserLbaValue
348; Parameters:
349; SS:BP: Menu handle
350; Returns:
351; Nothing
352; Corrupts registers:
353; AX, BX
354;--------------------------------------------------------------------
355ALIGN JUMP_ALIGN
356.EnableOrDisableUserLbaValue:
357 mov bx, [cs:g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
358 call Buffers_GetRomvarsValueToAXfromOffsetInBX
359 mov bx, g_MenuitemMasterSlaveUserLbaValue
360 test ax, FLG_DRVPARAMS_USERCHS
361 jnz SHORT .DisableMenuitemFromCSBX
362 test ax, FLG_DRVPARAMS_USERLBA
363 jz SHORT .DisableMenuitemFromCSBX
364 ; Fall to .EnableMenuitemFromCSBX
365
366
367;--------------------------------------------------------------------
368; .EnableMenuitemFromCSBX
369; .DisableMenuitemFromCSBX
370; Parameters:
371; CS:BX: Ptr to MENUITEM
372; Returns:
373; Nothing
374; Corrupts registers:
375; Nothing
376;--------------------------------------------------------------------
377ALIGN JUMP_ALIGN
378.EnableMenuitemFromCSBX:
379 jmp EnableMenuitemFromCSBX
380
381ALIGN JUMP_ALIGN
382.DisableMenuitemFromCSBX:
383 jmp DisableMenuitemFromCSBX
384
385
386;--------------------------------------------------------------------
387; MENUITEM value reader functions
388; Parameters:
389; AX: Value from MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
390; DS:SI: Ptr to MENUITEM
391; ES:DI: Ptr to value variable
392; Returns:
393; AX: Value with possible modifications
394; Corrupts registers:
395; Nothing
396;--------------------------------------------------------------------
397ALIGN JUMP_ALIGN
398ValueReaderForUserLbaValue:
399 push dx
400
401 mov ax, [es:di]
402 mov dx, [es:di+2] ; DX:AX now holds user defined LBA28 limit
403 add ax, BYTE 1 ; Increment by one
404 adc dx, BYTE 0
405
406 xchg ax, dx ; SHR 16
407 eSHR_IM ax, 4 ; SHR 4 => AX = DX:AX / (1024*1024)
408
409 pop dx
410 ret
411
412
413;--------------------------------------------------------------------
414; MENUITEM value writer functions
415; Parameters:
416; AX: Value to be written to MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
417; DS:SI: Ptr to MENUITEM
418; ES:DI: Ptr to value variable
419; Returns:
420; AX: Value to be stored
421; Corrupts registers:
422; Nothing
423;--------------------------------------------------------------------
424ALIGN JUMP_ALIGN
425ValueWriterForUserLbaValue:
426 push dx
427
428 xor dx, dx
429 eSHL_IM ax, 4
430 xchg dx, ax ; DX:AX now holds AX * 1024 * 1024
431
432 sub ax, BYTE 1 ; Decrement DX:AX by one
433 sbb dx, BYTE 0 ; (necessary since maximum LBA28 sector count is 0FFF FFFFh)
434
435 mov [es:di+2], dx ; Store DX by ourselves
436 pop dx
437 ret ; AX will be stored by our menu system
438
439;
440; No change to CHS flag, but we use this opportunity to change defaults stored in the CHS values if we are
441; changing in/out of user CHS settings (since we use these bytes in different ways with the LBA setting).
442;
443ALIGN JUMP_ALIGN
444MasterSlaveMenu_WriteCHSFlag:
445 test word [es:di], FLG_DRVPARAMS_USERCHS
446 jnz .alreadySet
447
448 push ax
449 push di
450 push si
451
452 mov ax, MASTERSLAVE_CYLINDERS_DEFAULT
453 mov si, g_MenuitemMasterSlaveCylinders
454 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
455
456 mov ax, MASTERSLAVE_HEADS_DEFAULT
457 mov si, g_MenuitemMasterSlaveHeads
458 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
459
460 mov ax, MASTERSLAVE_SECTORS_DEFAULT
461 mov si, g_MenuitemMasterSlaveSectors
462 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
463
464 pop si
465 pop di
466 pop ax
467
468.alreadySet:
469 ret
470
471;
472; No change to LBA flag, but we use this opportunity to change defaults stored in the LBA value if we are
473; changing in/out of user LBA settings (since we use these bytes in different ways with the CHS setting).
474;
475ALIGN JUMP_ALIGN
476MasterSlaveMenu_WriteLBAFlag:
477 test word [es:di], FLG_DRVPARAMS_USERLBA
478 jnz .alreadySet
479
480 push ax
481 push di
482 push si
483
484 mov ax, MASTERSLAVE_USERLBA_DEFAULT
485 mov si, g_MenuitemMasterSlaveUserLbaValue
486 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
487
488 pop si
489 pop di
490 pop ax
491
492.alreadySet:
493 ret
Note: See TracBrowser for help on using the repository browser.