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

Last change on this file since 276 was 186, checked in by gregli@…, 13 years ago

Initial string compression checkin. All changes are under MODULE_STRINGS_COMPRESSED, and this can still be turned off. With this checkin, the serial and ebios code can both be turned on at the same time and still we remain below the 8K boundary (barely). I still need to chekin StringsCompress.pl after some more code cleanup. The output, in StringsCompressed.asm is checked in here, and should continue be to checkin when Strings.asm is changed, for those who do not have/want to run the Perl script to recreate it.

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