added proper type names for clarity/sanity sake

This commit is contained in:
shockrah 2019-09-15 18:28:01 -07:00
parent c8851baea6
commit 92c5b32b12
3 changed files with 19 additions and 11 deletions

View File

@ -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<AREA; cell+=2) {
write_cell_fb(cell, ' ', 0x00, 0x00);
}
}
void fb_move_cursor(unsigned short position) {
void fb_move_cursor(u16 position) {
out_buffer(FB_CMD, FB_HIGH_CMD);
out_buffer(FB_DATA, ((position >> 8) & 0x00ff) );
out_buffer(FB_CMD, FB_LOW_CMD);

View File

@ -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);

11
types.h Normal file
View File

@ -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;