1 | ; Project name : XTIDE Universal BIOS Configurator v2
|
---|
2 | ; Description : Main menu structs and functions.
|
---|
3 |
|
---|
4 | ; Section containing initialized data
|
---|
5 | SECTION .data
|
---|
6 |
|
---|
7 | ALIGN WORD_ALIGN
|
---|
8 | g_MenupageForMainMenu:
|
---|
9 | istruc MENUPAGE
|
---|
10 | at MENUPAGE.fnEnter, dw MainMenu_EnterMenuOrModifyItemVisibility
|
---|
11 | at MENUPAGE.fnBack, dw ExitToDos
|
---|
12 | at MENUPAGE.wMenuitems, dw 6
|
---|
13 | iend
|
---|
14 |
|
---|
15 | g_MenuitemMainMenuExitToDos:
|
---|
16 | istruc 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
|
---|
23 | iend
|
---|
24 |
|
---|
25 | g_MenuitemMainMenuLoadBiosFromFile:
|
---|
26 | istruc 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
|
---|
33 | iend
|
---|
34 |
|
---|
35 | g_MenuitemMainMenuLoadXtideUniversalBiosFromRom:
|
---|
36 | istruc 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
|
---|
43 | iend
|
---|
44 |
|
---|
45 | g_MenuitemMainMenuLoadOldSettingsFromEeprom:
|
---|
46 | istruc 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
|
---|
53 | iend
|
---|
54 |
|
---|
55 | g_MenuitemMainMenuConfigureXtideUniversalBios:
|
---|
56 | istruc 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
|
---|
63 | iend
|
---|
64 |
|
---|
65 | g_MenuitemMainMenuFlashEeprom:
|
---|
66 | istruc 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
|
---|
73 | iend
|
---|
74 |
|
---|
75 |
|
---|
76 | ; Section containing code
|
---|
77 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
88 | ALIGN JUMP_ALIGN
|
---|
89 | MainMenu_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 | ;--------------------------------------------------------------------
|
---|
107 | ALIGN 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 |
|
---|
117 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
133 | ALIGN 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 |
|
---|
140 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
154 | ALIGN 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 |
|
---|
161 | ALIGN 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 | ;--------------------------------------------------------------------
|
---|
177 | ALIGN JUMP_ALIGN
|
---|
178 | ExitToDos:
|
---|
179 | CALL_MENU_LIBRARY Close
|
---|
180 | ret
|
---|
181 |
|
---|
182 |
|
---|
183 | ALIGN JUMP_ALIGN
|
---|
184 | LoadBiosFromFile:
|
---|
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 |
|
---|
200 | ALIGN JUMP_ALIGN
|
---|
201 | LoadXtideUniversalBiosFromRom:
|
---|
202 | call Buffers_SaveChangesIfFileLoaded
|
---|
203 | call EEPROM_LoadXtideUniversalBiosFromRomToRamBufferAndReturnSizeInDXCX
|
---|
204 | mov ax, FLG_CFGVARS_ROMLOADED
|
---|
205 | call Buffers_NewBiosWithSizeInDXCXandSourceInAXhasBeenLoadedForConfiguration
|
---|
206 | mov dx, g_szDlgMainLoadROM
|
---|
207 | jmp Dialogs_DisplayNotificationFromCSDX
|
---|
208 |
|
---|
209 |
|
---|
210 | ALIGN JUMP_ALIGN
|
---|
211 | LoadOldSettingsFromEeprom:
|
---|
212 | call Buffers_SaveChangesIfFileLoaded
|
---|
213 | call EEPROM_LoadOldSettingsFromRomToRamBuffer
|
---|
214 | and WORD [g_cfgVars+CFGVARS.wFlags], ~FLG_CFGVARS_UNSAVED
|
---|
215 | mov dx, g_szDlgMainLoadStngs
|
---|
216 | jmp Dialogs_DisplayNotificationFromCSDX
|
---|