source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/ConfigurationMenu.asm @ 57

Last change on this file since 57 was 57, checked in by aitotat, 13 years ago

Initial commit (Work in progress).

File size: 11.6 KB
Line 
1; File name     :   ConfigurationMenu.asm
2; Project name  :   XTIDE Universal BIOS Configurator v2
3; Created date  :   24.10.2010
4; Last update   :   3.11.2010
5; Author        :   Tomi Tilli
6; Description   :   "Configure XTIDE Universal BIOS" menu structs and functions.
7
8; Section containing initialized data
9SECTION .data
10
11ALIGN WORD_ALIGN
12g_MenupageForConfigurationMenu:
13istruc MENUPAGE
14    at  MENUPAGE.fnEnter,           dw  ConfigurationMenu_EnterMenuOrModifyItemVisibility
15    at  MENUPAGE.wMenuitems,        dw  11
16iend
17
18g_MenuitemConfigurationBackToMainMenu:
19istruc MENUITEM
20    at  MENUITEM.fnActivate,        dw  MainMenu_EnterMenuOrModifyItemVisibility
21    at  MENUITEM.szName,            dw  g_szItemCfgBackToMain
22    at  MENUITEM.szQuickInfo,       dw  g_szItemCfgBackToMain
23    at  MENUITEM.szHelp,            dw  g_szItemCfgBackToMain
24    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
25    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGEBACK
26iend
27
28g_MenuitemConfigurationPrimaryIdeController:
29istruc MENUITEM
30    at  MENUITEM.fnActivate,        dw  PrimaryIdeController
31    at  MENUITEM.szName,            dw  g_szItemCfgIde1
32    at  MENUITEM.szQuickInfo,       dw  g_szNfoCfgIde
33    at  MENUITEM.szHelp,            dw  g_szNfoCfgIde
34    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
35    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGENEXT
36iend
37
38g_MenuitemConfigurationSecondaryIdeController:
39istruc MENUITEM
40    at  MENUITEM.fnActivate,        dw  SecondaryIdeController
41    at  MENUITEM.szName,            dw  g_szItemCfgIde2
42    at  MENUITEM.szQuickInfo,       dw  g_szNfoCfgIde
43    at  MENUITEM.szHelp,            dw  g_szNfoCfgIde
44    at  MENUITEM.bFlags,            db  NULL
45    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGENEXT
46iend
47
48g_MenuitemConfigurationTertiaryIdeController:
49istruc MENUITEM
50    at  MENUITEM.fnActivate,        dw  TertiaryIdeController
51    at  MENUITEM.szName,            dw  g_szItemCfgIde3
52    at  MENUITEM.szQuickInfo,       dw  g_szNfoCfgIde
53    at  MENUITEM.szHelp,            dw  g_szNfoCfgIde
54    at  MENUITEM.bFlags,            db  NULL
55    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGENEXT
56iend
57
58g_MenuitemConfigurationQuaternaryIdeController:
59istruc MENUITEM
60    at  MENUITEM.fnActivate,        dw  QuaternaryIdeController
61    at  MENUITEM.szName,            dw  g_szItemCfgIde4
62    at  MENUITEM.szQuickInfo,       dw  g_szNfoCfgIde
63    at  MENUITEM.szHelp,            dw  g_szNfoCfgIde
64    at  MENUITEM.bFlags,            db  NULL
65    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGENEXT
66iend
67
68g_MenuitemConfigurationQuinaryIdeController:
69istruc MENUITEM
70    at  MENUITEM.fnActivate,        dw  QuinaryIdeController
71    at  MENUITEM.szName,            dw  g_szItemCfgIde5
72    at  MENUITEM.szQuickInfo,       dw  g_szNfoCfgIde
73    at  MENUITEM.szHelp,            dw  g_szNfoCfgIde
74    at  MENUITEM.bFlags,            db  NULL
75    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGENEXT
76iend
77
78g_MenuitemConfigurationBootMenuSettings:
79istruc MENUITEM
80    at  MENUITEM.fnActivate,        dw  BootMenuSettings
81    at  MENUITEM.szName,            dw  g_szItemCfgBootMenu
82    at  MENUITEM.szQuickInfo,       dw  g_szNfoCfgBootMenu
83    at  MENUITEM.szHelp,            dw  g_szNfoCfgBootMenu
84    at  MENUITEM.bFlags,            db  NULL
85    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGENEXT
86iend
87
88g_MenuitemConfigurationBootLoaderType:
89istruc MENUITEM
90    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiseSelectionForMenuitemInDSSI
91    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromItemInDSSI
92    at  MENUITEM.szName,            dw  g_szItemCfgBootLoader
93    at  MENUITEM.szQuickInfo,       dw  g_szNfoCfgBootLoader
94    at  MENUITEM.szHelp,            dw  g_szNfoCfgBootLoader
95    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE
96    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOISE
97    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  ROMVARS.bBootLdrType
98    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szItemCfgBootLoader
99    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoise,              dw  g_szMultichoiseCfgBootLoader
100    at  MENUITEM.itemValue + ITEM_VALUE.rgwChoiseToValueLookup,     dw  g_rgwChoiseToValueLookupForBootLoaderType
101    at  MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup,    dw  g_rgszValueToStringLookupForBootLoaderType
102iend
103
104g_MenuitemConfigurationFullOperatingMode:
105istruc MENUITEM
106    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiseSelectionForMenuitemInDSSI
107    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromItemInDSSI
108    at  MENUITEM.szName,            dw  g_szItemCfgFullMode
109    at  MENUITEM.szQuickInfo,       dw  g_szNfoCfgFullMode
110    at  MENUITEM.szHelp,            dw  g_szHelpCfgFullMode
111    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
112    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOISE
113    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  ROMVARS.wFlags
114    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgCfgFullMode
115    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoise,              dw  g_szMultichoiseBooleanFlag
116    at  MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup,    dw  g_rgszValueToStringLookupForFlagBooleans
117    at  MENUITEM.itemValue + ITEM_VALUE.wValueBitmask,              dw  FLG_ROMVARS_FULLMODE
118iend
119
120g_MenuitemConfigurationKiBtoStealFromRAM:
121istruc MENUITEM
122    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateUnsignedInputForMenuitemInDSSI
123    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
124    at  MENUITEM.szName,            dw  g_szItemCfgStealSize
125    at  MENUITEM.szQuickInfo,       dw  g_szNfoCfgStealSize
126    at  MENUITEM.szHelp,            dw  g_szHelpCfgStealSize
127    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE
128    at  MENUITEM.bType,             db  TYPE_MENUITEM_UNSIGNED
129    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  ROMVARS.bStealSize
130    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgCfgStealSize
131    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  1
132    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  255
133iend
134
135g_MenuitemConfigurationIdeControllers:
136istruc MENUITEM
137    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateUnsignedInputForMenuitemInDSSI
138    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
139    at  MENUITEM.szName,            dw  g_szItemCfgIdeCnt
140    at  MENUITEM.szQuickInfo,       dw  g_szNfoCfgIdeCnt
141    at  MENUITEM.szHelp,            dw  g_szNfoCfgIdeCnt
142    at  MENUITEM.bFlags,            db  FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_BYTEVALUE
143    at  MENUITEM.bType,             db  TYPE_MENUITEM_UNSIGNED
144    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  ROMVARS.bIdeCnt
145    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgCfgIdeCnt
146    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  1
147    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  5
148iend
149
150
151g_rgwChoiseToValueLookupForBootLoaderType:
152    dw  BOOTLOADER_TYPE_MENU
153    dw  BOOTLOADER_TYPE_SIMPLE
154    dw  BOOTLOADER_TYPE_NONE
155g_rgszValueToStringLookupForBootLoaderType:
156    dw  g_szValueCfgBootLoaderMenu
157    dw  g_szValueCfgBootLoaderAthenC
158    dw  g_szUnidentified
159    dw  g_szValueCfgBootLoaderSystem
160   
161
162; Section containing code
163SECTION .text
164
165;--------------------------------------------------------------------
166; MainMenu_EnterMenuOrModifyItemVisibility
167;   Parameters:
168;       SS:BP:  Menu handle
169;   Returns:
170;       Nothing
171;   Corrupts registers:
172;       All, except BP
173;--------------------------------------------------------------------
174ALIGN JUMP_ALIGN
175ConfigurationMenu_EnterMenuOrModifyItemVisibility:
176    push    cs
177    pop     ds
178    call    .DisableAllIdeControllerMenuitems
179    call    .EnableIdeControllerMenuitemsBasedOnConfiguration
180    call    .EnableOrDisableKiBtoStealFromRAM
181    call    .EnableOrDisableIdeControllerCount
182    mov     si, g_MenupageForConfigurationMenu
183    jmp     Menupage_ChangeToNewMenupageInDSSI
184
185;--------------------------------------------------------------------
186; .DisableAllIdeControllerMenuitems
187; .EnableIdeControllerMenuitemsBasedOnConfiguration
188;   Parameters:
189;       SS:BP:  Menu handle
190;   Returns:
191;       Nothing
192;   Corrupts registers:
193;       AX, BX, CX
194;--------------------------------------------------------------------
195ALIGN JUMP_ALIGN
196.DisableAllIdeControllerMenuitems:
197    mov     cx, MAX_ALLOWED_IDE_CONTROLLERS-1
198    mov     bx, g_MenuitemConfigurationSecondaryIdeController
199ALIGN JUMP_ALIGN
200.DisableNextIdeControllerMenuitem:
201    call    .DisableMenuitemFromCSBX
202    add     bx, BYTE MENUITEM_size
203    loop    .DisableNextIdeControllerMenuitem
204    ret
205
206ALIGN JUMP_ALIGN
207.EnableIdeControllerMenuitemsBasedOnConfiguration:
208    call    .GetIdeControllerCountToCX
209    dec     cx          ; Primary always enabled
210    jcxz    .PrimaryControllerAlreadyEnabled
211    mov     bx, g_MenuitemConfigurationSecondaryIdeController
212ALIGN JUMP_ALIGN
213.EnableNextIdeControllerMenuitem:
214    call    .EnableMenuitemFromCSBX
215    add     bx, BYTE MENUITEM_size
216    loop    .EnableNextIdeControllerMenuitem
217.PrimaryControllerAlreadyEnabled:
218    ret
219
220;--------------------------------------------------------------------
221; .GetIdeControllerCountToCX
222;   Parameters:
223;       SS:BP:  Menu handle
224;   Returns:
225;       CX:     Number of IDE controllers to configure
226;   Corrupts registers:
227;       AX, BX
228;--------------------------------------------------------------------
229ALIGN JUMP_ALIGN
230.GetIdeControllerCountToCX:
231    mov     bx, ROMVARS.wFlags
232    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
233    test    ax, FLG_ROMVARS_FULLMODE
234    jz      SHORT .AllowOnlyOneIdeControllerInLiteMode
235
236    mov     bx, ROMVARS.bIdeCnt
237    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
238    eMOVZX  cx, al
239    ret
240ALIGN JUMP_ALIGN
241.AllowOnlyOneIdeControllerInLiteMode:
242    mov     cx, 1
243    ret
244
245;--------------------------------------------------------------------
246; .EnableOrDisableKiBtoStealFromRAM
247;   Parameters:
248;       SS:BP:  Menu handle
249;   Returns:
250;       Nothing
251;   Corrupts registers:
252;       AX, BX, CX
253;--------------------------------------------------------------------
254ALIGN JUMP_ALIGN
255.EnableOrDisableKiBtoStealFromRAM:
256    mov     bx, ROMVARS.wFlags
257    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
258    mov     bx, g_MenuitemConfigurationKiBtoStealFromRAM
259    test    ax, FLG_ROMVARS_FULLMODE
260    jz      SHORT .DisableMenuitemFromCSBX
261    jmp     SHORT .EnableMenuitemFromCSBX
262
263;--------------------------------------------------------------------
264; .EnableOrDisableKiBtoStealFromRAM
265;   Parameters:
266;       SS:BP:  Menu handle
267;   Returns:
268;       Nothing
269;   Corrupts registers:
270;       AX, BX
271;--------------------------------------------------------------------
272ALIGN JUMP_ALIGN
273.EnableOrDisableIdeControllerCount:
274    mov     bx, ROMVARS.wFlags
275    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
276    mov     bx, g_MenuitemConfigurationIdeControllers
277    test    ax, FLG_ROMVARS_FULLMODE
278    jz      SHORT .DisableMenuitemFromCSBX
279    jmp     SHORT .EnableMenuitemFromCSBX
280
281;--------------------------------------------------------------------
282; .EnableMenuitemFromCSBX
283; .DisableMenuitemFromCSBX
284;   Parameters:
285;       CS:BX:  Ptr to MENUITEM
286;   Returns:
287;       Nothing
288;   Corrupts registers:
289;       Nothing
290;--------------------------------------------------------------------
291ALIGN JUMP_ALIGN
292.EnableMenuitemFromCSBX:
293    or      BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
294    ret
295
296ALIGN JUMP_ALIGN
297.DisableMenuitemFromCSBX:
298    and     BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
299    ret
300
301
302
303;--------------------------------------------------------------------
304; MENUITEM activation functions (.fnActivate)
305;   Parameters:
306;       SS:BP:  Ptr to MENU
307;   Returns:
308;       Nothing
309;   Corrupts registers:
310;       All, except segments
311;--------------------------------------------------------------------
312ALIGN JUMP_ALIGN
313PrimaryIdeController:
314    mov     bx, ROMVARS.ideVars0
315    jmp     SHORT DisplayIdeControllerMenu
316
317ALIGN JUMP_ALIGN
318SecondaryIdeController:
319    mov     bx, ROMVARS.ideVars1
320    jmp     SHORT DisplayIdeControllerMenu
321
322ALIGN JUMP_ALIGN
323TertiaryIdeController:
324    mov     bx, ROMVARS.ideVars2
325    jmp     SHORT DisplayIdeControllerMenu
326
327ALIGN JUMP_ALIGN
328QuaternaryIdeController:
329    mov     bx, ROMVARS.ideVars3
330    jmp     SHORT DisplayIdeControllerMenu
331
332ALIGN JUMP_ALIGN
333QuinaryIdeController:
334    mov     bx, ROMVARS.ideVars4
335    ; Fall to DisplayIdeControllerMenu
336
337ALIGN JUMP_ALIGN
338DisplayIdeControllerMenu:
339    call    IdeControllerMenu_InitializeToIdevarsOffsetInBX
340    jmp     IdeControllerMenu_EnterMenuOrModifyItemVisibility
341
342
343ALIGN JUMP_ALIGN
344BootMenuSettings:
345    ret
Note: See TracBrowser for help on using the repository browser.