diff --git a/framebuffer.c b/framebuffer.c index 668ed23..c16b02d 100644 --- a/framebuffer.c +++ b/framebuffer.c @@ -8,13 +8,16 @@ #include "types.h" #include "framebuffer.h" +// State trackers from header static u8* Frame_Buffer = (u8*)FRAME_BUFFER_ADDR; +s32 Frame_Buffer_Cursor = 0; // Writes character to a given cell in the framebuffer // @cell parameter is the logical (linear)index into the buffer -void write_cell_fb(u32 cell, u8 c, u8 fg, u8 bg) { +void write_cell_fb(u16 cell, u8 c, u8 fg, u8 bg) { Frame_Buffer[cell] = c; Frame_Buffer[cell+1] = (fg & 0x0f << 4) | (bg & 0x0f); + Frame_Buffer_Cursor++; } void clear_fb(void) { @@ -23,6 +26,7 @@ void clear_fb(void) { } } +// Takes the linear indexed position to move the cursos, if there is nothing at that position we should still have something there void fb_move_cursor(u16 position) { out_buffer(FB_CMD, FB_HIGH_CMD); out_buffer(FB_DATA, ((position >> 8) & 0x00ff) ); @@ -30,11 +34,3 @@ void fb_move_cursor(u16 position) { out_buffer(FB_DATA, position & 0x00ff); } -/* generic test func for this module */ -void test_fb(void) { - clear_fb(); - write_cell_fb(FRAME_CELL(0), 'a', Green, White); - write_cell_fb(FRAME_CELL(1), 'b', Green, White); - write_cell_fb(FRAME_CELL(2), 'c', Green, White); - fb_move_cursor(5); -} diff --git a/framebuffer.h b/framebuffer.h index a01e66e..5b33603 100644 --- a/framebuffer.h +++ b/framebuffer.h @@ -36,13 +36,11 @@ #define LightBrown 0x0e #define White 0x0f -void write_cell_fb(u32, u8, u8, u8); +extern s32 Frame_Buffer_Cursor; -void print_fb(u8*, u32); +void write_cell_fb(u16, u8, u8, u8); void clear_fb(void); void fb_move_cursor(u16); -/* Testing function because yote squad in here yeye */ -void test_fb(void);