2 #include "../port/lib.h"
6 #include "../port/error.h"
13 Attr = 0x4f, /* white on blue */
17 #define CGASCREENBASE ((uchar*)cgabase)
20 static int screeninitdone;
21 static Lock cgascreenlock;
27 return inb(0x3D4+1) & 0xFF;
31 cgaregw(int index, int data)
40 cgaregw(0x0E, (cgapos/2>>8) & 0xFF);
41 cgaregw(0x0F, cgapos/2 & 0xFF);
42 CGASCREENBASE[cgapos+1] = Attr;
51 cgapos = cgapos/Width;
52 cgapos = (cgapos+1)*Width;
55 i = 8 - ((cgapos/2)&7);
66 CGASCREENBASE[cgapos++] = c;
67 CGASCREENBASE[cgapos++] = Attr;
69 if(cgapos >= Width*Height){
70 memmove(CGASCREENBASE, &CGASCREENBASE[Width], Width*(Height-1));
71 for (i = Width*(Height-1); i < Width*Height;) {
72 CGASCREENBASE[i++] = 0x20;
73 CGASCREENBASE[i++] = Attr;
75 cgapos = Width*(Height-1);
83 cgabase = (ulong)arch->pcimem(0xB8000, 0x8000);
85 cgapos = cgaregr(0x0E)<<8;
86 cgapos |= cgaregr(0x0F);
92 cgascreenputs(char* s, int n)
98 * Don't deadlock trying to
99 * print in an interrupt.
101 if(!canlock(&cgascreenlock))
105 lock(&cgascreenlock);
110 unlock(&cgascreenlock);
113 void (*screenputs)(char*, int) = cgascreenputs;