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

Last change on this file since 373 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
RevLine 
[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
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;--------------------------------------------------------------------
[369]23ALIGN DISPLAY_JUMP_ALIGN
[41]24DisplayCharOut_TeletypeOutputWithAttribute:
25 cmp al, ' ' ; Printable character?
26 jb SHORT DisplayCharOut_BiosTeletypeOutput
[42]27 WAIT_RETRACE_IF_NECESSARY_THEN stosw
[41]28 ret
29
[369]30ALIGN DISPLAY_JUMP_ALIGN
[41]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;--------------------------------------------------------------------
[369]47ALIGN DISPLAY_JUMP_ALIGN
[41]48DisplayCharOut_BiosTeletypeOutput:
49 push ax
50 call DisplayCursor_SynchronizeCoordinatesToHardware
51 pop ax
52
[101]53 ; Output character with BIOS
[41]54 push bx
55 mov ah, TELETYPE_OUTPUT
56 mov bh, [VIDEO_BDA.bActivePage]
57 int BIOS_VIDEO_INTERRUPT_10h
58 pop bx
59
[101]60 call DisplayCursor_GetHardwareCoordinatesToAX
61 jmp DisplayCursor_SetCoordinatesFromAX
[41]62
[101]63
[41]64;--------------------------------------------------------------------
65; DisplayCharOut_Attribute
66; DisplayCharOut_Character
67; DisplayCharOut_CharacterWithAttribute
68; Parameters:
69; AL: Character to output
70; AH: Attribute to output
[42]71; DS: BDA segment (zero)
[41]72; ES:DI: Ptr to video memory where to output
73; Returns:
74; DI: Incremented for next character
75; Corrupts registers:
[42]76; AX, DX
[41]77;--------------------------------------------------------------------
[369]78ALIGN DISPLAY_JUMP_ALIGN
[41]79DisplayCharOut_Attribute:
80 xchg al, ah ; Swap character and attribute
81 inc di ; Skip character
[42]82 WAIT_RETRACE_IF_NECESSARY_THEN stosb
[41]83 ret
84
[369]85ALIGN DISPLAY_JUMP_ALIGN
[41]86DisplayCharOut_Character:
[42]87 WAIT_RETRACE_IF_NECESSARY_THEN stosb
[41]88 inc di ; Skip attribute
89 ret
90
[369]91ALIGN DISPLAY_JUMP_ALIGN
[41]92DisplayCharOut_CharacterWithAttribute:
[42]93 WAIT_RETRACE_IF_NECESSARY_THEN stosw
[41]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
[55]103; DISPLAY_CONTEXT.wCharOutParam: Characters left in buffer
[41]104; Returns:
105; ES:DI: Updated for next character
106; Corrupts registers:
107; AX, DX
108;--------------------------------------------------------------------
[369]109ALIGN DISPLAY_JUMP_ALIGN
[41]110DisplayCharOut_WriteCharacterToBuffer:
[55]111 cmp WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam], BYTE 0
112 je SHORT .BufferFull
[41]113 stosb
[55]114 dec WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCharOutParam]
[41]115.BufferFull:
116 ret
Note: See TracBrowser for help on using the repository browser.