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

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

Small changes. 1) Changes biosdrvs.com to output CR+LF instead of LF+CR, consistent with DOS/Windows, but I did not update the Assembly Library as this would break the Configurator; 2) Put a C/C++ section in Version.inc for the serial server; 3) Configurator defaults the EEPROM address after scanning for a EEPROM in memory (as it does for loading the BIOS from ROM); 4) Added a command to the Configurator main menu to save chages to the file from which it was loaded (if it was loaded form a file), which is symmetric with the Load command and more discoverable than exiting DOS and then being prompted (which is still there too, if changes are unsaved).

File size: 8.6 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 9
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_MenuitemMainMenuSaveFile:
76istruc MENUITEM
77 at MENUITEM.fnActivate, dw BiosFile_SaveUnsavedChanges
78 at MENUITEM.szName, dw g_szItemMainSave
79 at MENUITEM.szQuickInfo, dw g_szNfoMainSave
80 at MENUITEM.szHelp, dw g_szNfoMainSave
81 at MENUITEM.bFlags, db NULL
82 at MENUITEM.bType, db TYPE_MENUITEM_ACTION
83iend
84
85g_MenuitemMainMenuExitToDos:
86istruc MENUITEM
87 at MENUITEM.fnActivate, dw ExitToDosSelectedFromMenu
88 at MENUITEM.szName, dw g_szItemMainExitToDOS
89 at MENUITEM.szQuickInfo, dw g_szNfoMainExitToDOS
90 at MENUITEM.szHelp, dw g_szNfoMainExitToDOS
91 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
92 at MENUITEM.bType, db TYPE_MENUITEM_ACTION
93iend
94
95g_MenuitemMainMenuHomePage:
96istruc MENUITEM
97 at MENUITEM.fnActivate, dw Menuitem_DisplayHelpMessageFromDSSI
98 at MENUITEM.szName, dw g_szItemMainHomePage
99 at MENUITEM.szQuickInfo, dw g_szNfoMainHomePage
100 at MENUITEM.szHelp, dw g_szNfoMainHomePage
101 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
102 at MENUITEM.bType, db TYPE_MENUITEM_ACTION
103iend
104
105
106; Section containing code
107SECTION .text
108
109;--------------------------------------------------------------------
110; MainMenu_EnterMenuOrModifyItemVisibility
111; Parameters:
112; SS:BP: Menu handle
113; Returns:
114; Nothing
115; Corrupts registers:
116; All, except BP
117;--------------------------------------------------------------------
118ALIGN JUMP_ALIGN
119MainMenu_EnterMenuOrModifyItemVisibility:
120 push cs
121 pop ds
122 call .EnableOrDisableXtideRomItems
123 call .EnableOrDisableConfigureXtideUniversalBios
124 call .EnableOrDisableFlashEeprom
125 call .EnableOrDisableSave
126 mov si, g_MenupageForMainMenu
127 jmp Menupage_ChangeToNewMenupageInDSSI
128
129;--------------------------------------------------------------------
130; .EnableOrDisableXtideRomItems
131; Parameters:
132; DS: CFGVARS segment
133; Returns:
134; Nothing
135; Corrupts registers:
136; AX, BX, CX, SI, DI, ES
137;--------------------------------------------------------------------
138ALIGN JUMP_ALIGN
139.EnableOrDisableXtideRomItems:
140 call EEPROM_FindXtideUniversalBiosROMtoESDI
141 jnc SHORT .DisableAllRomItems
142 or BYTE [g_MenuitemMainMenuLoadXtideUniversalBiosFromRom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
143 call Buffers_IsXtideUniversalBiosLoaded
144 jne SHORT .DisableLoadSettingFromRom
145 or BYTE [g_MenuitemMainMenuLoadOldSettingsFromEeprom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
146 ret
147
148ALIGN JUMP_ALIGN
149.DisableAllRomItems:
150 and BYTE [g_MenuitemMainMenuLoadXtideUniversalBiosFromRom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
151.DisableLoadSettingFromRom:
152 and BYTE [g_MenuitemMainMenuLoadOldSettingsFromEeprom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
153 ret
154
155;--------------------------------------------------------------------
156; .EnableOrDisableConfigureXtideUniversalBios
157; Parameters:
158; DS: CFGVARS segment
159; Returns:
160; Nothing
161; Corrupts registers:
162; CX, SI, DI, ES
163;--------------------------------------------------------------------
164ALIGN JUMP_ALIGN
165.EnableOrDisableConfigureXtideUniversalBios:
166 call Buffers_IsXtideUniversalBiosLoaded
167 jne SHORT .DisableConfigureXtideUniversalBios
168 or BYTE [g_MenuitemMainMenuConfigureXtideUniversalBios+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
169 ret
170
171ALIGN JUMP_ALIGN
172.DisableConfigureXtideUniversalBios:
173 and BYTE [g_MenuitemMainMenuConfigureXtideUniversalBios+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
174 ret
175
176;--------------------------------------------------------------------
177; .EnableOrDisableFlashEeprom
178; Parameters:
179; DS: CFGVARS segment
180; Returns:
181; Nothing
182; Corrupts registers:
183; Nothing
184;--------------------------------------------------------------------
185ALIGN JUMP_ALIGN
186.EnableOrDisableFlashEeprom:
187 test WORD [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
188 jz SHORT .DisableFlashEeprom
189 or BYTE [g_MenuitemMainMenuFlashEeprom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
190 ret
191
192ALIGN JUMP_ALIGN
193.DisableFlashEeprom:
194 and BYTE [g_MenuitemMainMenuFlashEeprom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
195 ret
196
197;--------------------------------------------------------------------
198; .EnableOrDisableSave
199; Parameters:
200; DS: CFGVARS segment
201; Returns:
202; Nothing
203; Corrupts registers:
204; Nothing
205;--------------------------------------------------------------------
206ALIGN JUMP_ALIGN
207.EnableOrDisableSave:
208 test WORD [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED
209 jz SHORT .DisableSave
210 or BYTE [g_MenuitemMainMenuSaveFile+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
211 ret
212
213ALIGN JUMP_ALIGN
214.DisableSave:
215 and BYTE [g_MenuitemMainMenuSaveFile+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
216 ret
217
218;--------------------------------------------------------------------
219; MENUITEM activation functions (.fnActivate)
220; Parameters:
221; SS:BP: Ptr to MENU
222; Returns:
223; Nothing
224; Corrupts registers:
225; All, except segments
226;--------------------------------------------------------------------
227ALIGN JUMP_ALIGN
228ExitToDosSelectedFromMenu:
229 CALL_MENU_LIBRARY CloseMenuIfExitEventAllows
230ExitToDosFromBackButton:
231 ret
232
233
234ALIGN JUMP_ALIGN
235LoadBiosFromFile:
236 call Buffers_SaveChangesIfFileLoaded
237 mov cx, FILE_DIALOG_IO_size
238 call Memory_ReserveCXbytesFromStackToDSSI
239 call Dialogs_DisplayFileDialogWithDialogIoInDSSI
240 cmp BYTE [si+FILE_DIALOG_IO.bUserCancellation], TRUE
241 je SHORT .CancelFileLoading
242
243 add si, BYTE FILE_DIALOG_IO.szFile
244 call BiosFile_LoadFileFromDSSItoRamBuffer
245 call MainMenu_EnterMenuOrModifyItemVisibility
246.CancelFileLoading:
247 add sp, BYTE FILE_DIALOG_IO_size
248 ret
249
250
251ALIGN JUMP_ALIGN
252LoadXtideUniversalBiosFromRom:
253 call Buffers_SaveChangesIfFileLoaded
254 call EEPROM_LoadXtideUniversalBiosFromRomToRamBufferAndReturnSizeInDXCX
255 mov ax, FLG_CFGVARS_ROMLOADED
256 call Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration
257 mov dx, g_szDlgMainLoadROM
258 call Dialogs_DisplayNotificationFromCSDX
259 jmp MainMenu_EnterMenuOrModifyItemVisibility
260
261
262ALIGN JUMP_ALIGN
263LoadOldSettingsFromEeprom:
264 call Buffers_SaveChangesIfFileLoaded
265 call EEPROM_LoadOldSettingsFromRomToRamBuffer
266 and WORD [g_cfgVars+CFGVARS.wFlags], ~FLG_CFGVARS_UNSAVED
267 mov dx, g_szDlgMainLoadStngs
268 jmp Dialogs_DisplayNotificationFromCSDX
269
270
271
Note: See TracBrowser for help on using the repository browser.