[41] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Functions for outputting characters to video memory.
|
---|
| 3 | ; These functions are meant to be called by Display_CharacterFromAL
|
---|
| 4 | ; and Display_RepeatCharacterFromAL using function pointer
|
---|
| 5 | ; stored in DISPLAY_CONTEXT.
|
---|
| 6 |
|
---|
[376] | 7 | ;
|
---|
| 8 | ; XTIDE Universal BIOS and Associated Tools
|
---|
| 9 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
|
---|
| 10 | ;
|
---|
| 11 | ; This program is free software; you can redistribute it and/or modify
|
---|
| 12 | ; it under the terms of the GNU General Public License as published by
|
---|
| 13 | ; the Free Software Foundation; either version 2 of the License, or
|
---|
| 14 | ; (at your option) any later version.
|
---|
| 15 | ;
|
---|
| 16 | ; This program is distributed in the hope that it will be useful,
|
---|
| 17 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | ; GNU General Public License for more details.
|
---|
| 20 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
| 21 | ;
|
---|
| 22 |
|
---|
[41] | 23 | ; Section containing code
|
---|
| 24 | SECTION .text
|
---|
| 25 |
|
---|
| 26 | ;--------------------------------------------------------------------
|
---|
| 27 | ; DisplayCharOut_TeletypeOutputWithAttribute
|
---|
| 28 | ; DisplayCharOut_TeletypeOutput
|
---|
| 29 | ; Parameters:
|
---|
| 30 | ; AL: Character to output
|
---|
| 31 | ; AH: Attribute to output
|
---|
| 32 | ; DS: BDA segment (zero)
|
---|
| 33 | ; ES:DI: Ptr to video memory where to output
|
---|
| 34 | ; Returns:
|
---|
| 35 | ; DI: Incremented for next character
|
---|
| 36 | ; Corrupts registers:
|
---|
| 37 | ; AX, DX
|
---|
| 38 | ;--------------------------------------------------------------------
|
---|
[369] | 39 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 40 | DisplayCharOut_TeletypeOutputWithAttribute:
|
---|
| 41 | cmp al, ' ' ; Printable character?
|
---|
| 42 | jb SHORT DisplayCharOut_BiosTeletypeOutput
|
---|
[42] | 43 | WAIT_RETRACE_IF_NECESSARY_THEN stosw
|
---|
[41] | 44 | ret
|
---|
| 45 |
|
---|
[369] | 46 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 47 | DisplayCharOut_TeletypeOutput:
|
---|
| 48 | cmp al, ' ' ; Printable character?
|
---|
| 49 | jae SHORT DisplayCharOut_Character
|
---|
| 50 | ; Fall to DisplayCharOut_BiosTeletypeOutput
|
---|
| 51 |
|
---|
| 52 | ;--------------------------------------------------------------------
|
---|
| 53 | ; DisplayCharOut_BiosTeletypeOutput
|
---|
| 54 | ; Parameters:
|
---|
| 55 | ; AL: Control character
|
---|
| 56 | ; DS: BDA segment (zero)
|
---|
| 57 | ; ES:DI: Ptr to video memory where to output
|
---|
| 58 | ; Returns:
|
---|
| 59 | ; DI: Incremented for next character
|
---|
| 60 | ; Corrupts registers:
|
---|
| 61 | ; AX, DX
|
---|
| 62 | ;--------------------------------------------------------------------
|
---|
[369] | 63 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 64 | DisplayCharOut_BiosTeletypeOutput:
|
---|
| 65 | push ax
|
---|
| 66 | call DisplayCursor_SynchronizeCoordinatesToHardware
|
---|
| 67 | pop ax
|
---|
| 68 |
|
---|
[101] | 69 | ; Output character with BIOS
|
---|
[41] | 70 | push bx
|
---|
| 71 | mov ah, TELETYPE_OUTPUT
|
---|
| 72 | mov bh, [VIDEO_BDA.bActivePage]
|
---|
| 73 | int BIOS_VIDEO_INTERRUPT_10h
|
---|
| 74 | pop bx
|
---|
| 75 |
|
---|
[101] | 76 | call DisplayCursor_GetHardwareCoordinatesToAX
|
---|
| 77 | jmp DisplayCursor_SetCoordinatesFromAX
|
---|
[41] | 78 |
|
---|
[101] | 79 |
|
---|
[41] | 80 | ;--------------------------------------------------------------------
|
---|
| 81 | ; DisplayCharOut_Attribute
|
---|
| 82 | ; DisplayCharOut_Character
|
---|
| 83 | ; DisplayCharOut_CharacterWithAttribute
|
---|
| 84 | ; Parameters:
|
---|
| 85 | ; AL: Character to output
|
---|
| 86 | ; AH: Attribute to output
|
---|
[42] | 87 | ; DS: BDA segment (zero)
|
---|
[41] | 88 | ; ES:DI: Ptr to video memory where to output
|
---|
| 89 | ; Returns:
|
---|
| 90 | ; DI: Incremented for next character
|
---|
| 91 | ; Corrupts registers:
|
---|
[42] | 92 | ; AX, DX
|
---|
[41] | 93 | ;--------------------------------------------------------------------
|
---|
[369] | 94 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 95 | DisplayCharOut_Attribute:
|
---|
| 96 | xchg al, ah ; Swap character and attribute
|
---|
| 97 | inc di ; Skip character
|
---|
[42] | 98 | WAIT_RETRACE_IF_NECESSARY_THEN stosb
|
---|
[41] | 99 | ret
|
---|
| 100 |
|
---|
[369] | 101 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 102 | DisplayCharOut_Character:
|
---|
[42] | 103 | WAIT_RETRACE_IF_NECESSARY_THEN stosb
|
---|
[41] | 104 | inc di ; Skip attribute
|
---|
| 105 | ret
|
---|
| 106 |
|
---|
[369] | 107 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 108 | DisplayCharOut_CharacterWithAttribute:
|
---|
[42] | 109 | WAIT_RETRACE_IF_NECESSARY_THEN stosw
|
---|
[41] | 110 | ret
|
---|
| 111 |
|
---|
| 112 |
|
---|
| 113 | ;--------------------------------------------------------------------
|
---|
| 114 | ; DisplayCharOut_WriteCharacterToBuffer
|
---|
| 115 | ; Parameters:
|
---|
| 116 | ; AL: Character to output
|
---|
| 117 | ; DS: BDA segment (zero)
|
---|
| 118 | ; ES:DI: Ptr to destination string buffer
|
---|
[55] | 119 | ; DISPLAY_CONTEXT.wCharOutParam: Characters left in buffer
|
---|
[41] | 120 | ; Returns:
|
---|
| 121 | ; ES:DI: Updated for next character
|
---|
| 122 | ; Corrupts registers:
|
---|
| 123 | ; AX, DX
|
---|
| 124 | ;--------------------------------------------------------------------
|
---|
[369] | 125 | ALIGN DISPLAY_JUMP_ALIGN
|
---|
[41] | 126 | DisplayCharOut_WriteCharacterToBuffer:
|
---|
[55] | 127 | cmp WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam], BYTE 0
|
---|
| 128 | je SHORT .BufferFull
|
---|
[41] | 129 | stosb
|
---|
[55] | 130 | dec WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
|
---|
[41] | 131 | .BufferFull:
|
---|
| 132 | ret
|
---|