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

Last change on this file since 374 was 369, checked in by gregli@…, 13 years ago

Removed align directives for initalization code and added define for align in boot-time calls to the assembly library (defaulting to 1), resulting in a significant savings for the AT and 386 builds. Fixed a bug with switch command line handling in the serial server. Put in CR characters in licesnse.txt, so that it properly displays on Windows. In the configurator, added default values for user supplied CHS and LBA values, defaulting to values within range when those features are enabled. Updated the copyright message in the configurator as the literal word Copyright is important.

File size: 3.5 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; Section containing code
8SECTION .text
9
10;--------------------------------------------------------------------
11; DisplayCharOut_TeletypeOutputWithAttribute
12; DisplayCharOut_TeletypeOutput
13; Parameters:
14; AL: Character to output
15; AH: Attribute to output
16; DS: BDA segment (zero)
17; ES:DI: Ptr to video memory where to output
18; Returns:
19; DI: Incremented for next character
20; Corrupts registers:
21; AX, DX
22;--------------------------------------------------------------------
23ALIGN DISPLAY_JUMP_ALIGN
24DisplayCharOut_TeletypeOutputWithAttribute:
25 cmp al, ' ' ; Printable character?
26 jb SHORT DisplayCharOut_BiosTeletypeOutput
27 WAIT_RETRACE_IF_NECESSARY_THEN stosw
28 ret
29
30ALIGN DISPLAY_JUMP_ALIGN
31DisplayCharOut_TeletypeOutput:
32 cmp al, ' ' ; Printable character?
33 jae SHORT DisplayCharOut_Character
34 ; Fall to DisplayCharOut_BiosTeletypeOutput
35
36;--------------------------------------------------------------------
37; DisplayCharOut_BiosTeletypeOutput
38; Parameters:
39; AL: Control character
40; DS: BDA segment (zero)
41; ES:DI: Ptr to video memory where to output
42; Returns:
43; DI: Incremented for next character
44; Corrupts registers:
45; AX, DX
46;--------------------------------------------------------------------
47ALIGN DISPLAY_JUMP_ALIGN
48DisplayCharOut_BiosTeletypeOutput:
49 push ax
50 call DisplayCursor_SynchronizeCoordinatesToHardware
51 pop ax
52
53 ; Output character with BIOS
54 push bx
55 mov ah, TELETYPE_OUTPUT
56 mov bh, [VIDEO_BDA.bActivePage]
57 int BIOS_VIDEO_INTERRUPT_10h
58 pop bx
59
60 call DisplayCursor_GetHardwareCoordinatesToAX
61 jmp DisplayCursor_SetCoordinatesFromAX
62
63
64;--------------------------------------------------------------------
65; DisplayCharOut_Attribute
66; DisplayCharOut_Character
67; DisplayCharOut_CharacterWithAttribute
68; Parameters:
69; AL: Character to output
70; AH: Attribute to output
71; DS: BDA segment (zero)
72; ES:DI: Ptr to video memory where to output
73; Returns:
74; DI: Incremented for next character
75; Corrupts registers:
76; AX, DX
77;--------------------------------------------------------------------
78ALIGN DISPLAY_JUMP_ALIGN
79DisplayCharOut_Attribute:
80 xchg al, ah ; Swap character and attribute
81 inc di ; Skip character
82 WAIT_RETRACE_IF_NECESSARY_THEN stosb
83 ret
84
85ALIGN DISPLAY_JUMP_ALIGN
86DisplayCharOut_Character:
87 WAIT_RETRACE_IF_NECESSARY_THEN stosb
88 inc di ; Skip attribute
89 ret
90
91ALIGN DISPLAY_JUMP_ALIGN
92DisplayCharOut_CharacterWithAttribute:
93 WAIT_RETRACE_IF_NECESSARY_THEN stosw
94 ret
95
96
97;--------------------------------------------------------------------
98; DisplayCharOut_WriteCharacterToBuffer
99; Parameters:
100; AL: Character to output
101; DS: BDA segment (zero)
102; ES:DI: Ptr to destination string buffer
103; DISPLAY_CONTEXT.wCharOutParam: Characters left in buffer
104; Returns:
105; ES:DI: Updated for next character
106; Corrupts registers:
107; AX, DX
108;--------------------------------------------------------------------
109ALIGN DISPLAY_JUMP_ALIGN
110DisplayCharOut_WriteCharacterToBuffer:
111 cmp WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam], BYTE 0
112 je SHORT .BufferFull
113 stosb
114 dec WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
115.BufferFull:
116 ret
Note: See TracBrowser for help on using the repository browser.