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

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

Initial commit for Assembly Library.

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