diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1,5 +1,6 @@ #define NB_COLS 80 #define NB_ROWS 25 +#define BPC 2 #define VIDEO_BUFFER 0xB8000 @@ -32,14 +33,15 @@ int printk(const char *str) for (int i = 0; str[i]; ++i) { /* TODO add the serial port handling */ - if ((long)addr >= offset + NB_COLS * NB_ROWS) { + if ((long)addr >= offset + NB_COLS * NB_ROWS * BPC) { /* shift up */ - addr -= NB_COLS; - my_memmove((void *)offset, (void *)offset + NB_COLS, NB_COLS * (NB_ROWS - 1)); - my_memset((void *)offset + NB_COLS * (NB_ROWS - 1), ' ', NB_ROWS); + addr -= NB_COLS * BPC; + my_memmove((void *)offset, (void *)offset + NB_COLS * BPC, NB_COLS * (NB_ROWS - 1) * BPC); + my_memset((void *)offset + NB_COLS * (NB_ROWS - 1) * BPC, ' ', NB_COLS * BPC); } - *addr++ = str[i]; + *addr = str[i]; + addr += BPC; ++count; } |