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

Last change on this file since 51 was 48, checked in by Tomi Tilli, 14 years ago

Changes to Assembly Library:
Added functions to clear Menu Title and Information areas.
Implemented automatic line change when writing Menu Title and Information areas.
CGA snow related functions have been moved to CgaSnow.asm.
Keyboard input functions no longer produce beep for backspace.

File size: 3.8 KB
RevLine 
[41]1; File name : DisplayCharOut.asm
2; Project name : Assembly Library
3; Created date : 26.6.2010
[48]4; Last update : 8.10.2010
[41]5; Author : Tomi Tilli
6; Description : Functions for outputting characters to video memory.
7; These functions are meant to be called by Display_CharacterFromAL
8; and Display_RepeatCharacterFromAL using function pointer
9; stored in DISPLAY_CONTEXT.
10
11; Section containing code
12SECTION .text
13
14;--------------------------------------------------------------------
15; DisplayCharOut_TeletypeOutputWithAttribute
16; DisplayCharOut_TeletypeOutput
17; Parameters:
18; AL: Character to output
19; AH: Attribute to output
20; DS: BDA segment (zero)
21; ES:DI: Ptr to video memory where to output
22; Returns:
23; DI: Incremented for next character
24; Corrupts registers:
25; AX, DX
26;--------------------------------------------------------------------
27ALIGN JUMP_ALIGN
28DisplayCharOut_TeletypeOutputWithAttribute:
29 cmp al, ' ' ; Printable character?
30 jb SHORT DisplayCharOut_BiosTeletypeOutput
[42]31 WAIT_RETRACE_IF_NECESSARY_THEN stosw
[41]32 ret
33
34ALIGN JUMP_ALIGN
35DisplayCharOut_TeletypeOutput:
36 cmp al, ' ' ; Printable character?
37 jae SHORT DisplayCharOut_Character
38 ; Fall to DisplayCharOut_BiosTeletypeOutput
39
40;--------------------------------------------------------------------
41; DisplayCharOut_BiosTeletypeOutput
42; Parameters:
43; AL: Control character
44; DS: BDA segment (zero)
45; ES:DI: Ptr to video memory where to output
46; Returns:
47; DI: Incremented for next character
48; Corrupts registers:
49; AX, DX
50;--------------------------------------------------------------------
51ALIGN JUMP_ALIGN
52DisplayCharOut_BiosTeletypeOutput:
53 push ax
54 call DisplayCursor_SynchronizeCoordinatesToHardware
55 pop ax
56 call .OutputCharacterWithBIOS
57 call DisplayCursor_GetHardwareCoordinatesToAX
58 jmp DisplayCursor_SetCoordinatesFromAX
59
60;--------------------------------------------------------------------
61; .OutputCharacterWithBIOS
62; Parameters:
63; AL: Character to output
64; DS: BDA segment
65; Returns:
66; Nothing
67; Corrupts registers:
68; AX
69;--------------------------------------------------------------------
70ALIGN JUMP_ALIGN
71.OutputCharacterWithBIOS:
72 push bx
73 mov ah, TELETYPE_OUTPUT
74 mov bh, [VIDEO_BDA.bActivePage]
75 int BIOS_VIDEO_INTERRUPT_10h
76 pop bx
77 ret
78
79
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;--------------------------------------------------------------------
94ALIGN JUMP_ALIGN
95DisplayCharOut_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
101ALIGN JUMP_ALIGN
102DisplayCharOut_Character:
[42]103 WAIT_RETRACE_IF_NECESSARY_THEN stosb
[41]104 inc di ; Skip attribute
105 ret
106
107ALIGN JUMP_ALIGN
108DisplayCharOut_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
119; DISPLAY_CONTEXT.wCharOutParam: Offset to end of buffer (one past last)
120; Returns:
121; ES:DI: Updated for next character
122; Corrupts registers:
123; AX, DX
124;--------------------------------------------------------------------
125ALIGN JUMP_ALIGN
126DisplayCharOut_WriteCharacterToBuffer:
127 cmp di, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
128 jae SHORT .BufferFull
129 stosb
130.BufferFull:
131 ret
Note: See TracBrowser for help on using the repository browser.