Handle clock interrupt and cleaning code

This commit is contained in:
Loic Guegan 2021-04-08 19:06:44 +02:00
parent 958e2dae04
commit 8fee35522d
8 changed files with 79 additions and 17 deletions

View file

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