diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-10-10 11:26:50 +0200 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-10-10 11:28:13 +0200 |
commit | e885241b95d3784b5206fa6fbad7aa6861e8bd48 (patch) | |
tree | 58dd0173771433cd5125fece26e9143ff106e53e /src | |
parent | 59974248187229378f1df28b224a2d02e2d13fe4 (diff) |
kfs: fixed printk
every character to be displayed on the screen is two bytes long, not one
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'src')
-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; } |