From c4cc22b897fed06d040d8fdcc0b40b0f0dcf5bcf Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Tue, 8 Jul 2014 19:09:31 +0200 Subject: Further celanup and a little modularization --- kernel/console.c | 94 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 45 deletions(-) (limited to 'kernel/console.c') diff --git a/kernel/console.c b/kernel/console.c index f17dbe3..4c52e81 100644 --- a/kernel/console.c +++ b/kernel/console.c @@ -3,6 +3,46 @@ static int posx=0; static int posy=0; +// helper_funcs + +void print_char_col(int x, int y, char c, char col) +{ + char* video_mem=(char *)SCR_VIDEOMEM+(x+y*SCR_WIDTH)*2; + video_mem[0]=c; + video_mem[1]=col; +} + +void print_char(int x, int y, char c) +{ + print_char_col(x,y,c,SCR_WHITE); +} + +void print_single_hex(int i) +{ + if(i<10)print_char_col(posx,posy,'0'+i,SCR_GREEN); + else if(i<16)print_char_col(posx,posy,'A'+i-10,SCR_GREEN); + posx++; + +} + +void print_str_col(int x,int y,char *str, char col) +{ + + while(*str!=0) + { + print_char_col(x++,y,*(str++),col); + } + +} + +void print_str(int x,int y,char *str) +{ + print_str_col(x,y,str,SCR_WHITE); +} + + +// +// void scr_clear() { int x,y; @@ -10,14 +50,20 @@ void scr_clear() for(x=0;x