summaryrefslogtreecommitdiff
path: root/kernel/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/console.c')
-rw-r--r--kernel/console.c94
1 files changed, 49 insertions, 45 deletions
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<SCR_WIDTH;x++)
for(y=0;y<SCR_HEIGHT;y++)
{
- print_char_col(x,y," ",SCR_BLACK);
+ print_char_col(x,y,' ',SCR_BLACK);
}
posx=posy=0;
}
-//TODO
+
+void scr_put_string_nl(char *str)
+{
+ scr_put_string(str);
+ scr_nextline;
+}
+
void scr_nextline()
{
int i,x;
@@ -34,8 +80,8 @@ void scr_nextline()
{
char* video_mem=(char *)SCR_VIDEOMEM+((x)+(i-1)*SCR_WIDTH)*2;
char* video_mem2=(char *)SCR_VIDEOMEM+((x)+i*SCR_WIDTH)*2;
-
*video_mem=*video_mem2;
+ *(video_mem+1)=*(video_mem2+1);
}
}
@@ -71,45 +117,3 @@ void scr_put_string(char *str)
}
}
-
-
-
-
-
-// helper_funcs
-
-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(int x,int y,char *str)
-{
- print_str_col(x,y,str,SCR_WHITE);
-}
-
-void print_char(int x, int y, char c)
-{
- print_char_col(x,y,c,SCR_WHITE);
-}
-
-void print_str_col(int x,int y,char *str, char col)
-{
-
- while(*str!=0)
- {
- print_char_col(x++,y,*(str++),col);
- }
-
-}
-
-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;
-}