diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-29 23:32:41 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-29 23:32:41 +0100 |
commit | 2941ac6b8ecc1fd96b886219795f5d7e55bb85d8 (patch) | |
tree | 9786ef28b990199e353bea285d6d5ecdb0a45e31 /src/vga.c | |
download | gold-mine-run-2941ac6b8ecc1fd96b886219795f5d7e55bb85d8.tar.gz gold-mine-run-2941ac6b8ecc1fd96b886219795f5d7e55bb85d8.zip |
Initial import
Diffstat (limited to 'src/vga.c')
-rw-r--r-- | src/vga.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vga.c b/src/vga.c new file mode 100644 index 0000000..5badd82 --- /dev/null +++ b/src/vga.c @@ -0,0 +1,24 @@ +#include <stdlib.h> +#include <stdint.h> +#include <dpmi.h> +#include <sys/nearptr.h> + +uint8_t *open_framebuffer() +{ + if (__djgpp_nearptr_enable() == 0) + return NULL; + + return (uint8_t *)(0xa0000 + __djgpp_conventional_base); +} + +void close_framebuffer() +{ + __djgpp_nearptr_disable(); +} + +void set_mode(uint8_t mode) +{ + __dpmi_regs regs = { 0 }; + regs.x.ax = mode; + __dpmi_int(0x10, ®s); +} |