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

Last change on this file since 473 was 425, checked in by Tomi Tilli, 13 years ago

Changes to Configurator v2:

  • User defined LBA minimum is restored to 16 million sectors.
  • P-CHS to L-CHS translation method can now be chosen.
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-2012 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_USER_CYLINDERS
123%define MASTERSLAVE_CYLINDERS_DEFAULT 65
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_USER_HEADS
139%define MASTERSLAVE_HEADS_DEFAULT MAX_USER_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_USER_SECTORS_PER_TRACK
155%define MASTERSLAVE_SECTORS_DEFAULT MAX_USER_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
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
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 .EnableMenuitemFromCSBX
295
296ALIGN JUMP_ALIGN
297.EnableCHSandDisableLBA:
298 mov bx, g_MenuitemMasterSlaveUserCHS
299 call .EnableMenuitemFromCSBX
300 mov bx, g_MenuitemMasterSlaveUserLBA
301 jmp .DisableMenuitemFromCSBX
302
303ALIGN JUMP_ALIGN
304.DisableCHSandEnableLBA:
305 mov bx, g_MenuitemMasterSlaveUserLBA
306 call .EnableMenuitemFromCSBX
307 mov bx, g_MenuitemMasterSlaveUserCHS
308 jmp .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 or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
380 ret
381
382ALIGN JUMP_ALIGN
383.DisableMenuitemFromCSBX:
384 and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
385 ret
386
387
388;--------------------------------------------------------------------
389; MENUITEM value reader functions
390; Parameters:
391; AX: Value from MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
392; DS:SI: Ptr to MENUITEM
393; ES:DI: Ptr to value variable
394; Returns:
395; AX: Value with possible modifications
396; Corrupts registers:
397; Nothing
398;--------------------------------------------------------------------
399ALIGN JUMP_ALIGN
400ValueReaderForUserLbaValue:
401 push dx
402
403 mov ax, [es:di]
404 mov dx, [es:di+2] ; DX:AX now holds user defined LBA28 limit
405 add ax, BYTE 1 ; Increment by one
406 adc dx, BYTE 0
407
408 xchg ax, dx ; SHR 16
409 eSHIFT_IM ax, 4, shr ; SHR 4 => AX = DX:AX / (1024*1024)
410
411 pop dx
412 ret
413
414
415;--------------------------------------------------------------------
416; MENUITEM value writer functions
417; Parameters:
418; AX: Value to be written to MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
419; DS:SI: Ptr to MENUITEM
420; ES:DI: Ptr to value variable
421; Returns:
422; AX: Value to be stored
423; Corrupts registers:
424; Nothing
425;--------------------------------------------------------------------
426ALIGN JUMP_ALIGN
427ValueWriterForUserLbaValue:
428 push dx
429
430 xor dx, dx
431 eSHIFT_IM ax, 4, shl
432 xchg dx, ax ; DX:AX now holds AX * 1024 * 1024
433
434 sub ax, BYTE 1 ; Decrement DX:AX by one
435 sbb dx, BYTE 0 ; (necessary since maximum LBA28 sector count is 0FFF FFFFh)
436
437 mov [es:di+2], dx ; Store DX by ourselves
438 pop dx
439 ret ; AX will be stored by our menu system
440
441;
442; No change to CHS flag, but we use this opportunity to change defaults stored in the CHS values if we are
443; changing in/out of user CHS settings (since we use these bytes in different ways with the LBA setting).
444;
445ALIGN JUMP_ALIGN
446MasterSlaveMenu_WriteCHSFlag:
447 test word [es:di], FLG_DRVPARAMS_USERCHS
448 jnz .alreadySet
449
450 push ax
451 push di
452 push si
453
454 mov ax, MASTERSLAVE_CYLINDERS_DEFAULT
455 mov si, g_MenuitemMasterSlaveCylinders
456 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
457
458 mov ax, MASTERSLAVE_HEADS_DEFAULT
459 mov si, g_MenuitemMasterSlaveHeads
460 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
461
462 mov ax, MASTERSLAVE_SECTORS_DEFAULT
463 mov si, g_MenuitemMasterSlaveSectors
464 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
465
466 pop si
467 pop di
468 pop ax
469
470.alreadySet:
471 ret
472
473;
474; No change to LBA flag, but we use this opportunity to change defaults stored in the LBA value if we are
475; changing in/out of user LBA settings (since we use these bytes in different ways with the CHS setting).
476;
477ALIGN JUMP_ALIGN
478MasterSlaveMenu_WriteLBAFlag:
479 test word [es:di], FLG_DRVPARAMS_USERLBA
480 jnz .alreadySet
481
482 push ax
483 push di
484 push si
485
486 mov ax, MASTERSLAVE_USERLBA_DEFAULT
487 mov si, g_MenuitemMasterSlaveUserLbaValue
488 call Menuitem_StoreValueFromAXtoMenuitemInDSSI
489
490 pop si
491 pop di
492 pop ax
493
494.alreadySet:
495 ret
Note: See TracBrowser for help on using the repository browser.