aboutsummaryrefslogtreecommitdiff
path: root/src/utils/print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/print.c')
-rw-r--r--src/utils/print.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/utils/print.c b/src/utils/print.c
index dbed000..c2cdaf1 100644
--- a/src/utils/print.c
+++ b/src/utils/print.c
@@ -20,6 +20,17 @@ VIDEO_STATE VS={
};
void putchar(char c){
+ // Handle newline here
+ if(c=='\n'){
+ VS.col=0;
+ VS.line+=1;
+ if(VS.line>=MAX_LINE){
+ VS.line=MAX_LINE-1;
+ scrollup();
+ }
+ return;
+ }
+
// Print char
VS.mem[VS.col*2+MAX_COL*VS.line*2]=c;
VS.mem[VS.col*2+MAX_COL*VS.line*2+1]=VS.fg|VS.bg<<4;
@@ -44,6 +55,13 @@ void print(char *str){
}
}
+void printc(char* str,VIDEO_COLORS c){
+ VIDEO_COLORS backup=VS.fg;
+ VS.fg=c;
+ print(str);
+ VS.fg=backup;
+}
+
void clear(){
for(char i=0;i<MAX_LINE;i++){
scrollup();