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

Last change on this file since 292 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: 14.2 KB
Line 
1; Project name : XTIDE Universal BIOS Configurator v2
2; Description : "Master/Slave Drive" menu structs and functions.
3
4; Section containing initialized data
5SECTION .data
6
7ALIGN WORD_ALIGN
8g_MenupageForMasterSlaveMenu:
9istruc MENUPAGE
10 at MENUPAGE.fnEnter, dw MasterSlaveMenu_EnterMenuOrModifyItemVisibility
11 at MENUPAGE.fnBack, dw IdeControllerMenu_EnterMenuOrModifyItemVisibility
12 at MENUPAGE.wMenuitems, dw 9
13iend
14
15g_MenuitemMasterSlaveBackToIdeControllerMenu:
16istruc MENUITEM
17 at MENUITEM.fnActivate, dw IdeControllerMenu_EnterMenuOrModifyItemVisibility
18 at MENUITEM.szName, dw g_szItemDrvBackToIde
19 at MENUITEM.szQuickInfo, dw g_szItemDrvBackToIde
20 at MENUITEM.szHelp, dw g_szItemDrvBackToIde
21 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
22 at MENUITEM.bType, db TYPE_MENUITEM_PAGEBACK
23iend
24
25g_MenuitemMasterSlaveBlockModeTransfers:
26istruc MENUITEM
27 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
28 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
29 at MENUITEM.szName, dw g_szItemDrvBlockMode
30 at MENUITEM.szQuickInfo, dw g_szNfoDrvBlockMode
31 at MENUITEM.szHelp, dw g_szHelpDrvBlockMode
32 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_FLAGVALUE
33 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
34 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
35 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvBlockMode
36 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
37 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
38 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_DRVPARAMS_BLOCKMODE
39iend
40
41g_MenuitemMasterSlaveWriteCache:
42istruc MENUITEM
43 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
44 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
45 at MENUITEM.szName, dw g_szItemDrvWriteCache
46 at MENUITEM.szQuickInfo, dw g_szNfoDrvWriteCache
47 at MENUITEM.szHelp, dw g_szHelpDrvWriteCache
48 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MASKVALUE
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_szDlgDrvWriteCache
52 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiseWrCache
53 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForWriteCache
54 at MENUITEM.itemValue + ITEM_VALUE.rgszChoiceToStringLookup, dw g_rgszChoiceToStringLookupForWriteCache
55 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw MASK_DRVPARAMS_WRITECACHE
56iend
57
58g_MenuitemMasterSlaveUserCHS:
59istruc MENUITEM
60 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
61 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
62 at MENUITEM.szName, dw g_szItemDrvUserCHS
63 at MENUITEM.szQuickInfo, dw g_szNfoDrvUserCHS
64 at MENUITEM.szHelp, dw g_szHelpDrvUserCHS
65 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
66 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
67 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
68 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvUserCHS
69 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
70 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
71 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_DRVPARAMS_USERCHS
72iend
73
74g_MenuitemMasterSlaveCylinders:
75istruc MENUITEM
76 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
77 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
78 at MENUITEM.szName, dw g_szItemDrvCyls
79 at MENUITEM.szQuickInfo, dw g_szNfoDrvCyls
80 at MENUITEM.szHelp, dw g_szNfoDrvCyls
81 at MENUITEM.bFlags, db NULL
82 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
83 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
84 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvCyls
85 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
86 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 16383
87iend
88
89g_MenuitemMasterSlaveHeads:
90istruc MENUITEM
91 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
92 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
93 at MENUITEM.szName, dw g_szItemDrvHeads
94 at MENUITEM.szQuickInfo, dw g_szNfoDrvHeads
95 at MENUITEM.szHelp, dw g_szNfoDrvHeads
96 at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE
97 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
98 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
99 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvHeads
100 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
101 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 16
102iend
103
104g_MenuitemMasterSlaveSectors:
105istruc MENUITEM
106 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
107 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
108 at MENUITEM.szName, dw g_szItemDrvSect
109 at MENUITEM.szQuickInfo, dw g_szNfoDrvSect
110 at MENUITEM.szHelp, dw g_szNfoDrvSect
111 at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE
112 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
113 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
114 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvSect
115 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 1
116 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 63
117iend
118
119g_MenuitemMasterSlaveUserLBA:
120istruc MENUITEM
121 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
122 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
123 at MENUITEM.szName, dw g_szItemDrvUserLBA
124 at MENUITEM.szQuickInfo, dw g_szNfoDrvUserLBA
125 at MENUITEM.szHelp, dw g_szHelpDrvUserLBA
126 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
127 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
128 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
129 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvUserLBA
130 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
131 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
132 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_DRVPARAMS_USERLBA
133iend
134
135g_MenuitemMasterSlaveUserLbaValue:
136istruc MENUITEM
137 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
138 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
139 at MENUITEM.szName, dw g_szItemDrvLbaSectors
140 at MENUITEM.szQuickInfo, dw g_szNfoDrvLbaSectors
141 at MENUITEM.szHelp, dw g_szNfoDrvLbaSectors
142 at MENUITEM.bFlags, db NULL
143 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
144 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
145 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgDrvLbaSectors
146 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw ((16383*16*63) / (1024 * 1024)) + 1 ; One sector over 8.4 GB
147 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 10000000h / (1024 * 1024) ; Limit to 28-bit LBA
148 at MENUITEM.itemValue + ITEM_VALUE.fnValueReader, dw ValueReaderForUserLbaValue
149 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw ValueWriterForUserLbaValue
150iend
151
152
153g_rgwChoiceToValueLookupForWriteCache:
154 dw DEFAULT_WRITE_CACHE
155 dw DISABLE_WRITE_CACHE
156 dw ENABLE_WRITE_CACHE
157
158g_rgszChoiceToStringLookupForWriteCache:
159 dw g_szValueBootDispModeDefault
160 dw g_szValueDrvWrCaDis
161 dw g_szValueDrvWrCaEn
162
163
164; Section containing code
165SECTION .text
166
167;--------------------------------------------------------------------
168; MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
169; Parameters:
170; SS:BP: Menu handle
171; Returns:
172; Nothing
173; Corrupts registers:
174; AX
175;--------------------------------------------------------------------
176ALIGN JUMP_ALIGN
177MasterSlaveMenu_InitializeToDrvparamsOffsetInBX:
178 lea ax, [bx+DRVPARAMS.wFlags]
179 mov [cs:g_MenuitemMasterSlaveBlockModeTransfers+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
180 mov [cs:g_MenuitemMasterSlaveWriteCache+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
181 mov [cs:g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
182 mov [cs:g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
183
184 lea ax, [bx+DRVPARAMS.wCylinders]
185 mov [cs:g_MenuitemMasterSlaveCylinders+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
186
187 lea ax, [bx+DRVPARAMS.bHeads]
188 mov [cs:g_MenuitemMasterSlaveHeads+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
189
190 lea ax, [bx+DRVPARAMS.bSect]
191 mov [cs:g_MenuitemMasterSlaveSectors+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
192
193 lea ax, [bx+DRVPARAMS.dwMaximumLBA]
194 mov [cs:g_MenuitemMasterSlaveUserLbaValue+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
195 ret
196
197
198;--------------------------------------------------------------------
199; MasterSlaveMenu_EnterMenuOrModifyItemVisibility
200; Parameters:
201; SS:BP: Menu handle
202; Returns:
203; Nothing
204; Corrupts registers:
205; All, except BP
206;--------------------------------------------------------------------
207ALIGN JUMP_ALIGN
208MasterSlaveMenu_EnterMenuOrModifyItemVisibility:
209 push cs
210 pop ds
211 call .EnableOrDisableUserCHSandLBA
212 call .EnableOrDisableCHandS
213 call .EnableOrDisableUserLbaValue
214 mov si, g_MenupageForMasterSlaveMenu
215 jmp Menupage_ChangeToNewMenupageInDSSI
216
217
218;--------------------------------------------------------------------
219; .EnableOrDisableUserCHSandLBA
220; Parameters:
221; SS:BP: Menu handle
222; Returns:
223; Nothing
224; Corrupts registers:
225; AX, BX
226;--------------------------------------------------------------------
227ALIGN JUMP_ALIGN
228.EnableOrDisableUserCHSandLBA:
229 mov bx, [g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
230 call Buffers_GetRomvarsValueToAXfromOffsetInBX
231 test ax, FLG_DRVPARAMS_USERLBA
232 jnz SHORT .DisableCHSandEnableLBA
233 test ax, FLG_DRVPARAMS_USERCHS
234 jnz SHORT .EnableCHSandDisableLBA
235
236 ; Enable both
237 mov bx, g_MenuitemMasterSlaveUserCHS
238 call .EnableMenuitemFromCSBX
239 mov bx, g_MenuitemMasterSlaveUserLBA
240 jmp .EnableMenuitemFromCSBX
241
242ALIGN JUMP_ALIGN
243.EnableCHSandDisableLBA:
244 mov bx, g_MenuitemMasterSlaveUserCHS
245 call .EnableMenuitemFromCSBX
246 mov bx, g_MenuitemMasterSlaveUserLBA
247 jmp .DisableMenuitemFromCSBX
248
249ALIGN JUMP_ALIGN
250.DisableCHSandEnableLBA:
251 mov bx, g_MenuitemMasterSlaveUserLBA
252 call .EnableMenuitemFromCSBX
253 mov bx, g_MenuitemMasterSlaveUserCHS
254 jmp .DisableMenuitemFromCSBX
255
256
257;--------------------------------------------------------------------
258; .EnableOrDisableCHandS
259; Parameters:
260; SS:BP: Menu handle
261; Returns:
262; Nothing
263; Corrupts registers:
264; AX, BX
265;--------------------------------------------------------------------
266ALIGN JUMP_ALIGN
267.EnableOrDisableCHandS:
268 mov bx, [cs:g_MenuitemMasterSlaveUserCHS+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
269 call Buffers_GetRomvarsValueToAXfromOffsetInBX
270 test ax, FLG_DRVPARAMS_USERCHS
271 jz SHORT .DisableCHandS
272 test ax, FLG_DRVPARAMS_USERLBA
273 jnz SHORT .DisableCHandS
274
275 mov bx, g_MenuitemMasterSlaveCylinders
276 call .EnableMenuitemFromCSBX
277 mov bx, g_MenuitemMasterSlaveHeads
278 call .EnableMenuitemFromCSBX
279 mov bx, g_MenuitemMasterSlaveSectors
280 jmp SHORT .EnableMenuitemFromCSBX
281
282ALIGN JUMP_ALIGN
283.DisableCHandS:
284 mov bx, g_MenuitemMasterSlaveCylinders
285 call .DisableMenuitemFromCSBX
286 mov bx, g_MenuitemMasterSlaveHeads
287 call .DisableMenuitemFromCSBX
288 mov bx, g_MenuitemMasterSlaveSectors
289 jmp SHORT .DisableMenuitemFromCSBX
290
291
292;--------------------------------------------------------------------
293; .EnableOrDisableUserLbaValue
294; Parameters:
295; SS:BP: Menu handle
296; Returns:
297; Nothing
298; Corrupts registers:
299; AX, BX
300;--------------------------------------------------------------------
301ALIGN JUMP_ALIGN
302.EnableOrDisableUserLbaValue:
303 mov bx, [cs:g_MenuitemMasterSlaveUserLBA+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
304 call Buffers_GetRomvarsValueToAXfromOffsetInBX
305 mov bx, g_MenuitemMasterSlaveUserLbaValue
306 test ax, FLG_DRVPARAMS_USERCHS
307 jnz SHORT .DisableMenuitemFromCSBX
308 test ax, FLG_DRVPARAMS_USERLBA
309 jz SHORT .DisableMenuitemFromCSBX
310 jmp SHORT .EnableMenuitemFromCSBX
311
312
313;--------------------------------------------------------------------
314; .EnableMenuitemFromCSBX
315; .DisableMenuitemFromCSBX
316; Parameters:
317; CS:BX: Ptr to MENUITEM
318; Returns:
319; Nothing
320; Corrupts registers:
321; Nothing
322;--------------------------------------------------------------------
323ALIGN JUMP_ALIGN
324.EnableMenuitemFromCSBX:
325 or BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
326 ret
327
328ALIGN JUMP_ALIGN
329.DisableMenuitemFromCSBX:
330 and BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
331 ret
332
333
334;--------------------------------------------------------------------
335; MENUITEM value reader functions
336; Parameters:
337; AX: Value from MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
338; DS:SI: Ptr to MENUITEM
339; ES:DI: Ptr to value variable
340; Returns:
341; AX: Value with possible modifications
342; Corrupts registers:
343; Nothing
344;--------------------------------------------------------------------
345ALIGN JUMP_ALIGN
346ValueReaderForUserLbaValue:
347 mov ax, [es:di+2] ; SHR 16
348 eSHIFT_IM ax, 4, shr ; SHR 16 + 4 = 20
349 ret
350
351
352;--------------------------------------------------------------------
353; MENUITEM value writer functions
354; Parameters:
355; AX: Value to be written to MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset
356; DS:SI: Ptr to MENUITEM
357; ES:DI: Ptr to value variable
358; Returns:
359; AX: Value to be stored
360; Corrupts registers:
361; Nothing
362;--------------------------------------------------------------------
363ALIGN JUMP_ALIGN
364ValueWriterForUserLbaValue:
365 eSHIFT_IM ax, 4, shl
366 mov [es:di+2], ax
367 xor ax, ax ; Store zero to [es:di]
368 ret
Note: See TracBrowser for help on using the repository browser.