#include "eel.h" #include "lowlevel.h" typedef struct vesa_info { char vesa[4]; short version; int OEM_name; char caps[4]; int modes; char resv[238]; } VESA_INFO; /* int to far pointer conversion structure */ /* related to the EEL_PTR structure in lowlevel.h */ typedef struct { int base, size, value; } EEL_POINTER; set_eel_pointer(p, base, size, value) EEL_POINTER *p; { p->base = base; p->size = size; p->value = value; } /* active = 2 - test for availability of this mode */ /* active = 1 - set video to this mode */ /* active = 0 - turn off this mode */ /* video.e already supports the 80x60 mode (0x108) */ video_vesa_mode(mode, active) { int i; short *mp; VESA_INFO info; switch (active) { case 2: /* test for support */ m_regs.w.es = get_pointer(&info, SEGMENT); m_regs.w.di = get_pointer(&info, OFFSET); vid_int(0x4F00); /* get superVGA information */ if (m_regs.w.ax != 0x004F || !info.modes || strncmp(info.vesa, "VESA", 4)) return 0; set_eel_pointer(&mp, info.modes, 1024, info.modes); for (i = 0; i < 256 && mp[i] != -1; i++) if (mp[i] == mode) /* find this mode in the array */ return 1; break; case 1: /* set this mode */ m_regs.w.bx = mode; vid_int(0x4F02); /* set superVGA video mode */ if (m_regs.w.ax == 0x004F) return 1; break; case 0: /* terminate mode */ vid_int(video_normal_mode()); /* set mode to 80x25 */ vid_bright_back(1); leave_blank = 1; return 1; } return 0; /* failure */ } video_mode_132x25(active) { return video_vesa_mode(0x109, active); } video_mode_132x43(active) { return video_vesa_mode(0x10A, active); } video_mode_132x50(active) { return video_vesa_mode(0x10B, active); } video_mode_132x60(active) { return video_vesa_mode(0x10C, active); }