source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/BootMenuSettingsMenu.asm@ 623

Last change on this file since 623 was 621, checked in by Krister Nordvall, 3 years ago

Changes:

  • Fixed three different bugs all causing the boot menu to show drives using IRQs even though the BIOS had been built without MODULE_IRQ.
  • Fixed two bugs in XTIDECFG where loading a BIOS from file and then loading the old settings from EEPROM would
    • overwrite ROMVARS.wFlags in the loaded BIOS file (in RAM). The possibly resulting mismatch of module flags could make it impossible to change settings for modules included in the BIOS or allow changing settings for modules not included in the BIOS.
    • not copy the color theme over to the loaded BIOS.
  • Also fixed two very minor bugs in XTIDECFG in BiosFile_LoadFileFromDSSItoRamBuffer and BiosFile_SaveRamBufferToFileInDSSI where the error handling in these routines would close whatever file handle that happened to match the error code returned by DOS in AX.
  • Made significant changes to the new flash ROM programming routines to reduce the size. Also fixed a minor bug that would cause the second verification to be skipped and return success when programming a 64 KB block of data.
  • Changed the custom BIOS build file names to the 8.3 format.
  • Changed some help strings in XTIDECFG to clarify things.
  • Other minor optimizations and fixes.
File size: 17.7 KB
Line 
1; Project name : XTIDE Universal BIOS Configurator v2
2; Description : "Boot settings" menu structs and functions.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing initialized data
21SECTION .data
22
23ALIGN WORD_ALIGN
24g_MenupageForBootMenuSettingsMenu:
25istruc MENUPAGE
26 at MENUPAGE.fnEnter, dw BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility
27 at MENUPAGE.fnBack, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility
28 at MENUPAGE.wMenuitems, dw 8
29iend
30
31g_MenuitemBootMnuStngsBackToConfigurationMenu:
32istruc MENUITEM
33 at MENUITEM.fnActivate, dw ConfigurationMenu_EnterMenuOrModifyItemVisibility
34 at MENUITEM.szName, dw g_szItemBackToCfgMenu
35 at MENUITEM.szQuickInfo, dw g_szNfoIdeBackToCfgMenu
36 at MENUITEM.szHelp, dw g_szNfoIdeBackToCfgMenu
37 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
38 at MENUITEM.bType, db TYPE_MENUITEM_PAGEBACK
39iend
40
41g_MenuitemBootMnuStngsDisplayMode:
42istruc MENUITEM
43 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
44 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
45 at MENUITEM.szName, dw g_szItemBootDispMode
46 at MENUITEM.szQuickInfo, dw g_szNfoDispMode
47 at MENUITEM.szHelp, dw g_szNfoDispMode
48 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE
49 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
50 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wDisplayMode
51 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgBootDispMode
52 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBootDispMode
53 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw g_rgwChoiceToValueLookupForDisplayModes
54 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForDisplayModes
55iend
56
57g_MenuitemBootMnuStngsColorTheme:
58istruc MENUITEM
59 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
60 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
61 at MENUITEM.szName, dw g_szItemColorTheme
62 at MENUITEM.szQuickInfo, dw g_szNfoColorTheme
63 at MENUITEM.szHelp, dw g_szHelpColorTheme
64 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU
65 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
66 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.pColorTheme ; Only ever read - never modified
67 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgColorTheme
68 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceColorTheme
69 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw NULL
70 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForColorTheme
71 at MENUITEM.itemValue + ITEM_VALUE.fnValueReader, dw ReadColorTheme
72 at MENUITEM.itemValue + ITEM_VALUE.fnValueWriter, dw WriteColorTheme
73iend
74
75g_MenuitemBootMnuStngsFloppyDrives:
76istruc MENUITEM
77 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
78 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromUnshiftedItemInDSSI
79 at MENUITEM.szName, dw g_szItemBootFloppyDrvs
80 at MENUITEM.szQuickInfo, dw g_szNfoBootFloppyDrvs
81 at MENUITEM.szHelp, dw g_szHelpBootFloppyDrvs
82 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE
83 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
84 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bMinFddCnt
85 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgBootFloppyDrvs
86 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBootFloppyDrvs
87 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw NULL
88 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFloppyDrives
89iend
90
91g_MenuitemBootMenuSerialScanDetect:
92istruc MENUITEM
93 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
94 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
95 at MENUITEM.szName, dw g_szItemSerialDetect
96 at MENUITEM.szQuickInfo, dw g_szNfoSerialDetect
97 at MENUITEM.szHelp, dw g_szHelpSerialDetect
98 at MENUITEM.bFlags, db FLG_MENUITEM_FLAGVALUE
99 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
100 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wFlags
101 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgSerialDetect
102 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
103 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
104 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_ROMVARS_SERIAL_SCANDETECT
105iend
106
107g_MenuitemBootMnuStngsDefaultBootDrive:
108istruc MENUITEM
109 at MENUITEM.fnActivate, dw Menuitem_ActivateHexInputForMenuitemInDSSI
110 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
111 at MENUITEM.szName, dw g_szItemBootDrive
112 at MENUITEM.szQuickInfo, dw g_szNfoBootDrive
113 at MENUITEM.szHelp, dw g_szHelpBootDrive
114 at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE
115 at MENUITEM.bType, db TYPE_MENUITEM_HEX
116 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bBootDrv
117 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgBootDrive
118 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 0
119 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 0FFh
120iend
121
122g_MenuitemBootMnuStngsSelectionTimeout:
123istruc MENUITEM
124 at MENUITEM.fnActivate, dw Menuitem_ActivateUnsignedInputForMenuitemInDSSI
125 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
126 at MENUITEM.szName, dw g_szItemBootTimeout
127 at MENUITEM.szQuickInfo, dw g_szNfoBootTimeout
128 at MENUITEM.szHelp, dw g_szHelpBootTimeout
129 at MENUITEM.bFlags, db NULL
130 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
131 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wBootTimeout
132 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgBootTimeout
133 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 2
134 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 1092
135iend
136
137g_MenuitemBootMnuStngsClearBdaDriveCount:
138istruc MENUITEM
139 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
140 at MENUITEM.fnFormatValue, dw MenuitemPrint_WriteLookupValueStringToBufferInESDIfromShiftedItemInDSSI
141 at MENUITEM.szName, dw g_szItemClearBdaDriveCount
142 at MENUITEM.szQuickInfo, dw g_szNfoClearBdaDriveCount
143 at MENUITEM.szHelp, dw g_szHelpClearBdaDriveCount
144 at MENUITEM.bFlags, db FLG_MENUITEM_VISIBLE | FLG_MENUITEM_FLAGVALUE
145 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
146 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wFlags
147 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgClearBdaDriveCount
148 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBooleanFlag
149 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFlagBooleans
150 at MENUITEM.itemValue + ITEM_VALUE.wValueBitmask, dw FLG_ROMVARS_CLEAR_BDA_HD_COUNT
151iend
152
153
154g_rgwChoiceToValueLookupForDisplayModes:
155 dw DEFAULT_TEXT_MODE
156 dw CGA_TEXT_MODE_BW40
157 dw CGA_TEXT_MODE_CO40
158 dw CGA_TEXT_MODE_BW80
159 dw CGA_TEXT_MODE_CO80
160 dw MDA_TEXT_MODE
161g_rgszValueToStringLookupForDisplayModes:
162 dw g_szValueBootDispModeBW40
163 dw g_szValueBootDispModeCO40
164 dw g_szValueBootDispModeBW80
165 dw g_szValueBootDispModeCO80
166 dw g_szValueBootDispModeDefault
167 dw NULL
168 dw NULL
169 dw g_szValueBootDispModeMono
170
171g_rgszValueToStringLookupForFloppyDrives:
172 dw g_szValueBootFloppyDrvsAuto
173 dw g_szValueBootFloppyDrvs1
174 dw g_szValueBootFloppyDrvs2
175 dw g_szValueBootFloppyDrvs3
176 dw g_szValueBootFloppyDrvs4
177
178g_rgszValueToStringLookupForColorTheme:
179 dw g_szValueColorTheme0
180 dw g_szValueColorTheme1
181 dw g_szValueColorTheme2
182 dw g_szValueColorTheme3
183 dw g_szValueColorTheme4
184 dw g_szValueColorTheme5
185
186ColorThemeTable:
187; Note! If there's ever a need to remove a theme or change a theme or reorder the themes then the ROMVARS version must be incremented.
188; This is for backwards compatibility. Adding new themes (at the bottom) however should work with no change to the ROMVARS version.
189 ; Classic (default)
190 db COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE) ; .cBordersAndBackground
191 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
192 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLUE) ; .cTitle
193 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLUE) ; .cItem
194 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_CYAN) ; .cHighlightedItem
195 db COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLUE) | FLG_COLOR_BLINK ; .cHurryTimeout
196 db COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE) ; .cNormalTimeout
197 ; Argon Blue
198 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) ; .cBordersAndBackground
199 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
200 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
201 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
202 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) ; .cHighlightedItem
203 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
204 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) ; .cNormalTimeout
205 ; Neon Red
206 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cBordersAndBackground
207 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
208 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
209 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
210 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cHighlightedItem
211 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
212 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cNormalTimeout
213 ; Phosphor Green
214 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cBordersAndBackground
215 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
216 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
217 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
218 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cHighlightedItem
219 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
220 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cNormalTimeout
221 ; Moon Surface
222 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cBordersAndBackground
223 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
224 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
225 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
226 db COLOR_ATTRIBUTE(COLOR_BROWN, COLOR_BLACK) ; .cHighlightedItem
227 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
228 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cNormalTimeout
229 ; Toxic Waste
230 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cBordersAndBackground
231 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
232 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cTitle
233 db COLOR_ATTRIBUTE(COLOR_LIGHT_CYAN, COLOR_BLACK) ; .cItem
234 db COLOR_ATTRIBUTE(COLOR_LIGHT_CYAN, COLOR_BLUE) ; .cHighlightedItem
235 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
236 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cNormalTimeout
237EndOfColorThemeTable:
238CountOfThemes equ (EndOfColorThemeTable-ColorThemeTable) / ATTRIBUTE_CHARS_size
239
240
241; Section containing code
242SECTION .text
243
244;--------------------------------------------------------------------
245; BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility
246; Parameters:
247; SS:BP: Menu handle
248; Returns:
249; Nothing
250; Corrupts registers:
251; All, except BP
252;--------------------------------------------------------------------
253ALIGN JUMP_ALIGN
254BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility:
255 push cs
256 pop ds
257 call Buffers_GetRomvarsFlagsToAX
258 call .EnableOrDisableScanForSerialDrives
259 call .EnableOrDisableDefaultBootDrive
260 call .EnableOrDisableColorThemeSelection
261 call .EnableOrDisableBootMenuSelectionTimeout
262 mov si, g_MenupageForBootMenuSettingsMenu
263 jmp Menupage_ChangeToNewMenupageInDSSI
264
265
266;--------------------------------------------------------------------
267; .EnableOrDisableScanForSerialDrives
268; Parameters:
269; AX: ROMVARS.wFlags
270; SS:BP: Menu handle
271; Returns:
272; Nothing
273; Corrupts registers:
274; BX
275;--------------------------------------------------------------------
276ALIGN JUMP_ALIGN
277.EnableOrDisableScanForSerialDrives:
278 mov bx, g_MenuitemBootMenuSerialScanDetect
279 test ax, FLG_ROMVARS_MODULE_SERIAL
280 jmp SHORT .DisableMenuitemFromCSBXifZFset
281
282
283;--------------------------------------------------------------------
284; .EnableOrDisableDefaultBootDrive
285; Parameters:
286; AX: ROMVARS.wFlags
287; SS:BP: Menu handle
288; Returns:
289; Nothing
290; Corrupts registers:
291; BX
292;--------------------------------------------------------------------
293ALIGN JUMP_ALIGN
294.EnableOrDisableDefaultBootDrive:
295 mov bx, g_MenuitemBootMnuStngsDefaultBootDrive
296 test ax, FLG_ROMVARS_MODULE_HOTKEYS | FLG_ROMVARS_MODULE_BOOT_MENU
297 jmp SHORT .DisableMenuitemFromCSBXifZFset
298
299
300;--------------------------------------------------------------------
301; .EnableOrDisableColorThemeSelection
302; Parameters:
303; AX: ROMVARS.wFlags
304; SS:BP: Menu handle
305; Returns:
306; Nothing
307; Corrupts registers:
308; BX
309;--------------------------------------------------------------------
310ALIGN JUMP_ALIGN
311.EnableOrDisableColorThemeSelection:
312 mov bx, g_MenuitemBootMnuStngsColorTheme
313 test ax, FLG_ROMVARS_MODULE_BOOT_MENU
314 jmp SHORT .DisableMenuitemFromCSBXifZFset
315
316
317;--------------------------------------------------------------------
318; .EnableOrDisableBootMenuSelectionTimeout
319; Parameters:
320; AX: ROMVARS.wFlags
321; SS:BP: Menu handle
322; Returns:
323; Nothing
324; Corrupts registers:
325; BX
326;--------------------------------------------------------------------
327ALIGN JUMP_ALIGN
328.EnableOrDisableBootMenuSelectionTimeout:
329 mov bx, g_MenuitemBootMnuStngsSelectionTimeout
330 test ax, FLG_ROMVARS_MODULE_BOOT_MENU
331.DisableMenuitemFromCSBXifZFset:
332 jz SHORT .DisableMenuitemFromCSBX
333 ; Fall to .EnableMenuitemFromCSBX
334
335
336;--------------------------------------------------------------------
337; .EnableMenuitemFromCSBX
338; .DisableMenuitemFromCSBX
339; Parameters:
340; CS:BX: Ptr to MENUITEM
341; Returns:
342; Nothing
343; Corrupts registers:
344; Nothing
345;--------------------------------------------------------------------
346ALIGN JUMP_ALIGN
347.EnableMenuitemFromCSBX:
348 jmp EnableMenuitemFromCSBX
349
350ALIGN JUMP_ALIGN
351.DisableMenuitemFromCSBX:
352 jmp DisableMenuitemFromCSBX
353
354
355;--------------------------------------------------------------------
356; ReadColorTheme
357; Parameters:
358; AX: Value read from the ROMVARS location
359; ES:DI: ROMVARS location where the value was just read from
360; DS:SI: MENUITEM pointer
361; Returns:
362; AX: Value that the MENUITEM system will interact with and display
363; Corrupts registers:
364; BX, DI, ES
365;--------------------------------------------------------------------
366ALIGN JUMP_ALIGN
367ReadColorTheme:
368 push ds
369
370 push es ; ES -> DS
371 pop ds
372 push cs ; CS -> ES
373 pop es
374
375 mov di, EndOfColorThemeTable-1 ; ES:DI now points to the end of the last theme in the table of available themes in XTIDECFG
376 xor bx, bx
377
378 push si
379 push cx
380 mov cx, CountOfThemes
381 std
382.NextTheme:
383 push cx
384 mov cl, ATTRIBUTE_CHARS_size
385 mov si, ax ; [ROMVARS.pColorTheme] to SI
386 dec si
387 add si, cx ; DS:SI now points to the end of the ColorTheme in the loaded BIOS
388 sub di, bx ; Update the pointer to the end of the next theme in the table
389
390 ; We verify that the theme in the loaded BIOS exists in our table. If it doesn't exist then that most likely means
391 ; the loaded BIOS doesn't contain MODULE_BOOT_MENU and the theme actually isn't a theme - it's code. Either way,
392 ; we don't trust it enough to copy it over as corrupt/invalid settings could render the UI in XTIDECFG unreadable.
393 repe cmpsb
394 mov bx, cx
395 pop cx
396 loopne .NextTheme
397 cld
398 mov ax, cx
399 jne SHORT .SkipCopy
400
401 ; Copy the color theme fron the loaded BIOS overwriting XTIDECFG's own theme
402 inc si
403 mov di, ColorTheme ; ES:DI now points to ColorTheme in XTIDECFG
404
405 mov cl, ATTRIBUTE_CHARS_size
406 call Memory_CopyCXbytesFromDSSItoESDI
407
408.SkipCopy:
409 pop cx
410 pop si
411 pop ds
412 ret
413
414
415;--------------------------------------------------------------------
416; WriteColorTheme
417; Parameters:
418; AX: Value that the MENUITEM system was interacting with
419; ES:DI: ROMVARS location where the value is to be stored
420; DS:SI: MENUITEM pointer
421; Returns:
422; AX: Value to actually write to ROMVARS
423; Corrupts registers:
424; Nothing
425;--------------------------------------------------------------------
426ALIGN JUMP_ALIGN
427WriteColorTheme:
428 push cx
429 push si
430 push di
431
432 mov cx, ATTRIBUTE_CHARS_size
433 mul cl ; Multiply with the menu choice index
434 mov si, [es:di] ; Fetch the ptr to ColorTheme
435 add ax, ColorThemeTable
436 xchg si, ax
437 mov di, ax
438
439 call Memory_CopyCXbytesFromDSSItoESDI
440
441 pop di
442 pop si
443 pop cx
444 ret
445
Note: See TracBrowser for help on using the repository browser.