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

Last change on this file since 369 was 369, checked in by gregli@…, 13 years ago

Removed align directives for initalization code and added define for align in boot-time calls to the assembly library (defaulting to 1), resulting in a significant savings for the AT and 386 builds. Fixed a bug with switch command line handling in the serial server. Put in CR characters in licesnse.txt, so that it properly displays on Windows. In the configurator, added default values for user supplied CHS and LBA values, defaulting to values within range when those features are enabled. Updated the copyright message in the configurator as the literal word Copyright is important.

File size: 3.7 KB
Line 
1; Project name : Assembly Library
2; Description : Finds suitable character attribute for
3; color, B/W and monochrome displays.
4
5; Struct containing border characters for different types of menu window lines
6struc ATTRIBUTE_CHARS
7 .cBordersAndBackground resb 1
8 .cShadow resb 1
9 .cTitle:
10 .cInformation resb 1
11 .cItem resb 1
12 .cHighlightedItem resb 1
13 .cHurryTimeout resb 1
14 .cNormalTimeout resb 1
15endstruc
16
17
18; Section containing code
19SECTION .text
20
21;--------------------------------------------------------------------
22; MenuAttribute_SetToDisplayContextFromTypeInSI
23; Parameters
24; SI: Attribute type (from ATTRIBUTE_CHARS)
25; Returns:
26; Nothing
27; Corrupts registers:
28; AX, SI, DI
29;--------------------------------------------------------------------
30ALIGN MENU_JUMP_ALIGN
31MenuAttribute_SetToDisplayContextFromTypeInSI:
32 call MenuAttribute_GetToAXfromTypeInSI
33 CALL_DISPLAY_LIBRARY SetCharacterAttributeFromAL
34 ret
35
36
37;--------------------------------------------------------------------
38; MenuAttribute_GetToAXfromTypeInSI
39; Parameters
40; SI: Attribute type (from ATTRIBUTE_CHARS)
41; Returns:
42; AX: Wanted attribute
43; Corrupts registers:
44; SI
45;--------------------------------------------------------------------
46ALIGN MENU_JUMP_ALIGN
47MenuAttribute_GetToAXfromTypeInSI:
48 push ds
49
50 LOAD_BDA_SEGMENT_TO ds, ax, !
51 mov al, [VIDEO_BDA.bMode] ; Load BIOS display mode (0, 1, 2, 3 or 7)
52 cmp al, 7
53 je SHORT .LoadMonoAttribute
54 test al, 1 ; Even modes (0 and 2) are B/W
55 jnz SHORT .LoadColorAttribute
56
57.LoadBlackAndWhiteAttribute:
58 add si, .rgcBlackAndWhiteAttributes
59 jmp SHORT .LoadAttributeAndReturn
60
61ALIGN MENU_JUMP_ALIGN
62.LoadMonoAttribute:
63 add si, .rgcMonochromeAttributes
64 jmp SHORT .LoadAttributeAndReturn
65
66ALIGN MENU_JUMP_ALIGN
67.LoadColorAttribute:
68 add si, .rgcColorAttributes
69.LoadAttributeAndReturn:
70 cs lodsb ; Load from [CS:SI] to AL
71
72 pop ds
73 ret
74
75
76.rgcColorAttributes:
77istruc ATTRIBUTE_CHARS
78 at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE)
79 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
80 at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLUE)
81 at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLUE)
82 at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_CYAN)
83 at ATTRIBUTE_CHARS.cHurryTimeout, db COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLUE) | FLG_COLOR_BLINK
84 at ATTRIBUTE_CHARS.cNormalTimeout, db COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE)
85iend
86
87.rgcBlackAndWhiteAttributes: ; Only COLOR_WHITE, COLOR_BRIGHT_WHITE and COLOR_BLACK should be used
88istruc ATTRIBUTE_CHARS
89 at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
90 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
91 at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
92 at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)
93 at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_WHITE)
94 at ATTRIBUTE_CHARS.cHurryTimeout, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) | FLG_COLOR_BLINK
95 at ATTRIBUTE_CHARS.cNormalTimeout, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)
96iend
97
98.rgcMonochromeAttributes:
99istruc ATTRIBUTE_CHARS
100 at ATTRIBUTE_CHARS.cBordersAndBackground, db MONO_BRIGHT
101 at ATTRIBUTE_CHARS.cShadow, db MONO_REVERSE_DARK
102 at ATTRIBUTE_CHARS.cTitle, db MONO_BRIGHT
103 at ATTRIBUTE_CHARS.cItem, db MONO_NORMAL
104 at ATTRIBUTE_CHARS.cHighlightedItem, db MONO_REVERSE
105 at ATTRIBUTE_CHARS.cHurryTimeout, db MONO_BRIGHT_BLINK
106 at ATTRIBUTE_CHARS.cNormalTimeout, db MONO_NORMAL
107iend
Note: See TracBrowser for help on using the repository browser.