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

Last change on this file since 604 was 597, checked in by Tomi Tilli, 6 years ago

Windows 95 CMOS hack now works with Award BIOSes.
Some small optimizations to INT 19h and INT 19h reset handlers.
Added menuitem to configurator for clearing BDA drive count.

File size: 18.0 KB
RevLine 
[59]1; Project name : XTIDE Universal BIOS Configurator v2
[592]2; Description : "Boot settings" menu structs and functions.
[59]3
[376]4;
[399]5; XTIDE Universal BIOS and Associated Tools
[526]6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]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.
[399]12;
[376]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
[399]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
[399]18;
[376]19
[59]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
[597]28 at MENUPAGE.wMenuitems, dw 8
[59]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
[144]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
[592]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
[59]75g_MenuitemBootMnuStngsFloppyDrives:
76istruc MENUITEM
[108]77 at MENUITEM.fnActivate, dw Menuitem_ActivateMultichoiceSelectionForMenuitemInDSSI
[59]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
[108]83 at MENUITEM.bType, db TYPE_MENUITEM_MULTICHOICE
[59]84 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.bMinFddCnt
85 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgBootFloppyDrvs
[108]86 at MENUITEM.itemValue + ITEM_VALUE.szMultichoice, dw g_szMultichoiceBootFloppyDrvs
[199]87 at MENUITEM.itemValue + ITEM_VALUE.rgwChoiceToValueLookup, dw NULL
[59]88 at MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup, dw g_rgszValueToStringLookupForFloppyDrives
89iend
90
[399]91g_MenuitemBootMenuSerialScanDetect:
[290]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
[403]98 at MENUITEM.bFlags, db FLG_MENUITEM_FLAGVALUE
[290]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
[459]114 at MENUITEM.bFlags, db FLG_MENUITEM_BYTEVALUE
[290]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
[59]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
[290]129 at MENUITEM.bFlags, db NULL
[59]130 at MENUITEM.bType, db TYPE_MENUITEM_UNSIGNED
[136]131 at MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset, dw ROMVARS.wBootTimeout
[59]132 at MENUITEM.itemValue + ITEM_VALUE.szDialogTitle, dw g_szDlgBootTimeout
[290]133 at MENUITEM.itemValue + ITEM_VALUE.wMinValue, dw 2
[136]134 at MENUITEM.itemValue + ITEM_VALUE.wMaxValue, dw 1092
[59]135iend
136
[597]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_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_IGNORE_MOTHERBOARD_DRIVES
151iend
152
153
[144]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
[59]171g_rgszValueToStringLookupForFloppyDrives:
172 dw g_szValueBootFloppyDrvsAuto
173 dw g_szValueBootFloppyDrvs1
174 dw g_szValueBootFloppyDrvs2
175 dw g_szValueBootFloppyDrvs3
176 dw g_szValueBootFloppyDrvs4
177
[592]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
[59]185
[592]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
[59]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
[580]255 call Buffers_GetRomvarsFlagsToAX
[459]256 call .EnableOrDisableScanForSerialDrives
257 call .EnableOrDisableDefaultBootDrive
[592]258 call .EnableOrDisableColorThemeSelection
[459]259 call .EnableOrDisableBootMenuSelectionTimeout
[597]260 call .EnableOrDisableClearBdaDriveCount
[59]261 mov si, g_MenupageForBootMenuSettingsMenu
262 jmp Menupage_ChangeToNewMenupageInDSSI
[290]263
264
265;--------------------------------------------------------------------
[459]266; .EnableOrDisableScanForSerialDrives
[290]267; Parameters:
[580]268; AX: ROMVARS.wFlags
[290]269; SS:BP: Menu handle
270; Returns:
271; Nothing
272; Corrupts registers:
[580]273; BX
[290]274;--------------------------------------------------------------------
275ALIGN JUMP_ALIGN
[459]276.EnableOrDisableScanForSerialDrives:
277 mov bx, g_MenuitemBootMenuSerialScanDetect
278 test ax, FLG_ROMVARS_MODULE_SERIAL
279 jmp SHORT .DisableMenuitemFromCSBXifZFset
[290]280
281
[459]282;--------------------------------------------------------------------
283; .EnableOrDisableDefaultBootDrive
284; Parameters:
[580]285; AX: ROMVARS.wFlags
[459]286; SS:BP: Menu handle
287; Returns:
288; Nothing
289; Corrupts registers:
[580]290; BX
[459]291;--------------------------------------------------------------------
292ALIGN JUMP_ALIGN
293.EnableOrDisableDefaultBootDrive:
294 mov bx, g_MenuitemBootMnuStngsDefaultBootDrive
[580]295 test ax, FLG_ROMVARS_MODULE_HOTKEYS | FLG_ROMVARS_MODULE_BOOT_MENU
[459]296 jmp SHORT .DisableMenuitemFromCSBXifZFset
[290]297
298
299;--------------------------------------------------------------------
[592]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;--------------------------------------------------------------------
[459]317; .EnableOrDisableBootMenuSelectionTimeout
[403]318; Parameters:
[580]319; AX: ROMVARS.wFlags
[403]320; SS:BP: Menu handle
321; Returns:
322; Nothing
323; Corrupts registers:
[580]324; BX
[403]325;--------------------------------------------------------------------
[459]326ALIGN JUMP_ALIGN
327.EnableOrDisableBootMenuSelectionTimeout:
328 mov bx, g_MenuitemBootMnuStngsSelectionTimeout
329 test ax, FLG_ROMVARS_MODULE_BOOT_MENU
[597]330 jmp SHORT .DisableMenuitemFromCSBXifZFset
331
332
333;--------------------------------------------------------------------
334; .EnableOrDisableClearBdaDriveCount
335; Parameters:
336; AX: ROMVARS.wFlags
337; SS:BP: Menu handle
338; Returns:
339; Nothing
340; Corrupts registers:
341; BX
342;--------------------------------------------------------------------
343ALIGN JUMP_ALIGN
344.EnableOrDisableClearBdaDriveCount:
345 mov bx, g_MenuitemBootMnuStngsClearBdaDriveCount
346 call Buffers_IsXTbuildLoaded
[459]347.DisableMenuitemFromCSBXifZFset:
348 jz SHORT .DisableMenuitemFromCSBX
349 ; Fall to .EnableMenuitemFromCSBX
[403]350
[459]351
352;--------------------------------------------------------------------
353; .EnableMenuitemFromCSBX
354; .DisableMenuitemFromCSBX
355; Parameters:
356; CS:BX: Ptr to MENUITEM
357; Returns:
358; Nothing
359; Corrupts registers:
360; Nothing
361;--------------------------------------------------------------------
362ALIGN JUMP_ALIGN
363.EnableMenuitemFromCSBX:
[567]364 jmp EnableMenuitemFromCSBX
[403]365
[459]366ALIGN JUMP_ALIGN
367.DisableMenuitemFromCSBX:
[567]368 jmp DisableMenuitemFromCSBX
[403]369
370
371;--------------------------------------------------------------------
[592]372; ReadColorTheme
[290]373; Parameters:
[592]374; AX: Value read from the ROMVARS location
375; ES:DI: ROMVARS location where the value was just read from
376; DS:SI: MENUITEM pointer
[290]377; Returns:
[592]378; AX: Value that the MENUITEM system will interact with and display
[290]379; Corrupts registers:
[592]380; BX, DI, ES
381;--------------------------------------------------------------------
382ALIGN JUMP_ALIGN
383ReadColorTheme:
384 push ds
385
386 push es ; ES -> DS
387 pop ds
388 push cs ; CS -> ES
389 pop es
390
391 mov di, EndOfColorThemeTable-1 ; ES:DI now points to the end of the last theme in the table of available themes in XTIDECFG
392 xor bx, bx
393
394 push si
395 push cx
396 mov cx, CountOfThemes
397 std
398.NextTheme:
399 push cx
400 mov cl, ATTRIBUTE_CHARS_size
401 mov si, ax ; [ROMVARS.pColorTheme] to SI
402 dec si
403 add si, cx ; DS:SI now points to the end of the ColorTheme in the loaded BIOS
404 sub di, bx ; Update the pointer to the end of the next theme in the table
405
406 ; We verify that the theme in the loaded BIOS exists in our table. If it doesn't exist then that most likely means
407 ; the loaded BIOS doesn't contain MODULE_BOOT_MENU and the theme actually isn't a theme - it's code. Either way,
408 ; we don't trust it enough to copy it over as corrupt/invalid settings could render the UI in XTIDECFG unreadable.
409 repe cmpsb
410 mov bx, cx
411 pop cx
412 loopne .NextTheme
413 cld
414 mov ax, cx
415 jne SHORT .SkipCopy
416
417 ; Copy the color theme fron the loaded BIOS overwriting XTIDECFG's own theme
418 inc si
419 mov di, ColorTheme ; ES:DI now points to ColorTheme in XTIDECFG
420
421 mov cl, ATTRIBUTE_CHARS_size
422 call Memory_CopyCXbytesFromDSSItoESDI
423
424.SkipCopy:
425 pop cx
426 pop si
427 pop ds
428 ret
429
430
431;--------------------------------------------------------------------
432; WriteColorTheme
433; Parameters:
434; AX: Value that the MENUITEM system was interacting with
435; ES:DI: ROMVARS location where the value is to be stored
436; DS:SI: MENUITEM pointer
437; Returns:
438; AX: Value to actually write to ROMVARS
439; Corrupts registers:
[290]440; Nothing
441;--------------------------------------------------------------------
442ALIGN JUMP_ALIGN
[592]443WriteColorTheme:
444 push cx
445 push si
446 push di
447
448 mov cx, ATTRIBUTE_CHARS_size
449 mul cl ; Multiply with the menu choice index
450 mov si, ColorThemeTable
451 add si, ax
452 mov ax, [es:di] ; Fetch the ptr to ColorTheme
453 mov di, ax
454
455 call Memory_CopyCXbytesFromDSSItoESDI
456
457 pop di
458 pop si
459 pop cx
[290]460 ret
[592]461
Note: See TracBrowser for help on using the repository browser.