aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
blob: dd3cffaf4f70bf17a388fd2081afd8dc2fd74ffb (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <conio.h>

#include "vga.h"

/* embedded data */
extern const uint8_t binary_palette_start[];

int main(int argc, char *argv[])
{
    /* set VGA 320x200, 256 col */
    set_mode(0x13);

    set_palette(binary_palette_start);

    uint8_t *screen = open_framebuffer();
    if (!screen)
    {
        fprintf(stderr, "ERROR: failed to open the framebuffer\n");
        return 1;
    }

    for (int i = 0; i < 16; i++)
    {
        memset(screen, i, 320 * 200);
        getch();
    }

    printf("Hello DOS!\n");

    getch();

    set_mode(3);
    close_framebuffer();

    return 0;
}