source: xtideuniversalbios/trunk/Configurator/Src/Menupages/MainMenu.asm@ 470

Last change on this file since 470 was 2, checked in by Tomi Tilli, 15 years ago
File size: 8.9 KB
Line 
1; File name : MainMenu.asm
2; Project name : XTIDE Univeral BIOS Configurator
3; Created date : 19.4.2010
4; Last update : 2.5.2010
5; Author : Tomi Tilli
6; Description : Main menu.
7
8; Section containing initialized data
9SECTION .data
10
11ALIGN WORD_ALIGN
12g_MenuPageMain:
13istruc MENUPAGE
14 at MENUPAGE.bItemCnt, db 6
15iend
16istruc MENUPAGEITEM ; Exit to DOS
17 at MENUPAGEITEM.fnActivate, dw MainPageItem_ActivateLeaveSubmenu
18 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
19 at MENUPAGEITEM.szName, dw g_szItemMainExitToDOS
20 at MENUPAGEITEM.szInfo, dw g_szNfoMainExitToDOS
21 at MENUPAGEITEM.szHelp, dw g_szNfoMainExitToDOS
22 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
23 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_BACK
24iend
25istruc MENUPAGEITEM ; Load BIOS from file
26 at MENUPAGEITEM.fnActivate, dw MainMenu_ActivateLoadBiosFromFile
27 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
28 at MENUPAGEITEM.szName, dw g_szItemMainLoadFile
29 at MENUPAGEITEM.szInfo, dw g_szNfoMainLoadFile
30 at MENUPAGEITEM.szHelp, dw g_szNfoMainLoadFile
31 at MENUPAGEITEM.szDialog, dw g_szNfoMainLoadFile
32 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
33 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
34iend
35g_MenuPageInfoMainLoadFromROM:
36istruc MENUPAGEITEM ; Load XTIDE Universal BIOS from ROM
37 at MENUPAGEITEM.fnActivate, dw MainMenu_ActivateLoadBiosFromRom
38 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
39 at MENUPAGEITEM.szName, dw g_szItemMainLoadROM
40 at MENUPAGEITEM.szInfo, dw g_szNfoMainLoadROM
41 at MENUPAGEITEM.szHelp, dw g_szNfoMainLoadROM
42 at MENUPAGEITEM.szDialog, dw g_szDlgMainLoadROM
43 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_SPECIAL
44iend
45g_MenuPageInfoMainLoadSettingsFromROM:
46istruc MENUPAGEITEM ; Load old settings from ROM
47 at MENUPAGEITEM.fnActivate, dw MainMenu_ActivateLoadSettingsFromRom
48 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
49 at MENUPAGEITEM.szName, dw g_szItemMainLoadStngs
50 at MENUPAGEITEM.szInfo, dw g_szNfoMainLoadStngs
51 at MENUPAGEITEM.szHelp, dw g_szNfoMainLoadStngs
52 at MENUPAGEITEM.szDialog, dw g_szDlgMainLoadStngs
53 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_SPECIAL
54iend
55g_MenuPageInfoMainConfigureBios:
56istruc MENUPAGEITEM ; Configure XTIDE Universal BIOS
57 at MENUPAGEITEM.fnActivate, dw MainMenu_ActivateConfigureBios
58 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
59 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageCfg
60 at MENUPAGEITEM.szName, dw g_szItemMainConfigure
61 at MENUPAGEITEM.szInfo, dw g_szNfoMainConfigure
62 at MENUPAGEITEM.szHelp, dw g_szNfoMainConfigure
63 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
64iend
65g_MenuPageInfoMainFlash:
66istruc MENUPAGEITEM ; Flash EEPROM
67 at MENUPAGEITEM.fnActivate, dw MainPageItem_ActivateSubmenu
68 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
69 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageFlash
70 at MENUPAGEITEM.szName, dw g_szItemMainFlash
71 at MENUPAGEITEM.szInfo, dw g_szNfoMainFlash
72 at MENUPAGEITEM.szHelp, dw g_szNfoMainFlash
73 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
74iend
75
76; Section containing code
77SECTION .text
78
79;--------------------------------------------------------------------
80; MainMenu_ActivateLoadBiosFromFile
81; Parameters:
82; DS:SI Ptr to MENUPAGE
83; DS:DI Ptr to MENUPAGEITEM
84; SS:BP: Ptr to MENUVARS
85; Returns:
86; CF: Set if menuitem changed
87; Cleared if no changes
88; Corrupts registers:
89; All
90;--------------------------------------------------------------------
91ALIGN JUMP_ALIGN
92MainMenu_ActivateLoadBiosFromFile:
93 push si
94 call BiosFile_SaveUnsavedChanges
95 call BiosFile_SelectFile ; Let user select file
96 jc SHORT .LoadUserSelectedFile
97 pop si
98 ret ; User cancellation
99ALIGN JUMP_ALIGN
100.LoadUserSelectedFile:
101 push cs
102 pop es
103 mov di, g_cfgVars+CFGVARS.rgbEepromBuffers ; ES:DI points to destination buffer
104 call BiosFile_LoadFile ; Get file size to CX
105 pop si
106 mov ax, FLG_CFGVARS_FILELOADED ; Loaded file instead of ROM
107 jmp SHORT MainMenu_NewBiosLoaded
108
109
110;--------------------------------------------------------------------
111; MainMenu_ActivateLoadBiosFromRom
112; Parameters:
113; DS:SI Ptr to MENUPAGE
114; DS:DI Ptr to MENUPAGEITEM
115; SS:BP: Ptr to MENUVARS
116; Returns:
117; CF: Set if menuitem changed
118; Cleared if no changes
119; Corrupts registers:
120; All
121;--------------------------------------------------------------------
122ALIGN JUMP_ALIGN
123MainMenu_ActivateLoadBiosFromRom:
124 call BiosFile_SaveUnsavedChanges
125 call EEPROM_LoadBiosFromROM
126 call MenuPageItem_DisplaySpecialFunctionDialog
127 mov ax, FLG_CFGVARS_ROMLOADED ; Loaded ROM instead of file
128 jmp SHORT MainMenu_NewBiosLoaded
129
130
131;--------------------------------------------------------------------
132; MainMenu_ActivateLoadSettingsFromRom
133; Parameters:
134; DS:SI Ptr to MENUPAGE
135; DS:DI Ptr to MENUPAGEITEM
136; SS:BP: Ptr to MENUVARS
137; Returns:
138; CF: Set if menuitem changed
139; Cleared if no changes
140; Corrupts registers:
141; All
142;--------------------------------------------------------------------
143ALIGN JUMP_ALIGN
144MainMenu_ActivateLoadSettingsFromRom:
145 or WORD [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_UNSAVED
146 call EEPROM_LoadSettingsFromRomToRam
147 call FormatTitle_RedrawMenuTitle
148 call MenuPageItem_DisplaySpecialFunctionDialog
149 clc
150 ret
151
152
153;--------------------------------------------------------------------
154; MainMenu_ActivateConfigureBios
155; Parameters:
156; DS:SI Ptr to MENUPAGE
157; DS:DI Ptr to MENUPAGEITEM
158; SS:BP: Ptr to MENUVARS
159; Returns:
160; CF: Set if menuitem changed
161; Cleared if no changes
162; Corrupts registers:
163; All
164;--------------------------------------------------------------------
165ALIGN JUMP_ALIGN
166MainMenu_ActivateConfigureBios:
167 call ConfigurationMenu_SetMenuitemVisibility
168 jmp MainPageItem_ActivateSubmenu
169
170
171;--------------------------------------------------------------------
172; MainMenu_NewBiosLoaded
173; Parameters:
174; AX: EEPROM source (FLG_CFGVARS_FILELOADED or FLG_CFGVARS_ROMLOADED)
175; CX: EEPROM size in bytes
176; DS:SI: Ptr to MENUPAGE
177; SS:BP: Ptr to MENUVARS
178; Returns:
179; CF: Cleared since no need to draw changes
180; Corrupts registers:
181; AX, BX, CX, DX
182;--------------------------------------------------------------------
183ALIGN JUMP_ALIGN
184MainMenu_NewBiosLoaded:
185 call EEPROM_NewBiosLoadedFromFileOrROM
186 call FormatTitle_RedrawMenuTitle
187 ; Fall to Main_SetMenuitemVisibilityAndDrawChanges
188
189;--------------------------------------------------------------------
190; Main_SetMenuitemVisibilityAndDrawChanges
191; Parameters:
192; DS:SI: Ptr to MENUPAGE
193; SS:BP: Ptr to MENUVARS
194; Returns:
195; CF: Cleared since no need to draw changes
196; Corrupts registers:
197; AX, BX, CX, DX
198;--------------------------------------------------------------------
199ALIGN JUMP_ALIGN
200Main_SetMenuitemVisibilityAndDrawChanges:
201 call MainMenu_SetMenuitemVisibility
202 call MenuPage_InvalidateItemCount
203 clc ; No need to redraw Full Mode menuitem
204 ret
205
206
207;--------------------------------------------------------------------
208; Enables or disables menuitems based on current configuration.
209;
210; MainMenu_SetMenuitemVisibility
211; Parameters:
212; DS: CS
213; Returns:
214; Nothing
215; Corrupts registers:
216; BX, CX
217;--------------------------------------------------------------------
218ALIGN JUMP_ALIGN
219MainMenu_SetMenuitemVisibility:
220 call MainMenu_SetLoadBiosFromRomVisibility
221 call MainMenu_SetConfigureXtideUniversalBiosVisibility
222 jmp SHORT MainMenu_SetFlashVisibility
223
224ALIGN JUMP_ALIGN
225MainMenu_SetLoadBiosFromRomVisibility:
226 push es
227 call EEPROM_FindXtideUniversalBiosROM
228 pop es
229 jnc SHORT .XtideUniversalBiosNotFound
230 or BYTE [g_MenuPageInfoMainLoadFromROM+MENUPAGEITEM.bFlags], FLG_MENUPAGEITEM_VISIBLE
231 call EEPROM_IsXtideUniversalBiosLoaded
232 jne SHORT .Return
233 or BYTE [g_MenuPageInfoMainLoadSettingsFromROM+MENUPAGEITEM.bFlags], FLG_MENUPAGEITEM_VISIBLE
234ALIGN JUMP_ALIGN
235.Return:
236 ret
237ALIGN JUMP_ALIGN
238.XtideUniversalBiosNotFound:
239 and BYTE [g_MenuPageInfoMainLoadFromROM+MENUPAGEITEM.bFlags], ~FLG_MENUPAGEITEM_VISIBLE
240 and BYTE [g_MenuPageInfoMainLoadSettingsFromROM+MENUPAGEITEM.bFlags], ~FLG_MENUPAGEITEM_VISIBLE
241 ret
242
243ALIGN JUMP_ALIGN
244MainMenu_SetConfigureXtideUniversalBiosVisibility:
245 call EEPROM_IsXtideUniversalBiosLoaded
246 jne SHORT .XtideUniversalBiosNotLoaded
247 or BYTE [g_MenuPageInfoMainConfigureBios+MENUPAGEITEM.bFlags], FLG_MENUPAGEITEM_VISIBLE
248 ret
249ALIGN JUMP_ALIGN
250.XtideUniversalBiosNotLoaded:
251 and BYTE [g_MenuPageInfoMainConfigureBios+MENUPAGEITEM.bFlags], ~FLG_MENUPAGEITEM_VISIBLE
252 ret
253
254ALIGN JUMP_ALIGN
255MainMenu_SetFlashVisibility:
256 test WORD [cs:g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
257 jz SHORT .BiosNotLoaded
258 or BYTE [g_MenuPageInfoMainFlash+MENUPAGEITEM.bFlags], FLG_MENUPAGEITEM_VISIBLE
259 ret
260ALIGN JUMP_ALIGN
261.BiosNotLoaded:
262 and BYTE [g_MenuPageInfoMainFlash+MENUPAGEITEM.bFlags], ~FLG_MENUPAGEITEM_VISIBLE
263 ret
Note: See TracBrowser for help on using the repository browser.