adding some basic frame buffer testing functions
This commit is contained in:
parent
a02a286aea
commit
835e9ee6f0
52
framebuffer.c
Normal file
52
framebuffer.c
Normal file
@ -0,0 +1,52 @@
|
||||
// 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++;
|
||||
}
|
||||
}
|
7
framebuffer.h
Normal file
7
framebuffer.h
Normal file
@ -0,0 +1,7 @@
|
||||
#define COLUMNS 80
|
||||
#define ROWS 25
|
||||
#define AREA ( COLUMNS * ROWS )
|
||||
|
||||
void write_cell(const unsigned cell, const char c , const char fg_bg);
|
||||
|
||||
void hello();
|
Loading…
Reference in New Issue
Block a user