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

Last change on this file since 180 was 116, checked in by krille_n_@…, 14 years ago

Changes to all parts of the project:

  • Removed a redundant macro (HPIO_NORMALIZE_PTR)
  • Deleted XTIDE_Universal_BIOS/Inc/BiosData.inc since that was also redundant.
  • Size optimization: Changed the LOAD_BDA_SEGMENT_TO macro to use the stack on 186+ processors (the old behaviour can still be used where needed).
  • Made other minor size optimizations and cleanups to various functions, mostly in the Int13h handler.
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;--------------------------------------------------------------------
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
[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
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.rgcColorAttributes:
78istruc ATTRIBUTE_CHARS
79 at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE)
80 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
81 at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLUE)
82 at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLUE)
83 at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_CYAN)
84 at ATTRIBUTE_CHARS.cHurryTimeout, db COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLUE) | FLG_COLOR_BLINK
85 at ATTRIBUTE_CHARS.cNormalTimeout, db COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE)
86iend
87
88.rgcBlackAndWhiteAttributes: ; Only COLOR_WHITE, COLOR_BRIGHT_WHITE and COLOR_BLACK should be used
89istruc ATTRIBUTE_CHARS
90 at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
[46]91 at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
[41]92 at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
93 at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)
[47]94 at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_WHITE)
[41]95 at ATTRIBUTE_CHARS.cHurryTimeout, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) | FLG_COLOR_BLINK
96 at ATTRIBUTE_CHARS.cNormalTimeout, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)
97iend
98
99.rgcMonochromeAttributes:
100istruc ATTRIBUTE_CHARS
101 at ATTRIBUTE_CHARS.cBordersAndBackground, db MONO_BRIGHT
102 at ATTRIBUTE_CHARS.cShadow, db MONO_REVERSE_DARK
103 at ATTRIBUTE_CHARS.cTitle, db MONO_BRIGHT
104 at ATTRIBUTE_CHARS.cItem, db MONO_NORMAL
105 at ATTRIBUTE_CHARS.cHighlightedItem, db MONO_REVERSE
106 at ATTRIBUTE_CHARS.cHurryTimeout, db MONO_BRIGHT_BLINK
107 at ATTRIBUTE_CHARS.cNormalTimeout, db MONO_NORMAL
108iend
Note: See TracBrowser for help on using the repository browser.