From 2b13f87f6237d1f05198b8005b0d48d282ca7ef5 Mon Sep 17 00:00:00 2001 From: Mattia Giambirtone Date: Sun, 20 Nov 2022 16:52:49 +0100 Subject: [PATCH] Removed old negative behavior in putchar --- src/boot/mbr.s | 2 +- src/kernel/drivers/vga/screen.c | 4 ++-- src/kernel/main.c | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/boot/mbr.s b/src/boot/mbr.s index ec1585e..9c97d11 100644 --- a/src/boot/mbr.s +++ b/src/boot/mbr.s @@ -76,7 +76,7 @@ skip_bpb: ; base pointer to a location that's far ; enough from where the code for the BIOS ; is located - mov sp, 0x7c00 + mov sp, 0x9000 mov bp, sp sti call bios_cls diff --git a/src/kernel/drivers/vga/screen.c b/src/kernel/drivers/vga/screen.c index b1aef88..d86b3fa 100644 --- a/src/kernel/drivers/vga/screen.c +++ b/src/kernel/drivers/vga/screen.c @@ -122,7 +122,7 @@ u16 putchar(char ch, u8 row, u8 col, char attr) { if (row >= MAX_ROWS) { return -2; } - u16 offset = (col >= 0 && row >= 0)? getOffset(row, col): getCursorOffset(); + u16 offset = getOffset(row, col); switch (ch) { // Note the difference between a carriage return (which // only brings the write head back at 0 without changing @@ -186,7 +186,7 @@ u16 getCursorOffset(void) { u16 offset = readByte(REG_SCREEN_DATA); // Since we requested the high byte // (i.e. the 8 most significant bits) - // we now want to move them by 8 places. + // we now want to move them up by 8 places. // Conveniently, that's exactly what a // left shift is for :) offset <<= 8; diff --git a/src/kernel/main.c b/src/kernel/main.c index bff8754..6af3280 100644 --- a/src/kernel/main.c +++ b/src/kernel/main.c @@ -27,7 +27,8 @@ i32 kmain(void) { clearScreen(); - kprint("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); + kprint("00000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000"); kprint("X"); // TODO... return 0x202172; // :D