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