Removed old negative behavior in putchar

This commit is contained in:
Mattia Giambirtone 2022-11-20 16:52:49 +01:00
parent bdfb10e3a6
commit 2b13f87f62
3 changed files with 5 additions and 4 deletions

View File

@ -76,7 +76,7 @@ skip_bpb:
; base pointer to a location that's far ; base pointer to a location that's far
; enough from where the code for the BIOS ; enough from where the code for the BIOS
; is located ; is located
mov sp, 0x7c00 mov sp, 0x9000
mov bp, sp mov bp, sp
sti sti
call bios_cls call bios_cls

View File

@ -122,7 +122,7 @@ u16 putchar(char ch, u8 row, u8 col, char attr) {
if (row >= MAX_ROWS) { if (row >= MAX_ROWS) {
return -2; return -2;
} }
u16 offset = (col >= 0 && row >= 0)? getOffset(row, col): getCursorOffset(); u16 offset = getOffset(row, col);
switch (ch) { switch (ch) {
// Note the difference between a carriage return (which // Note the difference between a carriage return (which
// only brings the write head back at 0 without changing // only brings the write head back at 0 without changing
@ -186,7 +186,7 @@ u16 getCursorOffset(void) {
u16 offset = readByte(REG_SCREEN_DATA); u16 offset = readByte(REG_SCREEN_DATA);
// Since we requested the high byte // Since we requested the high byte
// (i.e. the 8 most significant bits) // (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 // Conveniently, that's exactly what a
// left shift is for :) // left shift is for :)
offset <<= 8; offset <<= 8;

View File

@ -27,7 +27,8 @@ i32 kmain(void) {
clearScreen(); clearScreen();
kprint("0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); kprint("00000000000000000000000000000000000000000000000000000000000000000000000000000000"
"000000000000000000000000000000000000000000000000");
kprint("X"); kprint("X");
// TODO... // TODO...
return 0x202172; // :D return 0x202172; // :D