#include "framebuffer.h" #define MAX_COL 80 #define MAX_LINE 25 VIDEO_STATE VS={ (u8 *)0xB8000, 0, 0, BLACK, GRAY, }; 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; // Refresh location VS.col+=1; if(VS.col>= MAX_COL){ VS.col=0; VS.line+=1; if(VS.line>=MAX_LINE){ VS.line=MAX_LINE-1; scrollup(); } } } void clear(){ for(char i=0;i