[41] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Functions for display output.
|
---|
| 3 |
|
---|
[376] | 4 | ;
|
---|
[491] | 5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
[526] | 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
|
---|
[376] | 7 | ;
|
---|
| 8 | ; This program is free software; you can redistribute it and/or modify
|
---|
| 9 | ; it under the terms of the GNU General Public License as published by
|
---|
| 10 | ; the Free Software Foundation; either version 2 of the License, or
|
---|
| 11 | ; (at your option) any later version.
|
---|
[491] | 12 | ;
|
---|
[376] | 13 | ; This program is distributed in the hope that it will be useful,
|
---|
| 14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
[491] | 16 | ; GNU General Public License for more details.
|
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
[491] | 18 | ;
|
---|
[376] | 19 |
|
---|
[41] | 20 | ; Section containing code
|
---|
| 21 | SECTION .text
|
---|
| 22 |
|
---|
[376] | 23 |
|
---|
[41] | 24 | ;--------------------------------------------------------------------
|
---|
| 25 | ; Supports following formatting types:
|
---|
| 26 | ; %a Specifies attribute for next character
|
---|
| 27 | ; %A Specifies attribute for remaining string (or until next %A)
|
---|
| 28 | ; %d Prints signed 16-bit decimal integer
|
---|
| 29 | ; %u Prints unsigned 16-bit decimal integer
|
---|
| 30 | ; %x Prints 16-bit hexadecimal integer
|
---|
| 31 | ; %s Prints string (from CS segment)
|
---|
| 32 | ; %S Prints string (far pointer)
|
---|
| 33 | ; %c Prints character
|
---|
| 34 | ; %t Prints character number of times (character needs to be pushed first, then repeat times)
|
---|
| 35 | ; %% Prints '%' character (no parameter pushed)
|
---|
| 36 | ;
|
---|
| 37 | ; Any placeholder can be set to minimum length by specifying
|
---|
| 38 | ; minimum number of characters. For example %8d would append spaces
|
---|
| 39 | ; after integer so that at least 8 characters would be printed.
|
---|
[48] | 40 | ;
|
---|
| 41 | ; When placing '-' after number, then spaces will be used for prepending.
|
---|
| 42 | ; For example %8-d would prepend integer with spaces so that at least
|
---|
| 43 | ; 8 characters would be printed.
|
---|
[162] | 44 | ;
|
---|
[41] | 45 | ; DisplayPrint_FormattedNullTerminatedStringFromCSSI
|
---|
| 46 | ; Parameters:
|
---|
| 47 | ; BP: SP before pushing parameters
|
---|
| 48 | ; DS: BDA segment (zero)
|
---|
| 49 | ; CS:SI: Pointer to string to format
|
---|
| 50 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 51 | ; Stack: Parameters for formatting placeholders.
|
---|
| 52 | ; Parameter for first placeholder must be pushed first.
|
---|
| 53 | ; Low word must pushed first for placeholders requiring
|
---|
| 54 | ; 32-bit parameters (two words).
|
---|
| 55 | ; Returns:
|
---|
| 56 | ; DI: Updated offset to video RAM
|
---|
| 57 | ; Corrupts registers:
|
---|
| 58 | ; AX, DX
|
---|
| 59 | ;--------------------------------------------------------------------
|
---|
[369] | 60 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 61 | DisplayPrint_FormattedNullTerminatedStringFromCSSI:
|
---|
| 62 | push bp
|
---|
| 63 | push si
|
---|
| 64 | push cx
|
---|
| 65 | push bx
|
---|
| 66 | push WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute]
|
---|
| 67 |
|
---|
| 68 | dec bp ; Point BP to...
|
---|
| 69 | dec bp ; ...first stack parameter
|
---|
| 70 | call DisplayFormat_ParseCharacters
|
---|
| 71 |
|
---|
| 72 | ; Pop original character attribute
|
---|
| 73 | pop ax
|
---|
| 74 | mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute], al
|
---|
| 75 |
|
---|
| 76 | pop bx
|
---|
| 77 | pop cx
|
---|
| 78 | pop si
|
---|
| 79 | pop bp
|
---|
[376] | 80 |
|
---|
[41] | 81 | ret
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | ;--------------------------------------------------------------------
|
---|
[44] | 85 | ; DisplayPrint_SignedWordFromAXWithBaseInBX
|
---|
[41] | 86 | ; Parameters:
|
---|
| 87 | ; AX: Word to display
|
---|
[44] | 88 | ; BX: Integer base (binary=2, octal=8, decimal=10, hexadecimal=16)
|
---|
[41] | 89 | ; DS: BDA segment (zero)
|
---|
| 90 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 91 | ; Returns:
|
---|
| 92 | ; DI: Updated offset to video RAM
|
---|
| 93 | ; Corrupts registers:
|
---|
| 94 | ; AX, DX
|
---|
| 95 | ;--------------------------------------------------------------------
|
---|
[134] | 96 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
[369] | 97 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[44] | 98 | DisplayPrint_SignedWordFromAXWithBaseInBX:
|
---|
| 99 | test ax, ax
|
---|
| 100 | jns SHORT DisplayPrint_WordFromAXWithBaseInBX
|
---|
[41] | 101 |
|
---|
| 102 | push ax
|
---|
| 103 | mov al, '-'
|
---|
| 104 | call DisplayPrint_CharacterFromAL
|
---|
| 105 | pop ax
|
---|
| 106 | neg ax
|
---|
[44] | 107 | ; Fall to DisplayPrint_WordFromAXWithBaseInBX
|
---|
[134] | 108 | %endif
|
---|
[41] | 109 |
|
---|
[376] | 110 |
|
---|
[41] | 111 | ;--------------------------------------------------------------------
|
---|
| 112 | ; DisplayPrint_WordFromAXWithBaseInBX
|
---|
| 113 | ; Parameters:
|
---|
| 114 | ; AX: Word to display
|
---|
| 115 | ; BX: Integer base (binary=2, octal=8, decimal=10, hexadecimal=16)
|
---|
| 116 | ; DS: BDA segment (zero)
|
---|
| 117 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 118 | ; Returns:
|
---|
| 119 | ; DI: Updated offset to video RAM
|
---|
| 120 | ; Corrupts registers:
|
---|
| 121 | ; AX, DX
|
---|
[376] | 122 | ;--------------------------------------------------------------------
|
---|
[491] | 123 | %ifndef MODULE_STRINGS_COMPRESSED
|
---|
[369] | 124 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 125 | DisplayPrint_WordFromAXWithBaseInBX:
|
---|
| 126 | push cx
|
---|
| 127 |
|
---|
| 128 | xor cx, cx
|
---|
[369] | 129 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 130 | .DivideLoop:
|
---|
[580] | 131 | inc cx ; Increment character count
|
---|
[41] | 132 | xor dx, dx ; DX:AX now holds the integer
|
---|
| 133 | div bx ; Divide DX:AX by base
|
---|
| 134 | push dx ; Push remainder
|
---|
| 135 | test ax, ax ; All divided?
|
---|
| 136 | jnz SHORT .DivideLoop ; If not, loop
|
---|
[44] | 137 |
|
---|
[580] | 138 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[532] | 139 | PrintAllPushedDigits: ; Unused entrypoint OK
|
---|
[44] | 140 | .PrintNextDigit:
|
---|
| 141 | pop ax ; Pop digit
|
---|
[580] | 142 | cmp al, 10 ; Convert binary digit in AL to ASCII hex digit ('0'-'9' or 'A'-'F')
|
---|
| 143 | sbb al, 69h
|
---|
| 144 | das
|
---|
[41] | 145 | call DisplayPrint_CharacterFromAL
|
---|
[44] | 146 | loop .PrintNextDigit
|
---|
[41] | 147 |
|
---|
| 148 | pop cx
|
---|
| 149 | ret
|
---|
[580] | 150 | %endif ; ~MODULE_STRINGS_COMPRESSED
|
---|
[341] | 151 |
|
---|
| 152 | ;--------------------------------------------------------------------
|
---|
| 153 | ; DisplayPrint_QWordFromSSBPwithBaseInBX
|
---|
| 154 | ; Parameters:
|
---|
| 155 | ; SS:BP: QWord to display
|
---|
| 156 | ; BX: Integer base (binary=2, octal=8, decimal=10, hexadecimal=16)
|
---|
| 157 | ; DS: BDA segment (zero)
|
---|
| 158 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 159 | ; Returns:
|
---|
| 160 | ; DI: Updated offset to video RAM
|
---|
| 161 | ; Corrupts registers:
|
---|
| 162 | ; AX, DX, [SS:BP]
|
---|
| 163 | ;--------------------------------------------------------------------
|
---|
[491] | 164 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS OR EXCLUDE_FROM_XTIDECFG
|
---|
[369] | 165 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[341] | 166 | DisplayPrint_QWordFromSSBPwithBaseInBX:
|
---|
| 167 | push cx
|
---|
| 168 |
|
---|
| 169 | mov cx, bx ; CX = Integer base
|
---|
| 170 | xor bx, bx ; BX = Character count
|
---|
[369] | 171 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[341] | 172 | .DivideLoop:
|
---|
| 173 | call Math_DivQWatSSBPbyCX; Divide by base
|
---|
| 174 | push dx ; Push remainder
|
---|
| 175 | inc bx ; Increment character count
|
---|
| 176 | cmp WORD [bp], BYTE 0 ; All divided?
|
---|
| 177 | jne SHORT .DivideLoop ; If not, loop
|
---|
[580] | 178 | xchg cx, bx ; Character count to CX, Integer base to BX
|
---|
[341] | 179 | jmp SHORT PrintAllPushedDigits
|
---|
[491] | 180 | %endif
|
---|
[41] | 181 |
|
---|
| 182 |
|
---|
| 183 | ;--------------------------------------------------------------------
|
---|
| 184 | ; DisplayPrint_CharacterBufferFromBXSIwithLengthInCX
|
---|
| 185 | ; Parameters:
|
---|
| 186 | ; CX: Buffer length (characters)
|
---|
| 187 | ; BX:SI: Ptr to NULL terminated string
|
---|
| 188 | ; DS: BDA segment (zero)
|
---|
| 189 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 190 | ; Returns:
|
---|
| 191 | ; DI: Updated offset to video RAM
|
---|
| 192 | ; Corrupts registers:
|
---|
| 193 | ; AX, DX
|
---|
| 194 | ;--------------------------------------------------------------------
|
---|
[223] | 195 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
[369] | 196 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 197 | DisplayPrint_CharacterBufferFromBXSIwithLengthInCX:
|
---|
[44] | 198 | jcxz .NothingToPrintSinceZeroLength
|
---|
| 199 | push si
|
---|
[41] | 200 | push cx
|
---|
| 201 |
|
---|
[369] | 202 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[44] | 203 | .PrintNextCharacter:
|
---|
| 204 | mov ds, bx
|
---|
| 205 | lodsb
|
---|
| 206 | LOAD_BDA_SEGMENT_TO ds, dx
|
---|
| 207 | call DisplayPrint_CharacterFromAL
|
---|
| 208 | loop .PrintNextCharacter
|
---|
| 209 |
|
---|
[41] | 210 | pop cx
|
---|
[44] | 211 | pop si
|
---|
| 212 | .NothingToPrintSinceZeroLength:
|
---|
[41] | 213 | ret
|
---|
[376] | 214 | %endif
|
---|
[41] | 215 |
|
---|
[376] | 216 |
|
---|
[41] | 217 | ;--------------------------------------------------------------------
|
---|
[67] | 218 | ; DisplayPrint_ClearScreenWithCharInALandAttributeInAH
|
---|
[41] | 219 | ; Parameters:
|
---|
[67] | 220 | ; AL: Character to clear with
|
---|
| 221 | ; AH: Attribute to clear with
|
---|
[41] | 222 | ; DS: BDA segment (zero)
|
---|
| 223 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 224 | ; Returns:
|
---|
| 225 | ; Nothing
|
---|
| 226 | ; Corrupts registers:
|
---|
| 227 | ; AX, DX
|
---|
| 228 | ;--------------------------------------------------------------------
|
---|
[491] | 229 | %ifdef INCLUDE_MENU_LIBRARY
|
---|
[369] | 230 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[67] | 231 | DisplayPrint_ClearScreenWithCharInALandAttributeInAH:
|
---|
[41] | 232 | push di
|
---|
[67] | 233 | push cx
|
---|
| 234 |
|
---|
| 235 | xchg cx, ax
|
---|
[41] | 236 | xor ax, ax
|
---|
[67] | 237 | call DisplayCursor_SetCoordinatesFromAX ; Updates DI
|
---|
[41] | 238 | call DisplayPage_GetColumnsToALandRowsToAH
|
---|
[67] | 239 | mul ah ; AX = AL*AH = Characters on screen
|
---|
| 240 | xchg cx, ax ; AX = Char+Attr, CX = WORDs to store
|
---|
| 241 | rep stosw
|
---|
| 242 |
|
---|
| 243 | pop cx
|
---|
[41] | 244 | pop di
|
---|
| 245 | mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition], di
|
---|
| 246 | ret
|
---|
[489] | 247 | %endif
|
---|
[491] | 248 |
|
---|
| 249 |
|
---|
[41] | 250 | ;--------------------------------------------------------------------
|
---|
| 251 | ; DisplayPrint_ClearAreaWithHeightInAHandWidthInAL
|
---|
| 252 | ; Parameters:
|
---|
| 253 | ; AH: Area height
|
---|
| 254 | ; AL: Area width
|
---|
| 255 | ; DS: BDA segment (zero)
|
---|
| 256 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 257 | ; Returns:
|
---|
[42] | 258 | ; DI: Updated offset to video RAM
|
---|
[41] | 259 | ; Corrupts registers:
|
---|
| 260 | ; AX, DX
|
---|
| 261 | ;--------------------------------------------------------------------
|
---|
[134] | 262 | %ifndef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
[369] | 263 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 264 | DisplayPrint_ClearAreaWithHeightInAHandWidthInAL:
|
---|
[42] | 265 | push si
|
---|
[41] | 266 | push cx
|
---|
| 267 | push bx
|
---|
| 268 |
|
---|
[42] | 269 | xchg bx, ax ; Area size to BX
|
---|
[41] | 270 | call DisplayCursor_GetSoftwareCoordinatesToAX
|
---|
[42] | 271 | xchg si, ax ; Software (Y,X) coordinates now in SI
|
---|
| 272 | xor cx, cx
|
---|
[41] | 273 |
|
---|
[369] | 274 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[42] | 275 | .ClearRowLoop:
|
---|
| 276 | mov cl, bl ; Area width now in CX
|
---|
[44] | 277 | mov al, SCREEN_BACKGROUND_CHARACTER
|
---|
[42] | 278 | call DisplayPrint_RepeatCharacterFromALwithCountInCX
|
---|
[41] | 279 |
|
---|
[42] | 280 | xchg ax, si ; Coordinates to AX
|
---|
| 281 | inc ah ; Increment row
|
---|
| 282 | mov si, ax
|
---|
[41] | 283 | call DisplayCursor_SetCoordinatesFromAX
|
---|
[42] | 284 | dec bh ; Decrement rows left
|
---|
| 285 | jnz SHORT .ClearRowLoop
|
---|
[41] | 286 |
|
---|
| 287 | pop bx
|
---|
| 288 | pop cx
|
---|
[42] | 289 | pop si
|
---|
[41] | 290 | ret
|
---|
[134] | 291 | %endif
|
---|
[42] | 292 |
|
---|
[492] | 293 | %ifdef EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS
|
---|
| 294 | %define EXCLUDE
|
---|
[532] | 295 | %ifndef MODULE_STRINGS_COMPRESSED
|
---|
| 296 | %undef EXCLUDE
|
---|
| 297 | %endif
|
---|
[492] | 298 | %ifdef MODULE_HOTKEYS
|
---|
| 299 | %undef EXCLUDE
|
---|
| 300 | %endif
|
---|
| 301 | %ifdef MODULE_BOOT_MENU
|
---|
| 302 | %undef EXCLUDE
|
---|
| 303 | %endif
|
---|
| 304 | %endif
|
---|
[42] | 305 |
|
---|
[505] | 306 | %ifndef EXCLUDE
|
---|
[42] | 307 | ;--------------------------------------------------------------------
|
---|
| 308 | ; DisplayPrint_RepeatCharacterFromALwithCountInCX
|
---|
| 309 | ; Parameters:
|
---|
| 310 | ; AL: Character to display
|
---|
| 311 | ; CX: Repeat count
|
---|
| 312 | ; DS: BDA segment (zero)
|
---|
| 313 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 314 | ; Returns:
|
---|
| 315 | ; DI: Updated offset to video RAM
|
---|
| 316 | ; Corrupts registers:
|
---|
[181] | 317 | ; DX
|
---|
[42] | 318 | ;--------------------------------------------------------------------
|
---|
[369] | 319 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[42] | 320 | DisplayPrint_RepeatCharacterFromALwithCountInCX:
|
---|
[44] | 321 | jcxz .NothingToRepeat
|
---|
| 322 | push cx
|
---|
| 323 |
|
---|
[369] | 324 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[44] | 325 | .RepeatCharacter:
|
---|
[42] | 326 | push ax
|
---|
| 327 | call DisplayPrint_CharacterFromAL
|
---|
| 328 | pop ax
|
---|
[44] | 329 | loop .RepeatCharacter
|
---|
| 330 |
|
---|
| 331 | pop cx
|
---|
| 332 | .NothingToRepeat:
|
---|
[42] | 333 | ret
|
---|
[492] | 334 | %endif
|
---|
| 335 | %undef EXCLUDE
|
---|
[223] | 336 |
|
---|
[186] | 337 | ;--------------------------------------------------------------------
|
---|
| 338 | ; DisplayPrint_NullTerminatedStringFromCSSI
|
---|
| 339 | ; Parameters:
|
---|
| 340 | ; CS:SI: Ptr to NULL terminated string
|
---|
| 341 | ; DS: BDA segment (zero)
|
---|
| 342 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 343 | ; Returns:
|
---|
| 344 | ; DI: Updated offset to video RAM
|
---|
| 345 | ; Corrupts registers:
|
---|
| 346 | ; AX, DX
|
---|
| 347 | ;--------------------------------------------------------------------
|
---|
[376] | 348 | %ifndef MODULE_STRINGS_COMPRESSED
|
---|
| 349 | ;;;
|
---|
| 350 | ;;; Take care when using this routine with compressed strings (which is why it is disabled).
|
---|
| 351 | ;;; All strings in CSSI should go through the DisplayFormatCompressed code to be decoded.
|
---|
| 352 | ;;;
|
---|
[369] | 353 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[186] | 354 | DisplayPrint_NullTerminatedStringFromCSSI:
|
---|
| 355 | push bx
|
---|
| 356 | mov bx, cs
|
---|
| 357 | call DisplayPrint_NullTerminatedStringFromBXSI
|
---|
| 358 | pop bx
|
---|
| 359 | ret
|
---|
[376] | 360 | %endif
|
---|
[42] | 361 |
|
---|
| 362 |
|
---|
[376] | 363 | ;;;
|
---|
| 364 | ;;; Note that the following routines need to be at the bottom of this file
|
---|
| 365 | ;;; to accomodate short jumps from the next file (DisplayFormat/DisplayFormatCompressed)
|
---|
| 366 | ;;;
|
---|
| 367 |
|
---|
[42] | 368 | ;--------------------------------------------------------------------
|
---|
[44] | 369 | ; DisplayPrint_Newline
|
---|
| 370 | ; Parameters:
|
---|
| 371 | ; DS: BDA segment (zero)
|
---|
| 372 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 373 | ; Returns:
|
---|
| 374 | ; DI: Updated offset to video RAM
|
---|
| 375 | ; Corrupts registers:
|
---|
| 376 | ; AX, DX
|
---|
| 377 | ;--------------------------------------------------------------------
|
---|
[376] | 378 | %ifdef MODULE_STRINGS_COMPRESSED
|
---|
[369] | 379 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[376] | 380 | DisplayPrint_Newline_FormatAdjustBP:
|
---|
| 381 | inc bp ; we didn't need a parameter after all, readjust BP
|
---|
| 382 | inc bp
|
---|
| 383 | ; fall through to DisplayPrint_Newline
|
---|
| 384 | %endif
|
---|
| 385 |
|
---|
[369] | 386 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[44] | 387 | DisplayPrint_Newline:
|
---|
[52] | 388 | mov al, LF
|
---|
| 389 | call DisplayPrint_CharacterFromAL
|
---|
[44] | 390 | mov al, CR
|
---|
| 391 | ; Fall to DisplayPrint_CharacterFromAL
|
---|
| 392 |
|
---|
| 393 | ;--------------------------------------------------------------------
|
---|
[42] | 394 | ; DisplayPrint_CharacterFromAL
|
---|
| 395 | ; Parameters:
|
---|
| 396 | ; AL: Character to display
|
---|
[567] | 397 | ; Zero value is ignored (no character is printed)
|
---|
[42] | 398 | ; DS: BDA segment (zero)
|
---|
| 399 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 400 | ; Returns:
|
---|
| 401 | ; DI: Updated offset to video RAM
|
---|
| 402 | ; Corrupts registers:
|
---|
| 403 | ; AX, DX
|
---|
| 404 | ;--------------------------------------------------------------------
|
---|
[369] | 405 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[42] | 406 | DisplayPrint_CharacterFromAL:
|
---|
[505] | 407 | test al, al
|
---|
[376] | 408 | jz DisplayPrint_Ret
|
---|
| 409 |
|
---|
[42] | 410 | mov ah, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute]
|
---|
| 411 | jmp [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut]
|
---|
[223] | 412 |
|
---|
[376] | 413 |
|
---|
[186] | 414 | ;--------------------------------------------------------------------
|
---|
| 415 | ; DisplayPrint_NullTerminatedStringFromBXSI
|
---|
| 416 | ; Parameters:
|
---|
| 417 | ; DS: BDA segment (zero)
|
---|
| 418 | ; BX:SI: Ptr to NULL terminated string
|
---|
| 419 | ; ES:DI: Ptr to cursor location in video RAM
|
---|
| 420 | ; Returns:
|
---|
| 421 | ; DI: Updated offset to video RAM
|
---|
| 422 | ; Corrupts registers:
|
---|
| 423 | ; AX, DX
|
---|
| 424 | ;--------------------------------------------------------------------
|
---|
[369] | 425 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[186] | 426 | DisplayPrint_NullTerminatedStringFromBXSI:
|
---|
| 427 | push si
|
---|
| 428 | push cx
|
---|
| 429 |
|
---|
| 430 | xor cx, cx
|
---|
[369] | 431 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[186] | 432 | .PrintNextCharacter:
|
---|
| 433 | mov ds, bx ; String segment to DS
|
---|
| 434 | lodsb
|
---|
| 435 | mov ds, cx ; BDA segment to DS
|
---|
| 436 | test al, al ; NULL?
|
---|
| 437 | jz SHORT .EndOfString
|
---|
| 438 | call DisplayPrint_CharacterFromAL
|
---|
| 439 | jmp SHORT .PrintNextCharacter
|
---|
| 440 |
|
---|
[369] | 441 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[186] | 442 | .EndOfString:
|
---|
| 443 | pop cx
|
---|
| 444 | pop si
|
---|
[376] | 445 |
|
---|
| 446 | DisplayPrint_Ret: ; random ret to jump to
|
---|
[186] | 447 | ret
|
---|
| 448 |
|
---|