source: xtideuniversalbios/trunk/Assembly_Library/Src/Display/DisplayCharOut.asm@ 537

Last change on this file since 537 was 526, checked in by krille_n_@…, 12 years ago

Changes:

  • Update of the copyright notices to include the year 2013.
File size: 4.1 KB
Line 
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
7;
8; XTIDE Universal BIOS and Associated Tools
9; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 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
23; Section containing code
24SECTION .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;--------------------------------------------------------------------
39ALIGN DISPLAY_JUMP_ALIGN
40DisplayCharOut_TeletypeOutputWithAttribute:
41 cmp al, ' ' ; Printable character?
42 jb SHORT DisplayCharOut_BiosTeletypeOutput
43 WAIT_RETRACE_IF_NECESSARY_THEN stosw
44 ret
45
46ALIGN DISPLAY_JUMP_ALIGN
47DisplayCharOut_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;--------------------------------------------------------------------
63ALIGN DISPLAY_JUMP_ALIGN
64DisplayCharOut_BiosTeletypeOutput:
65 push ax
66 call DisplayCursor_SynchronizeCoordinatesToHardware
67 pop ax
68
69 ; Output character with BIOS
70 push bx
71 mov ah, TELETYPE_OUTPUT
72 mov bh, [VIDEO_BDA.bActivePage]
73 int BIOS_VIDEO_INTERRUPT_10h
74 pop bx
75
76 call DisplayCursor_GetHardwareCoordinatesToAX
77 jmp DisplayCursor_SetCoordinatesFromAX
78
79
80;--------------------------------------------------------------------
81; DisplayCharOut_Attribute
82; DisplayCharOut_Character
83; DisplayCharOut_CharacterWithAttribute
84; Parameters:
85; AL: Character to output
86; AH: Attribute to output
87; DS: BDA segment (zero)
88; ES:DI: Ptr to video memory where to output
89; Returns:
90; DI: Incremented for next character
91; Corrupts registers:
92; AX, DX
93;--------------------------------------------------------------------
94ALIGN DISPLAY_JUMP_ALIGN
95DisplayCharOut_Attribute:
96 xchg al, ah ; Swap character and attribute
97 inc di ; Skip character
98 WAIT_RETRACE_IF_NECESSARY_THEN stosb
99 ret
100
101ALIGN DISPLAY_JUMP_ALIGN
102DisplayCharOut_Character:
103 WAIT_RETRACE_IF_NECESSARY_THEN stosb
104 inc di ; Skip attribute
105 ret
106
107ALIGN DISPLAY_JUMP_ALIGN
108DisplayCharOut_CharacterWithAttribute:
109 WAIT_RETRACE_IF_NECESSARY_THEN stosw
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
119; DISPLAY_CONTEXT.wCharOutParam: Characters left in buffer
120; Returns:
121; ES:DI: Updated for next character
122; Corrupts registers:
123; AX, DX
124;--------------------------------------------------------------------
125ALIGN DISPLAY_JUMP_ALIGN
126DisplayCharOut_WriteCharacterToBuffer:
127 cmp WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam], BYTE 0
128 je SHORT .BufferFull
129 stosb
130 dec WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
131.BufferFull:
132 ret
Note: See TracBrowser for help on using the repository browser.