source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/MenuAttributes.asm@ 593

Last change on this file since 593 was 592, checked in by Krister Nordvall, 6 years ago

Changes:

  • The problem with NASM in the previous revision (r591) has been fixed.
  • The colors used by the boot menu and hotkey bar can now be customized by selecting one of a number of pre-defined color themes. Suggestions for additional themes are more than welcome!
  • Large builds are now 10 KB. Small builds are still 8 KB with the exception of the Tiny build which is now 4 KB. In other words, builds are now as small as possible to make it easier to combine them with other BIOSes.
  • Added code to the library to improve drive error handling. XTIDECFG can now handle "Drive Not Ready" errors.
  • Fixed a couple of potential bugs in AtaID.asm (AtaID_GetMaxPioModeToAXandMinCycleTimeToCX); 1) ATA1.bPioMode was treated as a WORD variable. 2) ATA2.bPIOSupp was assumed to be non-zero which would result in PIO mode 3 being returned if the assumption was wrong.
  • Made the same changes in the equivalent function used by BIOSDRVS (DisplayPioModeInformationUsingAtaInfoFromDSBX in AtaInfo.asm).
  • Fixed a bug from r587 in PDC20x30.asm in PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX.
  • Fixed a bug from r523 in XTIDECFG where Auto Configure would only set the IRQ on one IDE interface on AT-builds.
  • XTIDECFG will now restore the default settings for the "Serial port virtual device" when reselecting it in the list of device types. This makes it behave consistently for all device types.
  • The eAAM macro is now used regardless if USE_UNDOC_INTEL is defined or not because it is apparently supported on all processors including the NEC V20/V30 CPUs.
  • Renamed the EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS define to EXCLUDE_FROM_XUB.
  • Added a define to exclude unused library code from BIOSDRVS (EXCLUDE_FROM_BIOSDRVS). This makes it a lot smaller than in previous revisions.
  • All unnecessary CLD-instructions are now under a new define 'CLD_NEEDED' which is only enabled for the BIOS. It is disabled for XTIDECFG and BIOSDRVS but can be enabled if needed by adding this define to the respective makefile. This change was made because these unnecessary instructions are wasteful and should never be needed. In fact, they only serve to hide bugs (in other peoples code) which I strongly believe should be avoided. I recommend people making their own BIOSes from source to not use this define as it's extremely unlikely to be needed.
  • Updated the copyright info in SerDrive and changed an URL to point to the new site.
  • Updated the copyright info and version number in BIOSDRVS.
  • Updated the copyright info in XTIDECFG.
  • Optimizations in general.
File size: 4.5 KB
Line 
1; Project name : Assembly Library
2; Description : Finds suitable character attribute for
3; color, B/W and monochrome displays.
4
5;
6; XTIDE Universal BIOS and Associated Tools
7; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
8;
9; This program is free software; you can redistribute it and/or modify
10; it under the terms of the GNU General Public License as published by
11; the Free Software Foundation; either version 2 of the License, or
12; (at your option) any later version.
13;
14; This program is distributed in the hope that it will be useful,
15; but WITHOUT ANY WARRANTY; without even the implied warranty of
16; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17; GNU General Public License for more details.
18; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19;
20
21
22; Struct containing border characters for different types of menu window lines
23struc ATTRIBUTE_CHARS
24 .cBordersAndBackground resb 1
25 .cShadow resb 1
26 .cTitle:
27 .cInformation resb 1
28 .cItem resb 1
29 .cHighlightedItem resb 1
30 .cHurryTimeout resb 1
31 .cNormalTimeout resb 1
32endstruc
33
34
35; Section containing code
36SECTION .text
37
38;--------------------------------------------------------------------
39; MenuAttribute_SetToDisplayContextFromTypeInSI
40; Parameters
41; SI: Attribute type (from ATTRIBUTE_CHARS)
42; Returns:
43; Nothing
44; Corrupts registers:
45; AX, SI, DI
46;--------------------------------------------------------------------
47ALIGN MENU_JUMP_ALIGN
48MenuAttribute_SetToDisplayContextFromTypeInSI:
49 call MenuAttribute_GetToAXfromTypeInSI
50 JMP_DISPLAY_LIBRARY SetCharacterAttributeFromAL
51
52
53;--------------------------------------------------------------------
54; MenuAttribute_GetToAXfromTypeInSI
55; Parameters
56; SI: Attribute type (from ATTRIBUTE_CHARS)
57; Returns:
58; AX: Wanted attribute
59; Corrupts registers:
60; SI
61;--------------------------------------------------------------------
62ALIGN MENU_JUMP_ALIGN
63MenuAttribute_GetToAXfromTypeInSI:
64 push ds
65
66 LOAD_BDA_SEGMENT_TO ds, ax, !
67 mov al, [VIDEO_BDA.bMode] ; Load BIOS display mode (0, 1, 2, 3 or 7)
68 cmp al, 7
69 je SHORT .LoadMonoAttribute
70 test al, 1 ; Even modes (0 and 2) are B/W
71 jnz SHORT .LoadColorAttribute
72
73.LoadBlackAndWhiteAttribute:
74 add si, .rgcBlackAndWhiteAttributes
75 jmp SHORT .LoadAttributeAndReturn
76
77ALIGN MENU_JUMP_ALIGN
78.LoadMonoAttribute:
79 add si, .rgcMonochromeAttributes
80 jmp SHORT .LoadAttributeAndReturn
81
82ALIGN MENU_JUMP_ALIGN
83.LoadColorAttribute:
84 add si, .rgcColorAttributes
85.LoadAttributeAndReturn:
86 cs lodsb ; Load from [CS:SI] to AL
87
88 pop ds
89 ret
90
91
92.rgcColorAttributes:
93; Classic (default theme)
94istruc ATTRIBUTE_CHARS
95 at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE)
96 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
97 at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLUE)
98 at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLUE)
99 at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_CYAN)
100 at ATTRIBUTE_CHARS.cHurryTimeout, db COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLUE) | FLG_COLOR_BLINK
101 at ATTRIBUTE_CHARS.cNormalTimeout, db COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE)
102iend
103ColorTheme equ MenuAttribute_GetToAXfromTypeInSI.rgcColorAttributes
104
105.rgcBlackAndWhiteAttributes: ; Only COLOR_WHITE, COLOR_BRIGHT_WHITE and COLOR_BLACK should be used
106istruc ATTRIBUTE_CHARS
107 at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
108 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
109 at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
110 at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)
111 at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_WHITE)
112 at ATTRIBUTE_CHARS.cHurryTimeout, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) | FLG_COLOR_BLINK
113 at ATTRIBUTE_CHARS.cNormalTimeout, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)
114iend
115
116.rgcMonochromeAttributes:
117istruc ATTRIBUTE_CHARS
118 at ATTRIBUTE_CHARS.cBordersAndBackground, db MONO_BRIGHT
119 at ATTRIBUTE_CHARS.cShadow, db MONO_REVERSE_DARK
120 at ATTRIBUTE_CHARS.cTitle, db MONO_BRIGHT
121 at ATTRIBUTE_CHARS.cItem, db MONO_NORMAL
122 at ATTRIBUTE_CHARS.cHighlightedItem, db MONO_REVERSE
123 at ATTRIBUTE_CHARS.cHurryTimeout, db MONO_BRIGHT_BLINK
124 at ATTRIBUTE_CHARS.cNormalTimeout, db MONO_NORMAL
125iend
Note: See TracBrowser for help on using the repository browser.