aboutsummaryrefslogtreecommitdiff
path: root/src/vga.c
blob: 5badd826b8bf0373a3448362e83498a95d6bb783 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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, &regs);
}