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 8
|
---|
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_MenuitemMainMenuExitToDos:
|
---|
76 | istruc 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
|
---|
83 | iend
|
---|
84 |
|
---|
85 | g_MenuitemMainMenuHomePage:
|
---|
86 | istruc 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
|
---|
93 | iend
|
---|
94 |
|
---|
95 |
|
---|
96 | ; Section containing code
|
---|
97 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
108 | ALIGN JUMP_ALIGN
|
---|
109 | MainMenu_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 | ;--------------------------------------------------------------------
|
---|
127 | ALIGN 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 |
|
---|
137 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
153 | ALIGN 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 |
|
---|
160 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
174 | ALIGN 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 |
|
---|
181 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
197 | ALIGN JUMP_ALIGN
|
---|
198 | ExitToDosSelectedFromMenu:
|
---|
199 | CALL_MENU_LIBRARY CloseMenuIfExitEventAllows
|
---|
200 | ExitToDosFromBackButton:
|
---|
201 | ret
|
---|
202 |
|
---|
203 |
|
---|
204 | ALIGN JUMP_ALIGN
|
---|
205 | LoadBiosFromFile:
|
---|
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 |
|
---|
221 | ALIGN JUMP_ALIGN
|
---|
222 | LoadXtideUniversalBiosFromRom:
|
---|
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 |
|
---|
232 | ALIGN JUMP_ALIGN
|
---|
233 | LoadOldSettingsFromEeprom:
|
---|
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 |
|
---|