Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / i386-pc / exec / screen.c
blobbd24d8a3ed8a5362cafda7a6a4c984bdda5f7ed9
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <strings.h>
7 #include <stdarg.h>
8 #include <stdlib.h>
9 #include <string.h>
11 #undef __save_flags
12 #undef __restore_flags
13 #undef __cli
14 #undef __sti
16 #define __save_flags(x) __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */)
17 #define __restore_flags(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc")
18 #define __cli() __asm__ __volatile__("cli": : :"memory")
19 #define __sti() __asm__ __volatile__("sti": : :"memory")
21 static int x,y, dead;
23 struct scr
25 unsigned char sign;
26 unsigned char attr;
29 static struct scr *view = (struct scr *)0xb8000;
31 void clr()
33 unsigned long flags;
34 int i;
36 __save_flags(flags);
37 __cli();
39 if (!dead) for (i=0; i<80*25; i++)
41 view[i].sign = ' ';
42 view[i].attr = 7;
44 x=0;
45 y=0;
47 __restore_flags(flags);
50 void Putc(char chr)
52 unsigned long flags;
54 __save_flags(flags);
55 __cli();
56 if (chr == 3) /* die / CTRL-C / "signal" */
58 dead = 1;
60 else if (!dead)
63 if (chr)
65 if (chr == 10)
67 x = 0;
68 y++;
70 else
72 int i = 80*y+x;
73 view[i].sign = chr;
74 x++;
75 if (x == 80)
77 x = 0;
78 y++;
82 if (y>24)
84 int i;
85 y=24;
87 for (i=0; i<80*24; i++)
88 view[i].sign = view[i+80].sign;
89 for (i=80*24; i<80*25; i++)
90 view[i].sign = ' ';
93 __restore_flags(flags);
96 void scr_RawPutChars(char *chr, int lim)
98 int i;
100 for (i=0; i<lim; i++)
101 Putc(*chr++);