source: xtideuniversalbios/trunk/Assembly_Library/Inc/Display.inc@ 364

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

Changes:

  • Fixed a bug from r323 in DisplayPrint.asm.
  • Removed some unused code from XTIDECFG (undoing the change to Math.asm in r336 as part of it).
File size: 9.2 KB
Line 
1; Project name : AssemblyLibrary
2; Description : Defines for display library.
3%ifndef DISPLAY_INC
4%define DISPLAY_INC
5
6%ifndef MODULE_STRINGS_COMPRESSED_PRECOMPRESS
7;--------------------------------------------------------------------
8; Display Library users need to use this macro since it will provide
9; compatibility with future library versions.
10;
11; CALL_DISPLAY_LIBRARY
12; Parameters:
13; %1: Function to call (functionName from DISPLAY_LIB)
14; Registers: Depends on function to call
15; Returns:
16; Depends on function to call
17; Corrupts registers:
18; AX (unless used as a return register), DI
19;--------------------------------------------------------------------
20%macro CALL_DISPLAY_LIBRARY 1
21 %ifidn %1, PushDisplayContext
22 call DisplayContext_Push
23 %elifidn %1, PopDisplayContext
24 call DisplayContext_Pop
25 %elifidn %1, PrepareOffScreenBufferInESBXwithLengthInCX
26 call DisplayContext_PrepareOffScreenBufferInESBXwithLengthInCX
27 %else
28 mov di, %1
29 call Display_FunctionFromDI
30 %endif
31%endmacro
32
33%if 0
34;;;
35;;; struc no longer needed with direct calls to functions
36;;;
37
38; Display library functions
39struc DISPLAY_LIB
40 .PushDisplayContext:
41 .PopDisplayContext:
42 .InitializeDisplayContext resb 2
43
44%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
45 .SetCharacterPointerFromBXAX resb 2
46%endif
47 .SetCharOutputFunctionFromAXwithAttribFlagInBL resb 2
48 .SetCharacterOutputParameterFromAX resb 2
49 .SetCharacterAttributeFromAL resb 2
50 .SetCursorShapeFromAX resb 2
51 .SetCursorCoordinatesFromAX resb 2
52 .SetNewPageFromAL resb 2
53 .SynchronizeDisplayContextToHardware resb 2
54
55%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
56 .GetCharacterPointerToBXAX resb 2
57%endif
58 .GetSoftwareCoordinatesToAX resb 2
59 .GetColumnsToALandRowsToAH resb 2
60
61 .FormatNullTerminatedStringFromCSSI resb 2
62%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
63 .PrintSignedWordFromAXWithBaseInBX resb 2
64%endif
65 .PrintWordFromAXwithBaseInBX resb 2
66%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
67 .PrintQWordFromSSBPwithBaseInBX resb 2
68%endif
69 .PrintCharBufferFromBXSIwithLengthInCX resb 2
70 .PrintNullTerminatedStringFromBXSI resb 2
71 .PrintNullTerminatedStringFromCSSI resb 2
72 .PrintRepeatedCharacterFromALwithCountInCX resb 2
73 .PrintCharacterFromAL resb 2
74 .PrintNewlineCharacters resb 2
75%ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
76 .ClearAreaWithHeightInAHandWidthInAL resb 2
77%endif
78 .ClearScreenWithCharInALandAttrInAH resb 2
79endstruc
80%endif
81
82; Attribute flags for DISPLAY_LIB.SetCharacterOutputFunctionFromAXwithAttributeFlagInDL
83ATTRIBUTES_NOT_USED EQU 0
84ATTRIBUTES_ARE_USED EQU FLG_CONTEXT_ATTRIBUTES
85
86; Character output functions for DISPLAY_LIB.SetCharacterOutputFunctionFromAXwithAttributeFlagInDL
87TELETYPE_OUTPUT_WITH_ATTRIBUTE EQU DisplayCharOut_TeletypeOutputWithAttribute
88TELETYPE_OUTPUT_WITHOUT_ATTRIBUTE EQU DisplayCharOut_TeletypeOutput
89TELETYPE_OUTPUT_USING_BIOS EQU DisplayCharOut_BiosTeletypeOutput
90FAST_OUTPUT_WITH_ATTRIBUTE_ONLY EQU DisplayCharOut_Attribute
91FAST_OUTPUT_WITH_CHAR_ONLY EQU DisplayCharOut_Character
92FAST_OUTPUT_WITH_CHAR_AND_ATTRIBUTE EQU DisplayCharOut_CharacterWithAttribute
93BUFFER_OUTPUT_WITH_CHAR_ONLY EQU DisplayCharOut_WriteCharacterToBuffer
94
95DEFAULT_CHARACTER_OUTPUT EQU TELETYPE_OUTPUT_WITH_ATTRIBUTE
96
97
98struc VIDEO_BDA
99 resb 449h
100 .bMode resb 1 ; 0:449h, Video, Mode
101 .wColumns resb 2 ; 0:44Ah, Video, Number of columns
102 .wBytesPerPage resb 2 ; 0:44Ch, Video, Total number of bytes per page
103 .wPageOffset resb 2 ; 0:44Eh, Video, Current page offset
104 .rgwCursors resb 4 ; 0:450h, Video, Cursor position, pages 0...1
105 .displayContext resb 12 ; Our own display context (normally cursors for pages 2...7)
106 .wCursorShape resb 2 ; 0:460h, Video, Cursor shape
107 .bActivePage resb 1 ; 0:462h, Video, Active display page
108 .wVideoPort resb 2 ; 0:463h, Video, I/O Port number base
109 .bInternalModeReg resb 1 ; 0:465h, Video, Internal mode register
110 .bColorPalette resb 1 ; 0:466h, Video, Color palette
111endstruc
112
113struc DISPLAY_CONTEXT
114 .fpCursorPosition resb 4 ; Far pointer to cursor position in video memory
115 .fnCharOut resb 2 ; Function to draw character with
116 .wCharOutParam resb 2 ; User parameter for custom character output function
117 .wCursorShape resb 2 ; Current cursor shape
118 .bAttribute resb 1 ; Selected character attribute
119 .bFlags resb 1 ; Display context flags
120endstruc
121
122; Display context flags
123FLG_CONTEXT_ATTRIBUTES EQU (1<<0) ; Character output function uses attributes
124FLG_CONTEXT_CGA EQU (1<<1) ; CGA detected so prevent CGA snow
125
126
127; Text mode character attribute byte bits for CGA+ (color adapters)
128FLG_COLOR_FORE_BLUE EQU (1<<0)
129FLG_COLOR_FORE_GREEN EQU (1<<1)
130FLG_COLOR_FORE_RED EQU (1<<2)
131FLG_COLOR_FORE_INTENSITY EQU (1<<3)
132FLG_COLOR_FORE_FONT_B EQU (1<<3) ; Select font set B (if available, EGA+)
133FLG_COLOR_BACK_BLUE EQU (1<<4)
134FLG_COLOR_BACK_GREEN EQU (1<<5)
135FLG_COLOR_BACK_RED EQU (1<<6)
136FLG_COLOR_BACK_INTENSITY EQU (1<<7) ; Intensity when blinking is disabled
137FLG_COLOR_BLINK EQU (1<<7) ; Blinking color when enabled (enabled by default)
138
139; CGA colors
140%define COLOR_ATTRIBUTE(foreground, background) ( (foreground) | ((background)<<4) )
141COLOR_BLACK EQU 0
142COLOR_BLUE EQU 1
143COLOR_GREEN EQU 2
144COLOR_CYAN EQU 3
145COLOR_RED EQU 4
146COLOR_MAGENTA EQU 5
147COLOR_BROWN EQU 6
148COLOR_WHITE EQU 7 ; Last background color if blinking enabled
149COLOR_GRAY EQU 8
150COLOR_LIGHT_BLUE EQU 9
151COLOR_LIGHT_GREEN EQU 10
152COLOR_LIGHT_CYAN EQU 11
153COLOR_LIGHT_RED EQU 12
154COLOR_LIGHT_MAGENTA EQU 13
155COLOR_YELLOW EQU 14
156COLOR_BRIGHT_WHITE EQU 15
157
158
159; Text mode character attribute byte bits for MDA (monochrome adapters)
160; (attributes 00h, 08h, 80h, 88h, 70h, 78h, F0h and F8h are exceptions)
161FLG_MONO_UNDERLINE EQU (1<<1)
162FLG_MONO_INTENSITY EQU (1<<3)
163FLG_MONO_BLINK EQU (1<<7)
164
165; Text mode character attribute bytes for MDA/Hercules (monochrome adapters)
166; *Not displayed on some monitors
167MONO_HIDDEN EQU 00h ; Not displayed (same for 08h, 80h and 88h)
168MONO_UNDERLINE EQU 01h ; Underlined
169MONO_NORMAL EQU 07h ; Normal (white on black)
170MONO_BRIGHT_UNDERLINE EQU 09h ; High intensity, underlined
171MONO_BRIGHT EQU 0Fh ; High intensity
172MONO_REVERSE EQU 70h ; Reverse video (black on white)
173MONO_REVERSE_DARK EQU 78h ; (dark green on green)
174MONO_BLINK EQU 87h ; Blinking white on black*
175MONO_BRIGHT_BLINK EQU 8Fh ; Blinking high intensity*
176MONO_REVERSE_BLINK EQU 0F0h ; Blinking reverse video
177MONO_REVERSE_DARK_BLINK EQU 0F8h ; (blinking dark green on green)
178
179
180; Cursor position macro for DX register
181%define CURSOR_XY(x, y) ( (x) | ((y)<<8) )
182
183; Cursor shapes
184CURSOR_NORMAL EQU 0607h ; Two line cursor near or at the bottom of cell (not valid for IBM MDA)
185CURSOR_HIDDEN EQU 2000h
186
187
188; Display modes
189CGA_TEXT_MODE_BW40 EQU 0 ; Applications should use...
190CGA_TEXT_MODE_CO40 EQU 1
191CGA_TEXT_MODE_BW80 EQU 2 ; ..black, white and bright white attributes only
192CGA_TEXT_MODE_CO80 EQU 3
193MDA_TEXT_MODE EQU 7 ; Real monochrome attributes available
194
195
196; Display segments
197COLOR_TEXT_SEGMENT EQU 0B800h ; Text modes 0...3 (CGA+)
198MONO_TEXT_SEGMENT EQU 0B000h ; Text mode 7 (MDA, Hercules)
199
200OFFSET_TO_CGA_STATUS_REGISTER EQU 6 ; Base port 3D4h + 6 = 3DAh
201CGA_STATUS_REGISTER EQU 3DAh
202
203%endif ; MODULE_STRINGS_COMPRESS_PRECOMPRESS
204
205; Control characters for teletype output
206NULL EQU 00h
207SOH EQU 01h ; Start of heading
208STX EQU 02h ; Start of text
209BELL EQU 07h ; Bell
210BS EQU 08h ; Backspace
211TAB EQU 09h ; Horizontal TAB
212LF EQU 0Ah ; Line feed (newline)
213CR EQU 0Dh ; Carriage return
214ESC EQU 1Bh ; Escape
215
216; Non ASCII characters (code page 437)
217BETA EQU 225
218QUOTATION_MARK EQU 34
219DOUBLE_TOP_RIGHT_CORNER EQU 187
220DOUBLE_TOP_LEFT_CORNER EQU 201
221DOUBLE_BOTTOM_RIGHT_CORNER EQU 188
222DOUBLE_BOTTOM_LEFT_CORNER EQU 200
223DOUBLE_VERTICAL EQU 186
224DOUBLE_HORIZONTAL EQU 205
225DOUBLE_VERTICAL_TO_RIGHT_SINGLE EQU 199
226DOUBLE_VERTICAL_TO_LEFT_SINGLE EQU 182
227DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL EQU 181
228DOUBLE_RIGHT_HORIZONTAL_TO_SINGLE_VERTICAL EQU 198
229SINGLE_VERTICAL EQU 179
230SINGLE_HORIZONTAL EQU 196
231SINGLE_LEFT_HORIZONTAL_TO_VERTICAL EQU 180
232SINGLE_RIGHT_HORIZONTAL_TO_VERTICAL EQU 195
233ANGLE_QUOTE_LEFT EQU 174
234ANGLE_QUOTE_RIGHT EQU 175
235BLOCK_MOSTLY_BACKGROUND EQU 176
236BLOCK_EVEN_BACKGROUND_AND_FOREGROUND EQU 177
237BLOCK_MOSTLY_FOREGROUND EQU 178
238BLOCK_FULL_FOREGROUND EQU 219
239ONE_HALF EQU 171
240ONE_QUARTER EQU 172
241
242
243; Background character for clearing screen
244%ifndef SCREEN_BACKGROUND_CHARACTER
245 %define SCREEN_BACKGROUND_CHARACTER BLOCK_MOSTLY_BACKGROUND
246%endif
247%ifndef SCREEN_BACKGROUND_ATTRIBUTE
248 %define SCREEN_BACKGROUND_ATTRIBUTE MONO_NORMAL
249%endif
250%define SCREEN_BACKGROUND_CHARACTER_AND_ATTRIBUTE (SCREEN_BACKGROUND_CHARACTER | (SCREEN_BACKGROUND_ATTRIBUTE<<8))
251%define DOS_BACKGROUND_CHARACTER_AND_ATTRIBUTE (' ' | (MONO_NORMAL<<8))
252
253%endif ; DISPLAY_INC
Note: See TracBrowser for help on using the repository browser.