jankos/framebuffer.c
2019-01-16 15:51:02 -08:00

52 lines
1.2 KiB
C

// Driver implementation for Jank's text frame buffer
// Buffer can display 80 columns by 25 Rows
// Start of buffer is at (real)address 0x000B8000
// Memory at this section is divided into 16-bit cells
// | 15-8 | 7-4 | 0-3
// | Asci | FG | BG
// The following colors are available(from 0x0 to 0xF):
// Black Blue Green Cyan Red Magenta
// Brown LightGrey DarkGrey LightBlue LightGreen
// LightCyan LightRed LightMagenta LightBrown White
/*
enum typedef Colors{
Black,
Blue,
Green,
Cyan,
Red,
Magenta,
Brown,
LightGrey,
DarkGrey,
LightBlue,
LightGreen,
LightCyan,
LightRed,
LightMagenta,
LightBrown,
White,
};
*/
#include "framebuffer.h"
// page 24
static char* Frame_Buffer = (char*)0x000B8000;
// Writes character to a given cell in the framebuffer
// Safety handled by caller function
void write_cell(const unsigned cell, const char c, const char fg_bg) {
Frame_Buffer[cell] = c;
Frame_Buffer[cell+1] = fg_bg;
}
void colors() {
// finding what the fucking colors are that we can draw
unsigned char color = 0x00;
for(int i =0;i<0x20;i++) {
Frame_Buffer[i] = 'a';
Frame_Buffer[i+1] = color;
color++;
}
}