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

Last change on this file since 370 was 336, checked in by gregli@…, 13 years ago

Removed %ifdef that was preventing the configuration from building in Math.asm, added copyright and license information to configurator (boots to information).

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