+
+#define V(i) (((i)==0)?0x80:(((i)==1)?0xc0:0xff))
+#define COLOR(r,g,b,i) ((((r)?(V(i)):0) << 0)| (((g)?(V(i)):0) << 8)| (((b)?(V(i)):0) << 16))
+
+static int colormap[]=
+{
+[CRT_COLOR_BLACK]=COLOR(0,0,0,0),
+[CRT_COLOR_RED]=COLOR(0,0,1,0),
+[CRT_COLOR_GREEN]=COLOR(0,1,0,0),
+[CRT_COLOR_YELLOW]=COLOR(0,1,1,0),
+[CRT_COLOR_BLUE]=COLOR(1,0,0,0),
+[CRT_COLOR_MAGENTA]=COLOR(1,0,1,0),
+[CRT_COLOR_CYAN]=COLOR(1,1,0,0),
+[CRT_COLOR_WHITE]=COLOR(1,1,1,1),
+[CRT_COLOR_BLACK|CRT_COLOR_INTENSITY]=COLOR(1,1,1,0),
+[CRT_COLOR_RED|CRT_COLOR_INTENSITY]=COLOR(0,0,1,2),
+[CRT_COLOR_GREEN|CRT_COLOR_INTENSITY]=COLOR(0,1,0,2),
+[CRT_COLOR_YELLOW|CRT_COLOR_INTENSITY]=COLOR(0,1,1,2),
+[CRT_COLOR_BLUE|CRT_COLOR_INTENSITY]=COLOR(1,0,0,2),
+[CRT_COLOR_MAGENTA|CRT_COLOR_INTENSITY]=COLOR(1,0,1,2),
+[CRT_COLOR_CYAN|CRT_COLOR_INTENSITY]=COLOR(1,1,0,2),
+[CRT_COLOR_WHITE|CRT_COLOR_INTENSITY]=COLOR(1,1,1,2),
+};
+
+
+static void