2 #include "../port/lib.h"
6 #include "../port/error.h"
21 Yellow = Bright|Brown,
29 Attr = (Black<<4)|Grey, /* high nibble background
34 #define CGASCREENBASE ((uchar*)KADDR(0xB8000))
36 #define inb(x) 0 /* TODO */
37 #define outb(x, y) /* TODO */
40 static Lock cgascreenlock;
47 return inb(0x3D4+1) & 0xFF;
51 cgaregw(int index, int data)
61 cgaregw(0x0E, (cgapos/2>>8) & 0xFF);
62 cgaregw(0x0F, cgapos/2 & 0xFF);
63 CGASCREENBASE[cgapos+1] = Attr;
73 cgapos = cgapos/Width;
74 cgapos = (cgapos+1)*Width;
77 i = 8 - ((cgapos/2)&7);
88 CGASCREENBASE[cgapos++] = c;
89 CGASCREENBASE[cgapos++] = Attr;
91 if(cgapos >= Width*Height){
92 memmove(CGASCREENBASE, &CGASCREENBASE[Width], Width*(Height-1));
93 p = &CGASCREENBASE[Width*(Height-1)];
94 for(i=0; i<Width/2; i++){
98 cgapos = Width*(Height-1);
104 cgascreenputs(char* s, int n)
108 * Don't deadlock trying to
109 * print in an interrupt.
111 if(!canlock(&cgascreenlock))
115 lock(&cgascreenlock);
120 unlock(&cgascreenlock);
127 cgapos = cgaregr(0x0E)<<8;
128 cgapos |= cgaregr(0x0F);
131 screenputs = cgascreenputs;