1 | ; Project name : XTIDE Universal BIOS Configurator v2
|
---|
2 | ; Description : Main menu structs and functions.
|
---|
3 |
|
---|
4 | ;
|
---|
5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
|
---|
7 | ;
|
---|
8 | ; This program is free software; you can redistribute it and/or modify
|
---|
9 | ; it under the terms of the GNU General Public License as published by
|
---|
10 | ; the Free Software Foundation; either version 2 of the License, or
|
---|
11 | ; (at your option) any later version.
|
---|
12 | ;
|
---|
13 | ; This program is distributed in the hope that it will be useful,
|
---|
14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | ; GNU General Public License for more details.
|
---|
17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
18 | ;
|
---|
19 |
|
---|
20 | ; Section containing initialized data
|
---|
21 | SECTION .data
|
---|
22 |
|
---|
23 | ALIGN WORD_ALIGN
|
---|
24 | g_MenupageForMainMenu:
|
---|
25 | istruc MENUPAGE
|
---|
26 | at MENUPAGE.fnEnter, dw MainMenu_EnterMenuOrModifyItemVisibility
|
---|
27 | at MENUPAGE.fnBack, dw ExitToDosFromBackButton
|
---|
28 | at MENUPAGE.wMenuitems, dw 9
|
---|
29 | iend
|
---|
30 |
|
---|
31 | g_MenuitemMainMenuLicense:
|
---|
32 | istruc MENUITEM
|
---|
33 | at MENUITEM.fnActivate, dw Menuitem_DisplayHelpMessageFromDSSI
|
---|
34 | at MENUITEM.szName, dw g_szItemMainLicense
|
---|
35 | at MENUITEM.szQuickInfo, dw g_szNfoMainLicense
|
---|
36 | at MENUITEM.szHelp, dw g_szHelpMainLicense
|
---|
37 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
|
---|
38 | at MENUITEM.bType, db TYPE_MENUITEM_ACTION
|
---|
39 | iend
|
---|
40 |
|
---|
41 | g_MenuitemMainMenuLoadBiosFromFile:
|
---|
42 | istruc MENUITEM
|
---|
43 | at MENUITEM.fnActivate, dw LoadBiosFromFile
|
---|
44 | at MENUITEM.szName, dw g_szItemMainLoadFile
|
---|
45 | at MENUITEM.szQuickInfo, dw g_szNfoMainLoadFile
|
---|
46 | at MENUITEM.szHelp, dw g_szNfoMainLoadFile
|
---|
47 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
|
---|
48 | at MENUITEM.bType, db TYPE_MENUITEM_ACTION
|
---|
49 | iend
|
---|
50 |
|
---|
51 | g_MenuitemMainMenuLoadXtideUniversalBiosFromRom:
|
---|
52 | istruc MENUITEM
|
---|
53 | at MENUITEM.fnActivate, dw LoadXtideUniversalBiosFromRom
|
---|
54 | at MENUITEM.szName, dw g_szItemMainLoadROM
|
---|
55 | at MENUITEM.szQuickInfo, dw g_szNfoMainLoadROM
|
---|
56 | at MENUITEM.szHelp, dw g_szNfoMainLoadROM
|
---|
57 | at MENUITEM.bFlags, db NULL
|
---|
58 | at MENUITEM.bType, db TYPE_MENUITEM_ACTION
|
---|
59 | iend
|
---|
60 |
|
---|
61 | g_MenuitemMainMenuLoadOldSettingsFromEeprom:
|
---|
62 | istruc MENUITEM
|
---|
63 | at MENUITEM.fnActivate, dw LoadOldSettingsFromEeprom
|
---|
64 | at MENUITEM.szName, dw g_szItemMainLoadStngs
|
---|
65 | at MENUITEM.szQuickInfo, dw g_szNfoMainLoadStngs
|
---|
66 | at MENUITEM.szHelp, dw g_szNfoMainLoadStngs
|
---|
67 | at MENUITEM.bFlags, db NULL
|
---|
68 | at MENUITEM.bType, db TYPE_MENUITEM_ACTION
|
---|
69 | iend
|
---|
70 |
|
---|
71 | g_MenuitemMainMenuConfigureXtideUniversalBios:
|
---|
72 | istruc MENUITEM
|
---|
73 | at MENUITEM.fnActivate, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility
|
---|
74 | at MENUITEM.szName, dw g_szItemMainConfigure
|
---|
75 | at MENUITEM.szQuickInfo, dw g_szNfoMainConfigure
|
---|
76 | at MENUITEM.szHelp, dw g_szNfoMainConfigure
|
---|
77 | at MENUITEM.bFlags, db NULL
|
---|
78 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
|
---|
79 | iend
|
---|
80 |
|
---|
81 | g_MenuitemMainMenuFlashEeprom:
|
---|
82 | istruc MENUITEM
|
---|
83 | at MENUITEM.fnActivate, dw FlashMenu_EnterMenuOrModifyItemVisibility
|
---|
84 | at MENUITEM.szName, dw g_szItemMainFlash
|
---|
85 | at MENUITEM.szQuickInfo, dw g_szNfoMainFlash
|
---|
86 | at MENUITEM.szHelp, dw g_szNfoMainFlash
|
---|
87 | at MENUITEM.bFlags, db NULL
|
---|
88 | at MENUITEM.bType, db TYPE_MENUITEM_PAGENEXT
|
---|
89 | iend
|
---|
90 |
|
---|
91 | g_MenuitemMainMenuSaveFile:
|
---|
92 | istruc MENUITEM
|
---|
93 | at MENUITEM.fnActivate, dw BiosFile_SaveUnsavedChanges
|
---|
94 | at MENUITEM.szName, dw g_szItemMainSave
|
---|
95 | at MENUITEM.szQuickInfo, dw g_szNfoMainSave
|
---|
96 | at MENUITEM.szHelp, dw g_szNfoMainSave
|
---|
97 | at MENUITEM.bFlags, db NULL
|
---|
98 | at MENUITEM.bType, db TYPE_MENUITEM_ACTION
|
---|
99 | iend
|
---|
100 |
|
---|
101 | g_MenuitemMainMenuExitToDos:
|
---|
102 | istruc MENUITEM
|
---|
103 | at MENUITEM.fnActivate, dw ExitToDosSelectedFromMenu
|
---|
104 | at MENUITEM.szName, dw g_szItemMainExitToDOS
|
---|
105 | at MENUITEM.szQuickInfo, dw g_szNfoMainExitToDOS
|
---|
106 | at MENUITEM.szHelp, dw g_szNfoMainExitToDOS
|
---|
107 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
|
---|
108 | at MENUITEM.bType, db TYPE_MENUITEM_ACTION
|
---|
109 | iend
|
---|
110 |
|
---|
111 | g_MenuitemMainMenuHomePage:
|
---|
112 | istruc MENUITEM
|
---|
113 | at MENUITEM.fnActivate, dw Menuitem_DisplayHelpMessageFromDSSI
|
---|
114 | at MENUITEM.szName, dw g_szItemMainHomePage
|
---|
115 | at MENUITEM.szQuickInfo, dw g_szNfoMainHomePage
|
---|
116 | at MENUITEM.szHelp, dw g_szNfoMainHomePage
|
---|
117 | at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
|
---|
118 | at MENUITEM.bType, db TYPE_MENUITEM_ACTION
|
---|
119 | iend
|
---|
120 |
|
---|
121 |
|
---|
122 | ; Section containing code
|
---|
123 | SECTION .text
|
---|
124 |
|
---|
125 | ;--------------------------------------------------------------------
|
---|
126 | ; MainMenu_EnterMenuOrModifyItemVisibility
|
---|
127 | ; Parameters:
|
---|
128 | ; SS:BP: Menu handle
|
---|
129 | ; Returns:
|
---|
130 | ; Nothing
|
---|
131 | ; Corrupts registers:
|
---|
132 | ; All, except BP
|
---|
133 | ;--------------------------------------------------------------------
|
---|
134 | ALIGN JUMP_ALIGN
|
---|
135 | MainMenu_EnterMenuOrModifyItemVisibility:
|
---|
136 | push cs
|
---|
137 | pop ds
|
---|
138 | call .EnableOrDisableXtideRomItems
|
---|
139 | call .EnableOrDisableConfigureXtideUniversalBios
|
---|
140 | call .EnableOrDisableFlashEeprom
|
---|
141 | call .EnableOrDisableSave
|
---|
142 | mov si, g_MenupageForMainMenu
|
---|
143 | jmp Menupage_ChangeToNewMenupageInDSSI
|
---|
144 |
|
---|
145 | ;--------------------------------------------------------------------
|
---|
146 | ; .EnableOrDisableXtideRomItems
|
---|
147 | ; Parameters:
|
---|
148 | ; DS: CFGVARS segment
|
---|
149 | ; Returns:
|
---|
150 | ; Nothing
|
---|
151 | ; Corrupts registers:
|
---|
152 | ; AX, BX, CX, SI, DI, ES
|
---|
153 | ;--------------------------------------------------------------------
|
---|
154 | ALIGN JUMP_ALIGN
|
---|
155 | .EnableOrDisableXtideRomItems:
|
---|
156 | call EEPROM_FindXtideUniversalBiosROMtoESDI
|
---|
157 | jc SHORT .DisableAllRomItems
|
---|
158 | or BYTE [g_MenuitemMainMenuLoadXtideUniversalBiosFromRom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
159 | call Buffers_IsXtideUniversalBiosLoaded
|
---|
160 | jne SHORT .DisableLoadSettingFromRom
|
---|
161 | or BYTE [g_MenuitemMainMenuLoadOldSettingsFromEeprom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
162 | ret
|
---|
163 |
|
---|
164 | ALIGN JUMP_ALIGN
|
---|
165 | .DisableAllRomItems:
|
---|
166 | and BYTE [g_MenuitemMainMenuLoadXtideUniversalBiosFromRom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
|
---|
167 | .DisableLoadSettingFromRom:
|
---|
168 | and BYTE [g_MenuitemMainMenuLoadOldSettingsFromEeprom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
|
---|
169 | ret
|
---|
170 |
|
---|
171 | ;--------------------------------------------------------------------
|
---|
172 | ; .EnableOrDisableConfigureXtideUniversalBios
|
---|
173 | ; Parameters:
|
---|
174 | ; DS: CFGVARS segment
|
---|
175 | ; Returns:
|
---|
176 | ; Nothing
|
---|
177 | ; Corrupts registers:
|
---|
178 | ; CX, SI, DI, ES
|
---|
179 | ;--------------------------------------------------------------------
|
---|
180 | ALIGN JUMP_ALIGN
|
---|
181 | .EnableOrDisableConfigureXtideUniversalBios:
|
---|
182 | call Buffers_IsXtideUniversalBiosLoaded
|
---|
183 | jne SHORT .DisableConfigureXtideUniversalBios
|
---|
184 | or BYTE [g_MenuitemMainMenuConfigureXtideUniversalBios+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
185 | ret
|
---|
186 |
|
---|
187 | ALIGN JUMP_ALIGN
|
---|
188 | .DisableConfigureXtideUniversalBios:
|
---|
189 | and BYTE [g_MenuitemMainMenuConfigureXtideUniversalBios+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
|
---|
190 | ret
|
---|
191 |
|
---|
192 | ;--------------------------------------------------------------------
|
---|
193 | ; .EnableOrDisableFlashEeprom
|
---|
194 | ; Parameters:
|
---|
195 | ; DS: CFGVARS segment
|
---|
196 | ; Returns:
|
---|
197 | ; Nothing
|
---|
198 | ; Corrupts registers:
|
---|
199 | ; Nothing
|
---|
200 | ;--------------------------------------------------------------------
|
---|
201 | ALIGN JUMP_ALIGN
|
---|
202 | .EnableOrDisableFlashEeprom:
|
---|
203 | test BYTE [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
|
---|
204 | jz SHORT .DisableFlashEeprom
|
---|
205 | or BYTE [g_MenuitemMainMenuFlashEeprom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
206 | ret
|
---|
207 |
|
---|
208 | ALIGN JUMP_ALIGN
|
---|
209 | .DisableFlashEeprom:
|
---|
210 | and BYTE [g_MenuitemMainMenuFlashEeprom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
|
---|
211 | ret
|
---|
212 |
|
---|
213 | ;--------------------------------------------------------------------
|
---|
214 | ; .EnableOrDisableSave
|
---|
215 | ; Parameters:
|
---|
216 | ; DS: CFGVARS segment
|
---|
217 | ; Returns:
|
---|
218 | ; Nothing
|
---|
219 | ; Corrupts registers:
|
---|
220 | ; Nothing
|
---|
221 | ;--------------------------------------------------------------------
|
---|
222 | ALIGN JUMP_ALIGN
|
---|
223 | .EnableOrDisableSave:
|
---|
224 | test BYTE [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED
|
---|
225 | jz SHORT .DisableSave
|
---|
226 | or BYTE [g_MenuitemMainMenuSaveFile+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
|
---|
227 | ret
|
---|
228 |
|
---|
229 | ALIGN JUMP_ALIGN
|
---|
230 | .DisableSave:
|
---|
231 | and BYTE [g_MenuitemMainMenuSaveFile+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
|
---|
232 | ret
|
---|
233 |
|
---|
234 | ;--------------------------------------------------------------------
|
---|
235 | ; MENUITEM activation functions (.fnActivate)
|
---|
236 | ; Parameters:
|
---|
237 | ; SS:BP: Ptr to MENU
|
---|
238 | ; Returns:
|
---|
239 | ; Nothing
|
---|
240 | ; Corrupts registers:
|
---|
241 | ; All, except segments
|
---|
242 | ;--------------------------------------------------------------------
|
---|
243 | ALIGN JUMP_ALIGN
|
---|
244 | ExitToDosSelectedFromMenu:
|
---|
245 | JMP_MENU_LIBRARY CloseMenuIfExitEventAllows
|
---|
246 |
|
---|
247 |
|
---|
248 | ALIGN JUMP_ALIGN
|
---|
249 | LoadBiosFromFile:
|
---|
250 | call Buffers_SaveChangesIfFileLoaded
|
---|
251 | mov cl, FILE_DIALOG_IO_size
|
---|
252 | call Memory_ReserveCLbytesFromStackToDSSI
|
---|
253 | call Dialogs_DisplayFileDialogWithDialogIoInDSSI
|
---|
254 | cmp BYTE [si+FILE_DIALOG_IO.bUserCancellation], TRUE
|
---|
255 | je SHORT .CancelFileLoading
|
---|
256 |
|
---|
257 | add si, BYTE FILE_DIALOG_IO.szFile
|
---|
258 | call BiosFile_LoadFileFromDSSItoRamBuffer
|
---|
259 | call LoadColorTheme
|
---|
260 | call MainMenu_EnterMenuOrModifyItemVisibility
|
---|
261 | .CancelFileLoading:
|
---|
262 | add sp, BYTE FILE_DIALOG_IO_size
|
---|
263 | ExitToDosFromBackButton:
|
---|
264 | ret
|
---|
265 |
|
---|
266 |
|
---|
267 | ALIGN JUMP_ALIGN
|
---|
268 | LoadXtideUniversalBiosFromRom:
|
---|
269 | call Buffers_SaveChangesIfFileLoaded
|
---|
270 | call EEPROM_LoadXtideUniversalBiosFromRomToRamBufferAndReturnSizeInDXCX
|
---|
271 | mov al, FLG_CFGVARS_ROMLOADED
|
---|
272 | call Buffers_NewBiosWithSizeInDXCXandSourceInALhasBeenLoadedForConfiguration
|
---|
273 | mov dx, g_szDlgMainLoadROM
|
---|
274 | call Dialogs_DisplayNotificationFromCSDX
|
---|
275 | call LoadColorTheme
|
---|
276 | jmp MainMenu_EnterMenuOrModifyItemVisibility
|
---|
277 |
|
---|
278 |
|
---|
279 | ALIGN JUMP_ALIGN
|
---|
280 | LoadOldSettingsFromEeprom:
|
---|
281 | call Buffers_SaveChangesIfFileLoaded
|
---|
282 | call EEPROM_LoadOldSettingsFromRomToRamBuffer
|
---|
283 | call Buffers_SetUnsavedChanges
|
---|
284 | mov dx, g_szDlgMainLoadStngs
|
---|
285 | call Dialogs_DisplayNotificationFromCSDX
|
---|
286 | call EEPROM_FindXtideUniversalBiosROMtoESDI
|
---|
287 | call LoadColorTheme.FromROM
|
---|
288 | jmp MainMenu_EnterMenuOrModifyItemVisibility
|
---|
289 |
|
---|
290 |
|
---|
291 | ;--------------------------------------------------------------------
|
---|
292 | ; LoadColorTheme
|
---|
293 | ; Parameters:
|
---|
294 | ; ES: ROMVARS segment (only when loading theme from ROM)
|
---|
295 | ; Returns:
|
---|
296 | ; Nothing
|
---|
297 | ; Corrupts registers:
|
---|
298 | ; AX, BX, CX, SI, DI, ES
|
---|
299 | ;--------------------------------------------------------------------
|
---|
300 | ALIGN JUMP_ALIGN
|
---|
301 | LoadColorTheme:
|
---|
302 | call Buffers_GetFileBufferToESDI
|
---|
303 | call Buffers_IsXtideUniversalBiosSignatureInESDI
|
---|
304 | jnz SHORT .Return
|
---|
305 | .FromROM:
|
---|
306 | mov ax, [es:ROMVARS.pColorTheme]
|
---|
307 | jmp ReadColorTheme
|
---|
308 | .Return:
|
---|
309 | ret
|
---|
310 |
|
---|