source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/MainMenu.asm@ 75

Last change on this file since 75 was 68, checked in by Tomi Tilli, 14 years ago

Changes to Configurator v2:

  • Finally ready for testing.
File size: 7.7 KB
Line 
1; File name : MainMenu.asm
2; Project name : XTIDE Universal BIOS Configurator v2
3; Created date : 6.10.2010
4; Last update : 9.12.2010
5; Author : Tomi Tilli
6; Description : Main menu structs and functions.
7
8; Section containing initialized data
9SECTION .data
10
11ALIGN WORD_ALIGN
12g_MenupageForMainMenu:
13istruc MENUPAGE
14 at MENUPAGE.fnEnter, dw MainMenu_EnterMenuOrModifyItemVisibility
15 at MENUPAGE.fnBack, dw ExitToDos
16 at MENUPAGE.wMenuitems, dw 6
17iend
18
19g_MenuitemMainMenuExitToDos:
20istruc 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
27iend
28
29g_MenuitemMainMenuLoadBiosFromFile:
30istruc 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
37iend
38
39g_MenuitemMainMenuLoadXtideUniversalBiosFromRom:
40istruc 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
47iend
48
49g_MenuitemMainMenuLoadOldSettingsFromEeprom:
50istruc 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
57iend
58
59g_MenuitemMainMenuConfigureXtideUniversalBios:
60istruc 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
67iend
68
69g_MenuitemMainMenuFlashEeprom:
70istruc 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
77iend
78
79%if FALSE
80g_Menuitem:
81istruc 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
97iend
98%endif
99
100
101; Section containing code
102SECTION .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;--------------------------------------------------------------------
113ALIGN JUMP_ALIGN
114MainMenu_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;--------------------------------------------------------------------
132ALIGN 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
142ALIGN 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;--------------------------------------------------------------------
158ALIGN 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
165ALIGN 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;--------------------------------------------------------------------
179ALIGN 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
186ALIGN 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;--------------------------------------------------------------------
202ALIGN JUMP_ALIGN
203ExitToDos:
204 CALL_MENU_LIBRARY Close
205 ret
206
207
208ALIGN JUMP_ALIGN
209LoadBiosFromFile:
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
225ALIGN JUMP_ALIGN
226LoadXtideUniversalBiosFromRom:
227 call Buffers_SaveChangesIfFileLoaded
228 call EEPROM_LoadXtideUniversalBiosFromRomToRamBufferAndReturnSizeInDXCX
229 mov ax, FLG_CFGVARS_ROMLOADED
230 call Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration
231 mov dx, g_szDlgMainLoadROM
232 jmp Dialogs_DisplayNotificationFromCSDX
233
234
235ALIGN JUMP_ALIGN
236LoadOldSettingsFromEeprom:
237 call Buffers_SaveChangesIfFileLoaded
238 call EEPROM_LoadOldSettingsFromRomToRamBuffer
239 and WORD [g_cfgVars+CFGVARS.wFlags], ~FLG_CFGVARS_UNSAVED
240 mov dx, g_szDlgMainLoadStngs
241 jmp Dialogs_DisplayNotificationFromCSDX
Note: See TracBrowser for help on using the repository browser.