aboutsummaryrefslogtreecommitdiff
path: root/drivers/vga.c
blob: cfcd28722e5d30b8f9904caf8768d7370489fedb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stddef.h>
#include <stdlib.h>
#include "multiboot.h"
#include "vga.h"

static uint8_t *framebuffer = NULL;
static uint16_t fb_width;
static uint16_t fb_height;

void vga_drawpixel(int x, int y, uint32_t pixel)
{
    ((uint32_t*)framebuffer)[y * fb_width + x] = pixel;
}

void vga_init(struct vbe_info_t *vbe_mode_info)
{
    framebuffer = vbe_mode_info->physbase;
    fb_width = vbe_mode_info->Xres;
    fb_height = vbe_mode_info->Yres;
}