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