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

Last change on this file since 374 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
RevLine 
[41]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;--------------------------------------------------------------------
[52]22; MenuAttribute_SetToDisplayContextFromTypeInSI
[41]23; Parameters
24; SI: Attribute type (from ATTRIBUTE_CHARS)
25; Returns:
26; Nothing
27; Corrupts registers:
28; AX, SI, DI
29;--------------------------------------------------------------------
[369]30ALIGN MENU_JUMP_ALIGN
[41]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;--------------------------------------------------------------------
[369]46ALIGN MENU_JUMP_ALIGN
[41]47MenuAttribute_GetToAXfromTypeInSI:
48 push ds
49
[116]50 LOAD_BDA_SEGMENT_TO ds, ax, !
[41]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
[369]61ALIGN MENU_JUMP_ALIGN
[41]62.LoadMonoAttribute:
63 add si, .rgcMonochromeAttributes
64 jmp SHORT .LoadAttributeAndReturn
65
[369]66ALIGN MENU_JUMP_ALIGN
[41]67.LoadColorAttribute:
68 add si, .rgcColorAttributes
69.LoadAttributeAndReturn:
[223]70 cs lodsb ; Load from [CS:SI] to AL
[41]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)
[46]90 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
[41]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)
[47]93 at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_WHITE)
[41]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.