[41] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Finds suitable character attribute for
|
---|
| 3 | ; color, B/W and monochrome displays.
|
---|
| 4 |
|
---|
[376] | 5 | ;
|
---|
| 6 | ; XTIDE Universal BIOS and Associated Tools
|
---|
| 7 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
|
---|
| 8 | ;
|
---|
| 9 | ; This program is free software; you can redistribute it and/or modify
|
---|
| 10 | ; it under the terms of the GNU General Public License as published by
|
---|
| 11 | ; the Free Software Foundation; either version 2 of the License, or
|
---|
| 12 | ; (at your option) any later version.
|
---|
| 13 | ;
|
---|
| 14 | ; This program is distributed in the hope that it will be useful,
|
---|
| 15 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 16 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 17 | ; GNU General Public License for more details.
|
---|
| 18 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
| 19 | ;
|
---|
| 20 |
|
---|
| 21 |
|
---|
[41] | 22 | ; Struct containing border characters for different types of menu window lines
|
---|
| 23 | struc ATTRIBUTE_CHARS
|
---|
| 24 | .cBordersAndBackground resb 1
|
---|
| 25 | .cShadow resb 1
|
---|
| 26 | .cTitle:
|
---|
| 27 | .cInformation resb 1
|
---|
| 28 | .cItem resb 1
|
---|
| 29 | .cHighlightedItem resb 1
|
---|
| 30 | .cHurryTimeout resb 1
|
---|
| 31 | .cNormalTimeout resb 1
|
---|
| 32 | endstruc
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | ; Section containing code
|
---|
| 36 | SECTION .text
|
---|
| 37 |
|
---|
| 38 | ;--------------------------------------------------------------------
|
---|
[52] | 39 | ; MenuAttribute_SetToDisplayContextFromTypeInSI
|
---|
[41] | 40 | ; Parameters
|
---|
| 41 | ; SI: Attribute type (from ATTRIBUTE_CHARS)
|
---|
| 42 | ; Returns:
|
---|
| 43 | ; Nothing
|
---|
| 44 | ; Corrupts registers:
|
---|
| 45 | ; AX, SI, DI
|
---|
| 46 | ;--------------------------------------------------------------------
|
---|
[369] | 47 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 48 | MenuAttribute_SetToDisplayContextFromTypeInSI:
|
---|
| 49 | call MenuAttribute_GetToAXfromTypeInSI
|
---|
| 50 | CALL_DISPLAY_LIBRARY SetCharacterAttributeFromAL
|
---|
| 51 | ret
|
---|
| 52 |
|
---|
| 53 |
|
---|
| 54 | ;--------------------------------------------------------------------
|
---|
| 55 | ; MenuAttribute_GetToAXfromTypeInSI
|
---|
| 56 | ; Parameters
|
---|
| 57 | ; SI: Attribute type (from ATTRIBUTE_CHARS)
|
---|
| 58 | ; Returns:
|
---|
| 59 | ; AX: Wanted attribute
|
---|
| 60 | ; Corrupts registers:
|
---|
| 61 | ; SI
|
---|
| 62 | ;--------------------------------------------------------------------
|
---|
[369] | 63 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 64 | MenuAttribute_GetToAXfromTypeInSI:
|
---|
| 65 | push ds
|
---|
| 66 |
|
---|
[116] | 67 | LOAD_BDA_SEGMENT_TO ds, ax, !
|
---|
[41] | 68 | mov al, [VIDEO_BDA.bMode] ; Load BIOS display mode (0, 1, 2, 3 or 7)
|
---|
| 69 | cmp al, 7
|
---|
| 70 | je SHORT .LoadMonoAttribute
|
---|
| 71 | test al, 1 ; Even modes (0 and 2) are B/W
|
---|
| 72 | jnz SHORT .LoadColorAttribute
|
---|
| 73 |
|
---|
| 74 | .LoadBlackAndWhiteAttribute:
|
---|
| 75 | add si, .rgcBlackAndWhiteAttributes
|
---|
| 76 | jmp SHORT .LoadAttributeAndReturn
|
---|
| 77 |
|
---|
[369] | 78 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 79 | .LoadMonoAttribute:
|
---|
| 80 | add si, .rgcMonochromeAttributes
|
---|
| 81 | jmp SHORT .LoadAttributeAndReturn
|
---|
| 82 |
|
---|
[369] | 83 | ALIGN MENU_JUMP_ALIGN
|
---|
[41] | 84 | .LoadColorAttribute:
|
---|
| 85 | add si, .rgcColorAttributes
|
---|
| 86 | .LoadAttributeAndReturn:
|
---|
[223] | 87 | cs lodsb ; Load from [CS:SI] to AL
|
---|
[41] | 88 |
|
---|
| 89 | pop ds
|
---|
| 90 | ret
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 | .rgcColorAttributes:
|
---|
| 94 | istruc ATTRIBUTE_CHARS
|
---|
| 95 | at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_YELLOW, COLOR_BLUE)
|
---|
| 96 | at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
|
---|
| 97 | at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLUE)
|
---|
| 98 | at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLUE)
|
---|
| 99 | at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_CYAN)
|
---|
| 100 | at ATTRIBUTE_CHARS.cHurryTimeout, db COLOR_ATTRIBUTE(COLOR_RED, COLOR_BLUE) | FLG_COLOR_BLINK
|
---|
| 101 | at ATTRIBUTE_CHARS.cNormalTimeout, db COLOR_ATTRIBUTE(COLOR_GREEN, COLOR_BLUE)
|
---|
| 102 | iend
|
---|
| 103 |
|
---|
| 104 | .rgcBlackAndWhiteAttributes: ; Only COLOR_WHITE, COLOR_BRIGHT_WHITE and COLOR_BLACK should be used
|
---|
| 105 | istruc ATTRIBUTE_CHARS
|
---|
| 106 | at ATTRIBUTE_CHARS.cBordersAndBackground, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
|
---|
[46] | 107 | at ATTRIBUTE_CHARS.cShadow, db COLOR_ATTRIBUTE(COLOR_GRAY, COLOR_BLACK)
|
---|
[41] | 108 | at ATTRIBUTE_CHARS.cTitle, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK)
|
---|
| 109 | at ATTRIBUTE_CHARS.cItem, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)
|
---|
[47] | 110 | at ATTRIBUTE_CHARS.cHighlightedItem, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_WHITE)
|
---|
[41] | 111 | at ATTRIBUTE_CHARS.cHurryTimeout, db COLOR_ATTRIBUTE(COLOR_BRIGHT_WHITE, COLOR_BLACK) | FLG_COLOR_BLINK
|
---|
| 112 | at ATTRIBUTE_CHARS.cNormalTimeout, db COLOR_ATTRIBUTE(COLOR_WHITE, COLOR_BLACK)
|
---|
| 113 | iend
|
---|
| 114 |
|
---|
| 115 | .rgcMonochromeAttributes:
|
---|
| 116 | istruc ATTRIBUTE_CHARS
|
---|
| 117 | at ATTRIBUTE_CHARS.cBordersAndBackground, db MONO_BRIGHT
|
---|
| 118 | at ATTRIBUTE_CHARS.cShadow, db MONO_REVERSE_DARK
|
---|
| 119 | at ATTRIBUTE_CHARS.cTitle, db MONO_BRIGHT
|
---|
| 120 | at ATTRIBUTE_CHARS.cItem, db MONO_NORMAL
|
---|
| 121 | at ATTRIBUTE_CHARS.cHighlightedItem, db MONO_REVERSE
|
---|
| 122 | at ATTRIBUTE_CHARS.cHurryTimeout, db MONO_BRIGHT_BLINK
|
---|
| 123 | at ATTRIBUTE_CHARS.cNormalTimeout, db MONO_NORMAL
|
---|
| 124 | iend
|
---|