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

Last change on this file since 318 was 223, checked in by krille_n_@…, 13 years ago

Changes:

  • Fixed what appears to be a mistake in EBIOS.inc
  • Added a 'release' option to the makefile of the Serial Server (invokes UPX)
  • Some very minor optimizations
  • Removed the eSEG macro and did some other cleanups (fixed typos etc)
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 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.