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

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

Changes to Configurator v2:

  • Warm boot flag is now reset when rebooting.
  • Checksum generation no longer corrupts images when image size is less than EEPROM size.
  • Configuration and flashing menu items are now displayed when loading BIOS from EEPROM.
File size: 6.8 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 ExitToDos
12 at MENUPAGE.wMenuitems, dw 6
13iend
14
15g_MenuitemMainMenuExitToDos:
16istruc MENUITEM
17 at MENUITEM.fnActivate, dw ExitToDos
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_PAGEBACK
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
178ExitToDos:
179 CALL_MENU_LIBRARY Close
180 ret
181
182
183ALIGN JUMP_ALIGN
184LoadBiosFromFile:
185 call Buffers_SaveChangesIfFileLoaded
186 mov cx, FILE_DIALOG_IO_size
187 call Memory_ReserveCXbytesFromStackToDSSI
188 call Dialogs_DisplayFileDialogWithDialogIoInDSSI
189 cmp BYTE [si+FILE_DIALOG_IO.bUserCancellation], TRUE
190 je SHORT .CancelFileLoading
191
192 add si, BYTE FILE_DIALOG_IO.szFile
193 call BiosFile_LoadFileFromDSSItoRamBuffer
194 call MainMenu_EnterMenuOrModifyItemVisibility
195.CancelFileLoading:
196 add sp, BYTE FILE_DIALOG_IO_size
197 ret
198
199
200ALIGN JUMP_ALIGN
201LoadXtideUniversalBiosFromRom:
202 call Buffers_SaveChangesIfFileLoaded
203 call EEPROM_LoadXtideUniversalBiosFromRomToRamBufferAndReturnSizeInDXCX
204 mov ax, FLG_CFGVARS_ROMLOADED
205 call Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration
206 mov dx, g_szDlgMainLoadROM
207 call Dialogs_DisplayNotificationFromCSDX
208 jmp MainMenu_EnterMenuOrModifyItemVisibility
209
210
211ALIGN JUMP_ALIGN
212LoadOldSettingsFromEeprom:
213 call Buffers_SaveChangesIfFileLoaded
214 call EEPROM_LoadOldSettingsFromRomToRamBuffer
215 and WORD [g_cfgVars+CFGVARS.wFlags], ~FLG_CFGVARS_UNSAVED
216 mov dx, g_szDlgMainLoadStngs
217 jmp Dialogs_DisplayNotificationFromCSDX
Note: See TracBrowser for help on using the repository browser.