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

Last change on this file since 206 was 206, checked in by aitotat@…, 13 years ago

Changes to Configurator v2:

  • Program now properly quits when selecting Exit to DOS from main menu.
File size: 6.9 KB
Line 
1; Project name : XTIDE Universal BIOS Configurator v2
2; Description : Main menu structs and functions.
3
4; Section containing initialized data
5SECTION .data
6
7ALIGN WORD_ALIGN
8g_MenupageForMainMenu:
9istruc MENUPAGE
10 at MENUPAGE.fnEnter, dw MainMenu_EnterMenuOrModifyItemVisibility
11 at MENUPAGE.fnBack, dw ExitToDosFromBackButton
12 at MENUPAGE.wMenuitems, dw 6
13iend
14
15g_MenuitemMainMenuExitToDos:
16istruc MENUITEM
17 at MENUITEM.fnActivate, dw ExitToDosSelectedFromMenu
18 at MENUITEM.szName, dw g_szItemMainExitToDOS
19 at MENUITEM.szQuickInfo, dw g_szNfoMainExitToDOS
20 at MENUITEM.szHelp, dw g_szNfoMainExitToDOS
21 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
22 at MENUITEM.bType, db TYPE_MENUITEM_ACTION
23iend
24
25g_MenuitemMainMenuLoadBiosFromFile:
26istruc 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
33iend
34
35g_MenuitemMainMenuLoadXtideUniversalBiosFromRom:
36istruc 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
43iend
44
45g_MenuitemMainMenuLoadOldSettingsFromEeprom:
46istruc 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
53iend
54
55g_MenuitemMainMenuConfigureXtideUniversalBios:
56istruc 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
63iend
64
65g_MenuitemMainMenuFlashEeprom:
66istruc 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
73iend
74
75
76; Section containing code
77SECTION .text
78
79;--------------------------------------------------------------------
80; MainMenu_EnterMenuOrModifyItemVisibility
81; Parameters:
82; SS:BP: Menu handle
83; Returns:
84; Nothing
85; Corrupts registers:
86; All, except BP
87;--------------------------------------------------------------------
88ALIGN JUMP_ALIGN
89MainMenu_EnterMenuOrModifyItemVisibility:
90 push cs
91 pop ds
92 call .EnableOrDisableXtideRomItems
93 call .EnableOrDisableConfigureXtideUniversalBios
94 call .EnableOrDisableFlashEeprom
95 mov si, g_MenupageForMainMenu
96 jmp Menupage_ChangeToNewMenupageInDSSI
97
98;--------------------------------------------------------------------
99; .EnableOrDisableXtideRomItems
100; Parameters:
101; DS: CFGVARS segment
102; Returns:
103; Nothing
104; Corrupts registers:
105; AX, BX, CX, SI, DI, ES
106;--------------------------------------------------------------------
107ALIGN JUMP_ALIGN
108.EnableOrDisableXtideRomItems:
109 call EEPROM_FindXtideUniversalBiosROMtoESDI
110 jnc SHORT .DisableAllRomItems
111 or BYTE [g_MenuitemMainMenuLoadXtideUniversalBiosFromRom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
112 call Buffers_IsXtideUniversalBiosLoaded
113 jne SHORT .DisableLoadSettingFromRom
114 or BYTE [g_MenuitemMainMenuLoadOldSettingsFromEeprom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
115 ret
116
117ALIGN JUMP_ALIGN
118.DisableAllRomItems:
119 and BYTE [g_MenuitemMainMenuLoadXtideUniversalBiosFromRom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
120.DisableLoadSettingFromRom:
121 and BYTE [g_MenuitemMainMenuLoadOldSettingsFromEeprom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
122 ret
123
124;--------------------------------------------------------------------
125; .EnableOrDisableConfigureXtideUniversalBios
126; Parameters:
127; DS: CFGVARS segment
128; Returns:
129; Nothing
130; Corrupts registers:
131; CX, SI, DI, ES
132;--------------------------------------------------------------------
133ALIGN JUMP_ALIGN
134.EnableOrDisableConfigureXtideUniversalBios:
135 call Buffers_IsXtideUniversalBiosLoaded
136 jne SHORT .DisableConfigureXtideUniversalBios
137 or BYTE [g_MenuitemMainMenuConfigureXtideUniversalBios+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
138 ret
139
140ALIGN JUMP_ALIGN
141.DisableConfigureXtideUniversalBios:
142 and BYTE [g_MenuitemMainMenuConfigureXtideUniversalBios+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
143 ret
144
145;--------------------------------------------------------------------
146; .EnableOrDisableFlashEeprom
147; Parameters:
148; DS: CFGVARS segment
149; Returns:
150; Nothing
151; Corrupts registers:
152; Nothing
153;--------------------------------------------------------------------
154ALIGN JUMP_ALIGN
155.EnableOrDisableFlashEeprom:
156 test WORD [g_cfgVars+CFGVARS.wFlags], FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED
157 jz SHORT .DisableFlashEeprom
158 or BYTE [g_MenuitemMainMenuFlashEeprom+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
159 ret
160
161ALIGN JUMP_ALIGN
162.DisableFlashEeprom:
163 and BYTE [g_MenuitemMainMenuFlashEeprom+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
164 ret
165
166
167
168;--------------------------------------------------------------------
169; MENUITEM activation functions (.fnActivate)
170; Parameters:
171; SS:BP: Ptr to MENU
172; Returns:
173; Nothing
174; Corrupts registers:
175; All, except segments
176;--------------------------------------------------------------------
177ALIGN JUMP_ALIGN
178ExitToDosSelectedFromMenu:
179 CALL_MENU_LIBRARY CloseMenuIfExitEventAllows
180ExitToDosFromBackButton:
181 ret
182
183
184ALIGN JUMP_ALIGN
185LoadBiosFromFile:
186 call Buffers_SaveChangesIfFileLoaded
187 mov cx, FILE_DIALOG_IO_size
188 call Memory_ReserveCXbytesFromStackToDSSI
189 call Dialogs_DisplayFileDialogWithDialogIoInDSSI
190 cmp BYTE [si+FILE_DIALOG_IO.bUserCancellation], TRUE
191 je SHORT .CancelFileLoading
192
193 add si, BYTE FILE_DIALOG_IO.szFile
194 call BiosFile_LoadFileFromDSSItoRamBuffer
195 call MainMenu_EnterMenuOrModifyItemVisibility
196.CancelFileLoading:
197 add sp, BYTE FILE_DIALOG_IO_size
198 ret
199
200
201ALIGN JUMP_ALIGN
202LoadXtideUniversalBiosFromRom:
203 call Buffers_SaveChangesIfFileLoaded
204 call EEPROM_LoadXtideUniversalBiosFromRomToRamBufferAndReturnSizeInDXCX
205 mov ax, FLG_CFGVARS_ROMLOADED
206 call Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration
207 mov dx, g_szDlgMainLoadROM
208 call Dialogs_DisplayNotificationFromCSDX
209 jmp MainMenu_EnterMenuOrModifyItemVisibility
210
211
212ALIGN JUMP_ALIGN
213LoadOldSettingsFromEeprom:
214 call Buffers_SaveChangesIfFileLoaded
215 call EEPROM_LoadOldSettingsFromRomToRamBuffer
216 and WORD [g_cfgVars+CFGVARS.wFlags], ~FLG_CFGVARS_UNSAVED
217 mov dx, g_szDlgMainLoadStngs
218 jmp Dialogs_DisplayNotificationFromCSDX
Note: See TracBrowser for help on using the repository browser.