summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index e4d3b4e..7c1172c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;
}