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

Last change on this file since 112 was 104, checked in by Tomi Tilli, 14 years ago

Changes to Assembly Library:

  • Some more optimizations.
  • Moved macros.inc from XTIDE Universal BIOS to Assembly Library.
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 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 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 JUMP_ALIGN
62.LoadMonoAttribute:
63 add si, .rgcMonochromeAttributes
64 jmp SHORT .LoadAttributeAndReturn
65
66ALIGN JUMP_ALIGN
67.LoadColorAttribute:
68 add si, .rgcColorAttributes
69.LoadAttributeAndReturn:
70 eSEG cs
71 lodsb ; Load from [CS:SI] to AL
72
73 pop ds
74 ret
75
76
77
78.rgcColorAttributes:
79istruc ATTRIBUTE_CHARS
80 at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE)
81 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
82 at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLUE)
83 at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLUE)
84 at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_CYAN)
85 at ATTRIBUTE_CHARS.cHurryTimeout, db COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLUE) | FLG_COLOR_BLINK
86 at ATTRIBUTE_CHARS.cNormalTimeout, db COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE)
87iend
88
89.rgcBlackAndWhiteAttributes: ; Only COLOR_WHITE, COLOR_BRIGHT_WHITE and COLOR_BLACK should be used
90istruc ATTRIBUTE_CHARS
91 at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
92 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
93 at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
94 at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)
95 at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_WHITE)
96 at ATTRIBUTE_CHARS.cHurryTimeout, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) | FLG_COLOR_BLINK
97 at ATTRIBUTE_CHARS.cNormalTimeout, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)
98iend
99
100.rgcMonochromeAttributes:
101istruc ATTRIBUTE_CHARS
102 at ATTRIBUTE_CHARS.cBordersAndBackground, db MONO_BRIGHT
103 at ATTRIBUTE_CHARS.cShadow, db MONO_REVERSE_DARK
104 at ATTRIBUTE_CHARS.cTitle, db MONO_BRIGHT
105 at ATTRIBUTE_CHARS.cItem, db MONO_NORMAL
106 at ATTRIBUTE_CHARS.cHighlightedItem, db MONO_REVERSE
107 at ATTRIBUTE_CHARS.cHurryTimeout, db MONO_BRIGHT_BLINK
108 at ATTRIBUTE_CHARS.cNormalTimeout, db MONO_NORMAL
109iend
Note: See TracBrowser for help on using the repository browser.