4 static void detect_video(void);
5 static int detect_vgainfo(void);
6 static int detect_egainfo(void);
7 static void detect_eqlist(void);
9 struct console con_disp = { clear_disp, disp_putc, 0 };
11 static uint16_t __far *vmem;
12 static uint16_t cur_attr;
13 static int cur_x, cur_y;
14 static int cur_scroll;
22 static void detect_video(void)
27 if(detect_vgainfo() == 0) {
30 if(detect_egainfo() == 0) {
36 vmem = mono ? MK_FP(0xb000, 0) : MK_FP(0xb800, 0);
39 static int detect_vgainfo(void)
44 int86(0x10, ®s, ®s);
45 if(regs.h.al != 0x1a) {
76 disp_type = DISP_MCGA;
79 disp_type = DISP_MCGA;
88 static int detect_egainfo(void)
94 int86(0x10, ®s, ®s);
95 if(regs.h.bh == 0xff) {
104 static void detect_eqlist(void)
108 int86(0x11, ®s, ®s);
109 switch(regs.w.ax & 0x30) {
111 disp_type = DISP_EGA;
116 disp_type = DISP_CGA;
120 disp_type = DISP_MDA;
126 void clear_disp(void)
130 void scroll_disp(int line)
134 void set_cursor(int x, int y)
140 void set_fgcolor(int color)
142 cur_attr = (cur_attr & 0xf0) | color;
145 void set_bgcolor(int color)
147 cur_attr = (cur_attr & 0x0f) | (color << 4);
150 void draw_glyph(int x, int y, int c, int attr)
152 vmem[y * 80 + x] = (uint16_t)c | ((uint16_t)attr << 8);
155 void draw_text(int x, int y, const char *s, int attr)
157 uint16_t __far *ptr = vmem + y * 80 + x;
160 *ptr++ = (uint16_t)*s++ | ((uint16_t)attr << 8);