source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MainMenu.asm@ 58

Last change on this file since 58 was 57, checked in by Tomi Tilli, 14 years ago

Initial commit (Work in progress).

File size: 7.7 KB
Line 
1; File name : MainMenu.asm
2; Project name : XTIDE Universal BIOS Configurator v2
3; Created date : 6.10.2010
4; Last update : 2.11.2010
5; Author : Tomi Tilli
6; Description : Main menu structs and functions.
7
8; Section containing initialized data
9SECTION .data
10
11ALIGN WORD_ALIGN
12g_MenupageForMainMenu:
13istruc MENUPAGE
14 at MENUPAGE.fnEnter, dw MainMenu_EnterMenuOrModifyItemVisibility
15 at MENUPAGE.wMenuitems, dw 6
16iend
17
18g_MenuitemMainMenuExitToDos:
19istruc MENUITEM
20 at MENUITEM.fnActivate, dw ExitToDos
21 at MENUITEM.szName, dw g_szItemMainExitToDOS
22 at MENUITEM.szQuickInfo, dw g_szNfoMainExitToDOS
23 at MENUITEM.szHelp, dw g_szNfoMainExitToDOS
24 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
25 at MENUITEM.bType, db TYPE_MENUITEM_PAGEBACK
26iend
27
28g_MenuitemMainMenuLoadBiosFromFile:
29istruc MENUITEM
30 at MENUITEM.fnActivate, dw LoadBiosFromFile
31 at MENUITEM.szName, dw g_szItemMainLoadFile
32 at MENUITEM.szQuickInfo, dw g_szNfoMainLoadFile
33 at MENUITEM.szHelp, dw g_szNfoMainLoadFile
34 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
35 at MENUITEM.bType, db TYPE_MENUITEM_ACTION
36iend
37
38g_MenuitemMainMenuLoadXtideUniversalBiosFromRom:
39istruc MENUITEM
40 at MENUITEM.fnActivate, dw LoadXtideUniversalBiosFromRom
41 at MENUITEM.szName, dw g_szItemMainLoadROM
42 at MENUITEM.szQuickInfo, dw g_szNfoMainLoadROM
43 at MENUITEM.szHelp, dw g_szNfoMainLoadROM
44 at MENUITEM.bFlags, db NULL
45 at MENUITEM.bType, db TYPE_MENUITEM_ACTION
46iend
47
48g_MenuitemMainMenuLoadOldSettingsFromEeprom:
49istruc MENUITEM
50 at MENUITEM.fnActivate, dw LoadOldSettingsFromEeprom
51 at MENUITEM.szName, dw g_szItemMainLoadStngs
52 at MENUITEM.szQuickInfo, dw g_szNfoMainLoadStngs
53 at MENUITEM.szHelp, dw g_szNfoMainLoadStngs
54 at MENUITEM.bFlags, db NULL
55 at MENUITEM.bType, db TYPE_MENUITEM_ACTION
56iend
57
58g_MenuitemMainMenuConfigureXtideUniversalBios:
59istruc MENUITEM
60 at MENUITEM.fnActivate, dw ConfigureXtideUniversalBios
61 at MENUITEM.szName, dw g_szItemMainConfigure
62 at MENUITEM.szQuickInfo, dw g_szNfoMainConfigure
63 at MENUITEM.szHelp, dw g_szNfoMainConfigure
64 at MENUITEM.bFlags, db NULL
65 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
66iend
67
68g_MenuitemMainMenuFlashEeprom:
69istruc MENUITEM
70 at MENUITEM.fnActivate, dw FlashEeprom
71 at MENUITEM.szName, dw g_szItemMainFlash
72 at MENUITEM.szQuickInfo, dw g_szNfoMainFlash
73 at MENUITEM.szHelp, dw g_szNfoMainFlash
74 at MENUITEM.bFlags, db NULL
75 at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
76iend
77
78%if FALSE
79g_Menuitem:
80istruc MENUITEM
81 at MENUITEM.fnActivate, dw NULL
82 at MENUITEM.fnFormatValue, dw NULL
83 at MENUITEM.szName, dw NULL
84 at MENUITEM.szQuickInfo, dw NULL
85 at MENUITEM.szHelp, dw NULL
86 at MENUITEM.bFlags, db NULL
87 at MENUITEM.bType, db NULL
88 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw NULL
89 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw NULL
90 at MENUITEM.itemValue + ITEM_VALUE.szMultichoise, dw NULL
91 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiseToValueLookup, dw NULL
92 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw NULL
93 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw NULL
94 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw NULL
95 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw NULL
96iend
97%endif
98
99
100; Section containing code
101SECTION .text
102
103;--------------------------------------------------------------------
104; MainMenu_EnterMenuOrModifyItemVisibility
105; Parameters:
106; SS:BP: Menu handle
107; Returns:
108; Nothing
109; Corrupts registers:
110; All, except BP
111;--------------------------------------------------------------------
112ALIGN JUMP_ALIGN
113MainMenu_EnterMenuOrModifyItemVisibility:
114 push cs
115 pop ds
116 call .EnableOrDisableXtideRomItems
117 call .EnableOrDisableConfigureXtideUniversalBios
118 call .EnableOrDisableFlashEeprom
119 mov si, g_MenupageForMainMenu
120 jmp Menupage_ChangeToNewMenupageInDSSI
121
122;--------------------------------------------------------------------
123; .EnableOrDisableXtideRomItems
124; Parameters:
125; DS: CFGVARS segment
126; Returns:
127; Nothing
128; Corrupts registers:
129; AX, BX, CX, SI, DI, ES
130;--------------------------------------------------------------------
131ALIGN JUMP_ALIGN
132.EnableOrDisableXtideRomItems:
133 call EEPROM_FindXtideUniversalBiosROMtoESDI
134 jnc SHORT .DisableAllRomItems
135 or BYTE [g_MenuitemMainMenuLoadXtideUniversalBiosFromRom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
136 call Buffers_IsXtideUniversalBiosLoaded
137 jne SHORT .DisableLoadSettingFromRom
138 or BYTE [g_MenuitemMainMenuLoadOldSettingsFromEeprom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
139 ret
140
141ALIGN JUMP_ALIGN
142.DisableAllRomItems:
143 and BYTE [g_MenuitemMainMenuLoadXtideUniversalBiosFromRom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
144.DisableLoadSettingFromRom:
145 and BYTE [g_MenuitemMainMenuLoadOldSettingsFromEeprom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
146 ret
147
148;--------------------------------------------------------------------
149; .EnableOrDisableConfigureXtideUniversalBios
150; Parameters:
151; DS: CFGVARS segment
152; Returns:
153; Nothing
154; Corrupts registers:
155; CX, SI, DI, ES
156;--------------------------------------------------------------------
157ALIGN JUMP_ALIGN
158.EnableOrDisableConfigureXtideUniversalBios:
159 call Buffers_IsXtideUniversalBiosLoaded
160 jne SHORT .DisableConfigureXtideUniversalBios
161 or BYTE [g_MenuitemMainMenuConfigureXtideUniversalBios+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
162 ret
163
164ALIGN JUMP_ALIGN
165.DisableConfigureXtideUniversalBios:
166 and BYTE [g_MenuitemMainMenuConfigureXtideUniversalBios+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
167 ret
168
169;--------------------------------------------------------------------
170; .EnableOrDisableFlashEeprom
171; Parameters:
172; DS: CFGVARS segment
173; Returns:
174; Nothing
175; Corrupts registers:
176; Nothing
177;--------------------------------------------------------------------
178ALIGN JUMP_ALIGN
179.EnableOrDisableFlashEeprom:
180 test WORD [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
181 jz SHORT .DisableFlashEeprom
182 or BYTE [g_MenuitemMainMenuFlashEeprom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
183 ret
184
185ALIGN JUMP_ALIGN
186.DisableFlashEeprom:
187 and BYTE [g_MenuitemMainMenuFlashEeprom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
188 ret
189
190
191
192;--------------------------------------------------------------------
193; MENUITEM activation functions (.fnActivate)
194; Parameters:
195; SS:BP: Ptr to MENU
196; Returns:
197; Nothing
198; Corrupts registers:
199; All, except segments
200;--------------------------------------------------------------------
201ALIGN JUMP_ALIGN
202ExitToDos:
203 CALL_MENU_LIBRARY Close
204 ret
205
206
207ALIGN JUMP_ALIGN
208LoadBiosFromFile:
209 mov cx, FILE_DIALOG_IO_size
210 call Memory_ReserveCXbytesFromStackToDSSI
211 call Dialogs_DisplayFileDialogWithDialogIoInDSSI
212 cmp BYTE [si+FILE_DIALOG_IO.bUserCancellation], TRUE
213 je SHORT .CancelFileLoading
214
215 add si, BYTE FILE_DIALOG_IO.szFile
216 call BiosFile_LoadFileFromDSSItoRamBuffer
217 call MainMenu_EnterMenuOrModifyItemVisibility
218.CancelFileLoading:
219 add sp, BYTE FILE_DIALOG_IO_size
220 ret
221
222
223ALIGN JUMP_ALIGN
224LoadXtideUniversalBiosFromRom:
225 call EEPROM_LoadXtideUniversalBiosFromRomToRamBuffer
226 mov ax, FLG_CFGVARS_ROMLOADED
227 call Buffers_NewBiosWithSizeInCXandSourceInAXhasBeenLoadedForConfiguration
228 push cs
229 pop ds
230 mov si, g_szDlgMainLoadROM
231 CALL_MENU_LIBRARY DisplayMessageWithInputInDSSI
232 ret
233
234
235ALIGN JUMP_ALIGN
236LoadOldSettingsFromEeprom:
237 call EEPROM_LoadOldSettingsFromRomToRamBuffer
238 and WORD [g_cfgVars+CFGVARS.wFlags], ~FLG_CFGVARS_UNSAVED
239 push cs
240 pop ds
241 mov si, g_szDlgMainLoadStngs
242 CALL_MENU_LIBRARY DisplayMessageWithInputInDSSI
243 ret
244
245
246ALIGN JUMP_ALIGN
247ConfigureXtideUniversalBios:
248 jmp ConfigurationMenu_EnterMenuOrModifyItemVisibility
249
250
251ALIGN JUMP_ALIGN
252FlashEeprom:
253 ret
Note: See TracBrowser for help on using the repository browser.