From 5ae907ca5aebd51ee1c273fa4ed5233b47a52b60 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 22 Apr 2025 23:19:31 +0200 Subject: [PATCH] dirty inbetween work commit --- device/serialstream.cc | 17 ++++++++++++----- device/textstream.cc | 4 +--- tools/qemu.mk | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/device/serialstream.cc b/device/serialstream.cc index 778b7eb..bb029f1 100644 --- a/device/serialstream.cc +++ b/device/serialstream.cc @@ -5,7 +5,9 @@ SerialStream::SerialStream(ComPort port, BaudRate baud_rate, DataBits data_bits, StopBits stop_bits, Parity parity) :Serial(port, baud_rate, data_bits, stop_bits, parity) {} -void SerialStream::flush() {} +void SerialStream::flush() { + print(buffer, strlen(buffer)); +} // https://stackoverflow.com/questions/3440726/what-is-the-proper-way-of-implementing-a-good-itoa-function // Yet, another good itoa implementation @@ -76,10 +78,15 @@ void SerialStream::reset() { } void SerialStream::setPos(int x, int y) { - char out[] = {0x1b, '[', 0, 0, ';', 0, 0, 'H', 0}; - itoa(x, &out[2], 10); - itoa(y, &out[5], 10); - print(out, strlen(out)); + //char out[] = {0x1b, '[', 0, 0, ';', 0, 0, 'H', 0}; + *this << 0x1b; + *this << '['; + *this << dec << x; + *this << ';' << y << 'H' << endl; + flush(); + //itoa(x, &out[2], 10); + //itoa(y, &out[5], 10); + //print( out , strlen(out)); } void SerialStream::print(char* str, int length) { diff --git a/device/textstream.cc b/device/textstream.cc index 9741880..b7dd125 100644 --- a/device/textstream.cc +++ b/device/textstream.cc @@ -13,9 +13,7 @@ TextStream::TextStream(unsigned from_col, void TextStream::flush() { - for (unsigned i=0; i <= pos; i++) { - print(&buffer[i],1); - } + print(buffer,pos); pos = 0; diff --git a/tools/qemu.mk b/tools/qemu.mk index af6fbff..7526310 100644 --- a/tools/qemu.mk +++ b/tools/qemu.mk @@ -59,7 +59,7 @@ kvm: all # Execute Qemu with activated GDB stub and directly connect GDB to the spawned Qemu. gdb: all - ${VERBOSE} cgdb -d $(GDB) "$(DBGKERNEL)" \ + ${VERBOSE} $(GDB) "$(DBGKERNEL)" \ -ex "set arch $(DBGARCH)" \ -ex "target remote | exec $(QEMU) -gdb stdio $(QEMUKERNEL) -smp $(QEMUCPUS) -S $(QEMUFLAGS) $(DBGFLAGS)"