1 | ; Project name : XTIDE Universal BIOS Configurator v2
|
---|
2 | ; Description : Main menu structs and functions.
|
---|
3 |
|
---|
4 | ; Section containing initialized data
|
---|
5 | SECTION .data
|
---|
6 |
|
---|
7 | ALIGN WORD_ALIGN
|
---|
8 | g_MenupageForMainMenu:
|
---|
9 | istruc MENUPAGE
|
---|
10 | at MENUPAGE.fnEnter, dw MainMenu_EnterMenuOrModifyItemVisibility
|
---|
11 | at MENUPAGE.fnBack, dw ExitToDosFromBackButton
|
---|
12 | at MENUPAGE.wMenuitems, dw 9
|
---|
13 | iend
|
---|
14 |
|
---|
15 | g_MenuitemMainMenuLicense:
|
---|
16 | istruc 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
|
---|
23 | iend
|
---|
24 |
|
---|
25 | g_MenuitemMainMenuLoadBiosFromFile:
|
---|
26 | istruc 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
|
---|
33 | iend
|
---|
34 |
|
---|
35 | g_MenuitemMainMenuLoadXtideUniversalBiosFromRom:
|
---|
36 | istruc 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
|
---|
43 | iend
|
---|
44 |
|
---|
45 | g_MenuitemMainMenuLoadOldSettingsFromEeprom:
|
---|
46 | istruc 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
|
---|
53 | iend
|
---|
54 |
|
---|
55 | g_MenuitemMainMenuConfigureXtideUniversalBios:
|
---|
56 | istruc 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
|
---|
63 | iend
|
---|
64 |
|
---|
65 | g_MenuitemMainMenuFlashEeprom:
|
---|
66 | istruc 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
|
---|
73 | iend
|
---|
74 |
|
---|
75 | g_MenuitemMainMenuSaveFile:
|
---|
76 | istruc 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
|
---|
83 | iend
|
---|
84 |
|
---|
85 | g_MenuitemMainMenuExitToDos:
|
---|
86 | istruc 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
|
---|
93 | iend
|
---|
94 |
|
---|
95 | g_MenuitemMainMenuHomePage:
|
---|
96 | istruc 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
|
---|
103 | iend
|
---|
104 |
|
---|
105 |
|
---|
106 | ; Section containing code
|
---|
107 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
118 | ALIGN JUMP_ALIGN
|
---|
119 | MainMenu_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 | ;--------------------------------------------------------------------
|
---|
138 | ALIGN 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 |
|
---|
148 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
164 | ALIGN 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 |
|
---|
171 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
185 | ALIGN 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 |
|
---|
192 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
206 | ALIGN 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 |
|
---|
213 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
227 | ALIGN JUMP_ALIGN
|
---|
228 | ExitToDosSelectedFromMenu:
|
---|
229 | CALL_MENU_LIBRARY CloseMenuIfExitEventAllows
|
---|
230 | ExitToDosFromBackButton:
|
---|
231 | ret
|
---|
232 |
|
---|
233 |
|
---|
234 | ALIGN JUMP_ALIGN
|
---|
235 | LoadBiosFromFile:
|
---|
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 |
|
---|
251 | ALIGN JUMP_ALIGN
|
---|
252 | LoadXtideUniversalBiosFromRom:
|
---|
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 |
|
---|
262 | ALIGN JUMP_ALIGN
|
---|
263 | LoadOldSettingsFromEeprom:
|
---|
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 |
|
---|