aboutsummaryrefslogtreecommitdiff
path: root/src/vga.c
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-06-08 22:11:44 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-06-08 22:11:44 +0100
commitcb6d24b838632e1269a5e4bb4e83425061f5d853 (patch)
treefd58b5d7ceddb9bf0fd3f3058b71d53a03ebd32b /src/vga.c
parentc5e314048afd1ba3f87204b0655af70f95ae7ab1 (diff)
downloadgold-mine-run-cb6d24b838632e1269a5e4bb4e83425061f5d853.tar.gz
gold-mine-run-cb6d24b838632e1269a5e4bb4e83425061f5d853.zip
Detect the VGA card before setting mode 0x13
Diffstat (limited to 'src/vga.c')
-rw-r--r--src/vga.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/vga.c b/src/vga.c
index e90ebba..6b093c0 100644
--- a/src/vga.c
+++ b/src/vga.c
@@ -25,9 +25,17 @@ void close_framebuffer()
__djgpp_nearptr_disable();
}
-void set_mode(uint8_t mode)
+uint8_t set_mode(uint8_t mode)
{
__dpmi_regs regs = { 0 };
+
+ /* detect VGA card */
+ regs.x.ax = 0x1a00;
+ __dpmi_int(0x10, &regs);
+ if (regs.h.al != 0x1a)
+ return 0;
+
+ memset(&regs, 0, sizeof(regs));
regs.x.ax = mode;
__dpmi_int(0x10, &regs);
@@ -57,6 +65,8 @@ void set_mode(uint8_t mode)
outportw(0x3d4, 0x8e11); /* restore retrace */
enable();
}
+
+ return 1;
}
void wait_vsync()