diff --git a/framebuffer.c b/framebuffer.c index e6fa3a3..668ed23 100644 --- a/framebuffer.c +++ b/framebuffer.c @@ -5,29 +5,25 @@ // Memory at this section is divided into 16-bit cells // | 15-8 | 7-4 | 0-3 // | Asci | FG | BG +#include "types.h" #include "framebuffer.h" -//#include "io.h" -static char* Frame_Buffer = (char*)FRAME_BUFFER_ADDR; -//static char* Frame_Buffer_End = (char*)(FRAME_BUFFER_ADDR + AREA); +static u8* Frame_Buffer = (u8*)FRAME_BUFFER_ADDR; // Writes character to a given cell in the framebuffer // @cell parameter is the logical (linear)index into the buffer - // _not_ the actual offset from the buffer addr - // also proper location is caller's responsibility -void write_cell_fb(unsigned cell, char c, char fg, char bg) { +void write_cell_fb(u32 cell, u8 c, u8 fg, u8 bg) { Frame_Buffer[cell] = c; Frame_Buffer[cell+1] = (fg & 0x0f << 4) | (bg & 0x0f); } - void clear_fb(void) { for(unsigned cell=0;cell> 8) & 0x00ff) ); out_buffer(FB_CMD, FB_LOW_CMD); diff --git a/framebuffer.h b/framebuffer.h index 55c3848..a01e66e 100644 --- a/framebuffer.h +++ b/framebuffer.h @@ -1,3 +1,4 @@ +#include "types.h" #include "io.h" #define COLUMNS 80 @@ -35,13 +36,13 @@ #define LightBrown 0x0e #define White 0x0f -void write_cell_fb(unsigned, char, char, char); +void write_cell_fb(u32, u8, u8, u8); -void print_fb(char*, unsigned); +void print_fb(u8*, u32); void clear_fb(void); -void fb_move_cursor(unsigned short); +void fb_move_cursor(u16); /* Testing function because yote squad in here yeye */ void test_fb(void); diff --git a/types.h b/types.h new file mode 100644 index 0000000..c4c43e6 --- /dev/null +++ b/types.h @@ -0,0 +1,11 @@ +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned long u32; +typedef unsigned long long u64; + +typedef signed char s8; +typedef signed short s16; +typedef signed long s32; +typedef signed long long s64; + +