blob: 97270257a60ad98f68ac2278c4c03a7d0be54d5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <vga.h>
#include <stddef.h>
static uint16_t* vga_buffer BLSEC_DATA = VGA_MEMORY_ADDR;
void vga_setup(int xmax, int ymax)
{
for (size_t i = 0; i < MAX_WIDTH; i++) {
for (size_t j = 0; j < MAX_HEIGHT; j++) {
vga_put(i, j, ' ', 0);
}
}
}
uint8_t vga_color(uint8_t fg, uint8_t bg)
{
return (uint8_t) fg | (uint8_t) bg << 4;
}
void vga_put(uint32_t x, uint32_t y, unsigned char uc, uint8_t color)
{
vga_buffer[y*80+x] = (uint16_t) uc | (uint16_t) color << 8;
}
|