Finalize ecall 4 implementation (String printing)
MODIFY
src/parser.cpp
src/parser.cpp
@@ -53,13 +53,13 @@ QString Parser::getStringAt(uint32_t address) const {
// Returns the null-terminated string starting at @address
MainMemory* memPtr = Pipeline::getPipeline()->getMemoryPtr();
QString string;
-
- char read = memPtr->read(address) & 0xff;
- while (read != 0) {
+ char read;
+ do{
+ read = memPtr->read(address) & 0xff;
string.append(read);
address++;
- read = memPtr->read(address) & 0xff;
}
+ while (read != '\0');
return string;
}

MODIFY
src/processortab.cpp
src/processortab.cpp
@@ -201,6 +201,7 @@ bool ProcessorTab::handleEcall(const std::pair<Pipeline::ECALL, int32_t>& ecall_
switch (ecall_val.first) {
case Pipeline::ECALL::print_string: {
emit appendToLog(Parser::getParser()->getStringAt(ecall_val.second));
+ break;
}
case Pipeline::ECALL::print_int: {
emit appendToLog(QString::number(ecall_val.second));

Finalize ecall 4 implementation (String printing)