os-workshop

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 84220e793f80f0c6838c365e6e5e9d87a90af482
parent 2f3b11ec75c68279c91046161facfda8bc5ef638
Author: Brian Swetland <swetland@frotz.net>
Date:   Sat, 23 Apr 2022 18:30:23 -0700

debug: insert \r before \n

- this fixes the serial console display in the qemu GUI

Diffstat:
Mhw/src/debug.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/src/debug.c b/hw/src/debug.c @@ -9,12 +9,15 @@ #define wr8(v,a) (*((volatile unsigned char*) (a)) = v) void xputc(unsigned c) { + if (c == '\n') { + wr8('\r', UART_BASE); + } wr8(c, UART_BASE); } void xputs(const char* s) { while (*s != 0) { - wr8(*s++, UART_BASE); + xputc(*s++); } }