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

Last change on this file since 625 was 625, checked in by Krister Nordvall, 22 months ago

Changes:

  • Added a configuration option to let the BIOS store RamVars to an UMB when Full operating mode is enabled. This is primarily for XT class machines with RAM in the UMA (which apparently is a common thing these days).
  • Added two new builds specifically for IBM PS/2 machines. This is for support of the new McIDE adapter from the guys at zzxio.com. Note that the additional hardware specific code (under the USE_PS2 define) is for the PS/2 machines themselves and not for the McIDE adapters, so any controller in an IBM PS/2 machine can be used with the USE_PS2 define.
  • Moved pColorTheme out of the range of ROMVARS being copied over when doing "Load old settings from EEPROM" in XTIDECFG. This fixed a serious bug from r592 where loading a BIOS from file and then loading the old settings from ROM would corrupt 7 bytes of code somewhere in the loaded BIOS.
  • Optimizations (speed and size) to the library. Browsing the menus in XTIDECFG should now feel a little less sluggish.
  • Hopefully fixed a problem with the PostCommitHook script where it sometimes wouldn't find the CommitInProgress file. I say hopefully because testing this is a nightmare.
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-2023 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 add, remove or change a theme or reorder the themes then the ROMVARS version must be incremented.
188 ; Classic (default)
189 db COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE) ; .cBordersAndBackground
190 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
191 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLUE) ; .cTitle
192 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLUE) ; .cItem
193 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_CYAN) ; .cHighlightedItem
194 db COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLUE) | FLG_COLOR_BLINK ; .cHurryTimeout
195 db COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE) ; .cNormalTimeout
196 ; Argon Blue
197 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) ; .cBordersAndBackground
198 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
199 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
200 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
201 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) ; .cHighlightedItem
202 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
203 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) ; .cNormalTimeout
204 ; Neon Red
205 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cBordersAndBackground
206 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
207 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
208 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
209 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cHighlightedItem
210 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
211 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cNormalTimeout
212 ; Phosphor Green
213 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cBordersAndBackground
214 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
215 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
216 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
217 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cHighlightedItem
218 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
219 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cNormalTimeout
220 ; Moon Surface
221 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cBordersAndBackground
222 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
223 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
224 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
225 db COLOR_ATTRIBUTE(COLOR_BROWN, COLOR_BLACK) ; .cHighlightedItem
226 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
227 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cNormalTimeout
228 ; Toxic Waste
229 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cBordersAndBackground
230 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
231 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cTitle
232 db COLOR_ATTRIBUTE(COLOR_LIGHT_CYAN, COLOR_BLACK) ; .cItem
233 db COLOR_ATTRIBUTE(COLOR_LIGHT_CYAN, COLOR_BLUE) ; .cHighlightedItem
234 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
235 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cNormalTimeout
236EndOfColorThemeTable:
237CountOfThemes equ (EndOfColorThemeTable-ColorThemeTable) / ATTRIBUTE_CHARS_size
238
239
240; Section containing code
241SECTION .text
242
243;--------------------------------------------------------------------
244; BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility
245; Parameters:
246; SS:BP: Menu handle
247; Returns:
248; Nothing
249; Corrupts registers:
250; All, except BP
251;--------------------------------------------------------------------
252ALIGN JUMP_ALIGN
253BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility:
254 push cs
255 pop ds
256 call Buffers_GetRomvarsFlagsToAX
257 call .EnableOrDisableScanForSerialDrives
258 call .EnableOrDisableDefaultBootDrive
259 call .EnableOrDisableColorThemeSelection
260 call .EnableOrDisableBootMenuSelectionTimeout
261 mov si, g_MenupageForBootMenuSettingsMenu
262 jmp Menupage_ChangeToNewMenupageInDSSI
263
264
265;--------------------------------------------------------------------
266; .EnableOrDisableScanForSerialDrives
267; Parameters:
268; AX: ROMVARS.wFlags
269; SS:BP: Menu handle
270; Returns:
271; Nothing
272; Corrupts registers:
273; BX
274;--------------------------------------------------------------------
275ALIGN JUMP_ALIGN
276.EnableOrDisableScanForSerialDrives:
277 mov bx, g_MenuitemBootMenuSerialScanDetect
278 test ax, FLG_ROMVARS_MODULE_SERIAL
279 jmp SHORT .DisableMenuitemFromCSBXifZFset
280
281
282;--------------------------------------------------------------------
283; .EnableOrDisableDefaultBootDrive
284; Parameters:
285; AX: ROMVARS.wFlags
286; SS:BP: Menu handle
287; Returns:
288; Nothing
289; Corrupts registers:
290; BX
291;--------------------------------------------------------------------
292ALIGN JUMP_ALIGN
293.EnableOrDisableDefaultBootDrive:
294 mov bx, g_MenuitemBootMnuStngsDefaultBootDrive
295 test ax, FLG_ROMVARS_MODULE_HOTKEYS | FLG_ROMVARS_MODULE_BOOT_MENU
296 jmp SHORT .DisableMenuitemFromCSBXifZFset
297
298
299;--------------------------------------------------------------------
300; .EnableOrDisableColorThemeSelection
301; Parameters:
302; AX: ROMVARS.wFlags
303; SS:BP: Menu handle
304; Returns:
305; Nothing
306; Corrupts registers:
307; BX
308;--------------------------------------------------------------------
309ALIGN JUMP_ALIGN
310.EnableOrDisableColorThemeSelection:
311 mov bx, g_MenuitemBootMnuStngsColorTheme
312 test ax, FLG_ROMVARS_MODULE_BOOT_MENU
313 jmp SHORT .DisableMenuitemFromCSBXifZFset
314
315
316;--------------------------------------------------------------------
317; .EnableOrDisableBootMenuSelectionTimeout
318; Parameters:
319; AX: ROMVARS.wFlags
320; SS:BP: Menu handle
321; Returns:
322; Nothing
323; Corrupts registers:
324; BX
325;--------------------------------------------------------------------
326ALIGN JUMP_ALIGN
327.EnableOrDisableBootMenuSelectionTimeout:
328 mov bx, g_MenuitemBootMnuStngsSelectionTimeout
329 test ax, FLG_ROMVARS_MODULE_BOOT_MENU
330.DisableMenuitemFromCSBXifZFset:
331 jz SHORT .DisableMenuitemFromCSBX
332 ; Fall to .EnableMenuitemFromCSBX
333
334
335;--------------------------------------------------------------------
336; .EnableMenuitemFromCSBX
337; .DisableMenuitemFromCSBX
338; Parameters:
339; CS:BX: Ptr to MENUITEM
340; Returns:
341; Nothing
342; Corrupts registers:
343; Nothing
344;--------------------------------------------------------------------
345ALIGN JUMP_ALIGN
346.EnableMenuitemFromCSBX:
347 jmp EnableMenuitemFromCSBX
348
349ALIGN JUMP_ALIGN
350.DisableMenuitemFromCSBX:
351 jmp DisableMenuitemFromCSBX
352
353
354;--------------------------------------------------------------------
355; ReadColorTheme
356; Parameters:
357; AX: Value read from the ROMVARS location
358; ES:DI: ROMVARS location where the value was just read from
359; DS:SI: MENUITEM pointer
360; Returns:
361; AX: Value that the MENUITEM system will interact with and display
362; Corrupts registers:
363; BX, DI, ES
364;--------------------------------------------------------------------
365ALIGN JUMP_ALIGN
366ReadColorTheme:
367 push ds
368
369 push es ; ES -> DS
370 pop ds
371 push cs ; CS -> ES
372 pop es
373
374 mov di, EndOfColorThemeTable-1 ; ES:DI now points to the end of the last theme in the table of available themes in XTIDECFG
375 xor bx, bx
376
377 push si
378 push cx
379 mov cx, CountOfThemes
380 std
381.NextTheme:
382 push cx
383 mov cl, ATTRIBUTE_CHARS_size
384 mov si, ax ; [ROMVARS.pColorTheme] to SI
385 dec si
386 add si, cx ; DS:SI now points to the end of the ColorTheme in the loaded BIOS
387 sub di, bx ; Update the pointer to the end of the next theme in the table
388
389 ; We verify that the theme in the loaded BIOS exists in our table. If it doesn't exist then that most likely means
390 ; the loaded BIOS doesn't contain MODULE_BOOT_MENU and the theme actually isn't a theme - it's code. Either way,
391 ; we don't trust it enough to copy it over as corrupt/invalid settings could render the UI in XTIDECFG unreadable.
392 repe cmpsb
393 mov bx, cx
394 pop cx
395 loopne .NextTheme
396 cld
397 mov ax, cx ; Return the color theme index in AX; zero (default theme) if a theme was not found
398 jne SHORT .SkipCopy
399
400 ; Copy the color theme fron the loaded BIOS overwriting XTIDECFG's own theme
401 inc si
402 mov di, ColorTheme ; ES:DI now points to ColorTheme in XTIDECFG
403
404 mov cl, ATTRIBUTE_CHARS_size
405 call Memory_CopyCXbytesFromDSSItoESDI
406
407.SkipCopy:
408 pop cx
409 pop si
410 pop ds
411 ret
412
413
414;--------------------------------------------------------------------
415; WriteColorTheme
416; Parameters:
417; AX: Value that the MENUITEM system was interacting with
418; ES:DI: ROMVARS location where the value is to be stored
419; DS:SI: MENUITEM pointer
420; Returns:
421; AX: Value to actually write to ROMVARS
422; Corrupts registers:
423; Nothing
424;--------------------------------------------------------------------
425ALIGN JUMP_ALIGN
426WriteColorTheme:
427 push cx
428 push si
429 push di
430
431 mov cx, ATTRIBUTE_CHARS_size
432 mul cl ; Multiply with the menu choice index
433 mov si, [es:di] ; Fetch the ptr to ColorTheme
434 add ax, ColorThemeTable
435 xchg si, ax
436 mov di, ax
437
438 call Memory_CopyCXbytesFromDSSItoESDI
439
440 pop di
441 pop si
442 pop cx
443 ret
444
Note: See TracBrowser for help on using the repository browser.