#include "disp.h"
+#include "asmutil.h"
static void detect_video(void);
+static int detect_vgainfo(void);
+static int detect_egainfo(void);
+static void detect_eqlist(void);
struct console con_disp = { clear_disp, disp_putc, 0 };
if(detect_egainfo() == 0) {
goto done;
}
- if(detect_eqlist() == 0) {
- goto done;
- }
+ detect_eqlist();
done:
vmem = mono ? MK_FP(0xb000, 0) : MK_FP(0xb800, 0);
return 0;
}
-static int detect_eqlist(void)
+static void detect_eqlist(void)
+{
+ union regs regs;
+
+ int86(0x11, ®s, ®s);
+ switch(regs.w.ax & 0x30) {
+ case 0:
+ disp_type = DISP_EGA;
+ break;
+
+ case 0x10:
+ case 0x20:
+ disp_type = DISP_CGA;
+ break;
+
+ case 0x30:
+ disp_type = DISP_MDA;
+ mono = 1;
+ break;
+ }
+}
+
+void clear_disp(void)
+{
+}
+
+void scroll_disp(int line)
{
}
+
+void set_cursor(int x, int y)
+{
+ cur_x = x;
+ cur_y = y;
+}
+
+void set_fgcolor(int color)
+{
+ cur_attr = (cur_attr & 0xf0) | color;
+}
+
+void set_bgcolor(int color)
+{
+ cur_attr = (cur_attr & 0x0f) | (color << 4);
+}
+
+void draw_glyph(int x, int y, int c, int attr)
+{
+ vmem[y * 80 + x] = (uint16_t)c | ((uint16_t)attr << 8);
+}
+
+void draw_text(int x, int y, const char *s, int attr)
+{
+ uint16_t __far *ptr = vmem + y * 80 + x;
+
+ while(*s) {
+ *ptr++ = (uint16_t)*s++ | ((uint16_t)attr << 8);
+ }
+}
+
+