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