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

Last change on this file since 606 was 605, checked in by Krister Nordvall, 4 years ago

Changes:

  • The "Remove other hard drives" option in the Boot settings menu in XTIDECFG is now exposed in all BIOS builds. This is needed because the system BIOS in at least two Zenith computer models (Z-161 and Z-171) does not clear the BDA HD count which causes it to increment on warm boot. Running "Auto Configure" in XTIDECFG now also tries to identify these machines by doing a CRC check on the system BIOS and sets the option to YES if a match is found.
  • WORD_ALIGN is now 2 for XT builds. This should benefit XT class machines with 8086 and NEC V30 CPU:s and the cost is negligible (1 byte for the XT BIOS builds and 12 bytes for XTIDECFG.COM).
  • Other minor optimizations.
File size: 17.5 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 ; Classic (default)
188 db COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE) ; .cBordersAndBackground
189 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
190 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLUE) ; .cTitle
191 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLUE) ; .cItem
192 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_CYAN) ; .cHighlightedItem
193 db COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLUE) | FLG_COLOR_BLINK ; .cHurryTimeout
194 db COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE) ; .cNormalTimeout
195 ; Argon Blue
196 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) ; .cBordersAndBackground
197 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
198 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
199 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
200 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) ; .cHighlightedItem
201 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
202 db COLOR_ATTRIBUTE(COLOR_LIGHT_BLUE, COLOR_BLACK) ; .cNormalTimeout
203 ; Neon Red
204 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cBordersAndBackground
205 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
206 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
207 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
208 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cHighlightedItem
209 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
210 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cNormalTimeout
211 ; Phosphor Green
212 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cBordersAndBackground
213 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
214 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
215 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
216 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cHighlightedItem
217 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
218 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cNormalTimeout
219 ; Moon Surface
220 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cBordersAndBackground
221 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
222 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) ; .cTitle
223 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cItem
224 db COLOR_ATTRIBUTE(COLOR_BROWN, COLOR_BLACK) ; .cHighlightedItem
225 db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
226 db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK) ; .cNormalTimeout
227 ; Toxic Waste
228 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cBordersAndBackground
229 db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK) ; .cShadow
230 db COLOR_ATTRIBUTE(COLOR_LIGHT_GREEN, COLOR_BLACK) ; .cTitle
231 db COLOR_ATTRIBUTE(COLOR_LIGHT_CYAN, COLOR_BLACK) ; .cItem
232 db COLOR_ATTRIBUTE(COLOR_LIGHT_CYAN, COLOR_BLUE) ; .cHighlightedItem
233 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) | FLG_COLOR_BLINK ; .cHurryTimeout
234 db COLOR_ATTRIBUTE(COLOR_LIGHT_RED, COLOR_BLACK) ; .cNormalTimeout
235EndOfColorThemeTable:
236CountOfThemes equ (EndOfColorThemeTable-ColorThemeTable) / ATTRIBUTE_CHARS_size
237
238
239; Section containing code
240SECTION .text
241
242;--------------------------------------------------------------------
243; BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility
244; Parameters:
245; SS:BP: Menu handle
246; Returns:
247; Nothing
248; Corrupts registers:
249; All, except BP
250;--------------------------------------------------------------------
251ALIGN JUMP_ALIGN
252BootMenuSettingsMenu_EnterMenuOrModifyItemVisibility:
253 push cs
254 pop ds
255 call Buffers_GetRomvarsFlagsToAX
256 call .EnableOrDisableScanForSerialDrives
257 call .EnableOrDisableDefaultBootDrive
258 call .EnableOrDisableColorThemeSelection
259 call .EnableOrDisableBootMenuSelectionTimeout
260 mov si, g_MenupageForBootMenuSettingsMenu
261 jmp Menupage_ChangeToNewMenupageInDSSI
262
263
264;--------------------------------------------------------------------
265; .EnableOrDisableScanForSerialDrives
266; Parameters:
267; AX: ROMVARS.wFlags
268; SS:BP: Menu handle
269; Returns:
270; Nothing
271; Corrupts registers:
272; BX
273;--------------------------------------------------------------------
274ALIGN JUMP_ALIGN
275.EnableOrDisableScanForSerialDrives:
276 mov bx, g_MenuitemBootMenuSerialScanDetect
277 test ax, FLG_ROMVARS_MODULE_SERIAL
278 jmp SHORT .DisableMenuitemFromCSBXifZFset
279
280
281;--------------------------------------------------------------------
282; .EnableOrDisableDefaultBootDrive
283; Parameters:
284; AX: ROMVARS.wFlags
285; SS:BP: Menu handle
286; Returns:
287; Nothing
288; Corrupts registers:
289; BX
290;--------------------------------------------------------------------
291ALIGN JUMP_ALIGN
292.EnableOrDisableDefaultBootDrive:
293 mov bx, g_MenuitemBootMnuStngsDefaultBootDrive
294 test ax, FLG_ROMVARS_MODULE_HOTKEYS | FLG_ROMVARS_MODULE_BOOT_MENU
295 jmp SHORT .DisableMenuitemFromCSBXifZFset
296
297
298;--------------------------------------------------------------------
299; .EnableOrDisableColorThemeSelection
300; Parameters:
301; AX: ROMVARS.wFlags
302; SS:BP: Menu handle
303; Returns:
304; Nothing
305; Corrupts registers:
306; BX
307;--------------------------------------------------------------------
308ALIGN JUMP_ALIGN
309.EnableOrDisableColorThemeSelection:
310 mov bx, g_MenuitemBootMnuStngsColorTheme
311 test ax, FLG_ROMVARS_MODULE_BOOT_MENU
312 jmp SHORT .DisableMenuitemFromCSBXifZFset
313
314
315;--------------------------------------------------------------------
316; .EnableOrDisableBootMenuSelectionTimeout
317; Parameters:
318; AX: ROMVARS.wFlags
319; SS:BP: Menu handle
320; Returns:
321; Nothing
322; Corrupts registers:
323; BX
324;--------------------------------------------------------------------
325ALIGN JUMP_ALIGN
326.EnableOrDisableBootMenuSelectionTimeout:
327 mov bx, g_MenuitemBootMnuStngsSelectionTimeout
328 test ax, FLG_ROMVARS_MODULE_BOOT_MENU
329.DisableMenuitemFromCSBXifZFset:
330 jz SHORT .DisableMenuitemFromCSBX
331 ; Fall to .EnableMenuitemFromCSBX
332
333
334;--------------------------------------------------------------------
335; .EnableMenuitemFromCSBX
336; .DisableMenuitemFromCSBX
337; Parameters:
338; CS:BX: Ptr to MENUITEM
339; Returns:
340; Nothing
341; Corrupts registers:
342; Nothing
343;--------------------------------------------------------------------
344ALIGN JUMP_ALIGN
345.EnableMenuitemFromCSBX:
346 jmp EnableMenuitemFromCSBX
347
348ALIGN JUMP_ALIGN
349.DisableMenuitemFromCSBX:
350 jmp DisableMenuitemFromCSBX
351
352
353;--------------------------------------------------------------------
354; ReadColorTheme
355; Parameters:
356; AX: Value read from the ROMVARS location
357; ES:DI: ROMVARS location where the value was just read from
358; DS:SI: MENUITEM pointer
359; Returns:
360; AX: Value that the MENUITEM system will interact with and display
361; Corrupts registers:
362; BX, DI, ES
363;--------------------------------------------------------------------
364ALIGN JUMP_ALIGN
365ReadColorTheme:
366 push ds
367
368 push es ; ES -> DS
369 pop ds
370 push cs ; CS -> ES
371 pop es
372
373 mov di, EndOfColorThemeTable-1 ; ES:DI now points to the end of the last theme in the table of available themes in XTIDECFG
374 xor bx, bx
375
376 push si
377 push cx
378 mov cx, CountOfThemes
379 std
380.NextTheme:
381 push cx
382 mov cl, ATTRIBUTE_CHARS_size
383 mov si, ax ; [ROMVARS.pColorTheme] to SI
384 dec si
385 add si, cx ; DS:SI now points to the end of the ColorTheme in the loaded BIOS
386 sub di, bx ; Update the pointer to the end of the next theme in the table
387
388 ; We verify that the theme in the loaded BIOS exists in our table. If it doesn't exist then that most likely means
389 ; the loaded BIOS doesn't contain MODULE_BOOT_MENU and the theme actually isn't a theme - it's code. Either way,
390 ; we don't trust it enough to copy it over as corrupt/invalid settings could render the UI in XTIDECFG unreadable.
391 repe cmpsb
392 mov bx, cx
393 pop cx
394 loopne .NextTheme
395 cld
396 mov ax, cx
397 jne SHORT .SkipCopy
398
399 ; Copy the color theme fron the loaded BIOS overwriting XTIDECFG's own theme
400 inc si
401 mov di, ColorTheme ; ES:DI now points to ColorTheme in XTIDECFG
402
403 mov cl, ATTRIBUTE_CHARS_size
404 call Memory_CopyCXbytesFromDSSItoESDI
405
406.SkipCopy:
407 pop cx
408 pop si
409 pop ds
410 ret
411
412
413;--------------------------------------------------------------------
414; WriteColorTheme
415; Parameters:
416; AX: Value that the MENUITEM system was interacting with
417; ES:DI: ROMVARS location where the value is to be stored
418; DS:SI: MENUITEM pointer
419; Returns:
420; AX: Value to actually write to ROMVARS
421; Corrupts registers:
422; Nothing
423;--------------------------------------------------------------------
424ALIGN JUMP_ALIGN
425WriteColorTheme:
426 push cx
427 push si
428 push di
429
430 mov cx, ATTRIBUTE_CHARS_size
431 mul cl ; Multiply with the menu choice index
432 mov si, [es:di] ; Fetch the ptr to ColorTheme
433 add ax, ColorThemeTable
434 xchg si, ax
435 mov di, ax
436
437 call Memory_CopyCXbytesFromDSSItoESDI
438
439 pop di
440 pop si
441 pop cx
442 ret
443
Note: See TracBrowser for help on using the repository browser.