revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-native / bootconsole / screen_text.c
blob8f4eac36aa6450bd623c13a8be2b1f47a75a6150
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Hardware text mode (IBM-compatible) screen console.
6 */
8 #include <bootconsole.h>
10 #include "console.h"
12 struct scr
14 unsigned char sign;
15 unsigned char attr;
19 * There's no init function for text mode console.
20 * Just set scr_Framebuffer, scr_Width and scr_Height and you are ready to go.
23 void txt_Clear()
25 struct scr *view = scr_FrameBuffer;
26 unsigned int i;
28 scr_XPos = 0;
29 scr_YPos = 0;
31 for (i = 0; i < scr_Width * scr_Height; i++)
33 view[i].sign = ' ';
34 view[i].attr = 7;
38 void txt_Putc(char chr)
40 struct scr *view = scr_FrameBuffer;
41 unsigned int i;
43 /* Ignore null bytes, they are output by formatting routines as terminators */
44 if (chr == 0)
45 return;
47 /* Reached end of line ? New line if so. */
48 if ((chr == '\n') || (scr_XPos >= scr_Width))
50 scr_XPos = 0;
51 scr_YPos++;
54 if (scr_YPos >= scr_Height)
56 scr_YPos = scr_Height - 1;
58 for (i = 0; i < scr_Width * scr_YPos; i++)
59 view[i].sign = view[i+80].sign;
60 for (i = scr_Width * scr_YPos; i < scr_Width * scr_Height; i++)
61 view[i].sign = ' ';
64 if (chr == '\n')
65 return;
67 i = 80 * scr_YPos + scr_XPos;
68 view[i].sign = chr;
69 scr_XPos++;