diff --git a/Intel8080/inc/Disassembler.h b/Intel8080/inc/Disassembler.h index c9d4e9e..11d9cdc 100644 --- a/Intel8080/inc/Disassembler.h +++ b/Intel8080/inc/Disassembler.h @@ -14,7 +14,7 @@ namespace EightBit { static std::string state(Intel8080& cpu); std::string disassemble(Intel8080& cpu); - static std::string flag(uint8_t value, int flag, const std::string& represents); + static std::string flag(uint8_t value, int flag, std::string represents, std::string off = "-"); static std::string flags(uint8_t value); static std::string hex(uint8_t value); static std::string hex(uint16_t value); diff --git a/Intel8080/src/Disassembler.cpp b/Intel8080/src/Disassembler.cpp index 78a6ffa..87d421e 100644 --- a/Intel8080/src/Disassembler.cpp +++ b/Intel8080/src/Disassembler.cpp @@ -339,7 +339,7 @@ void EightBit::Disassembler::disassemble( } break; case 2: // Operate on accumulator and register/memory location - specification = alu(y) + " A," + R(z); + specification = alu(y) + " " + R(z); break; case 3: switch (z) { @@ -426,7 +426,7 @@ void EightBit::Disassembler::disassemble( } break; case 6: // Operate on accumulator and immediate operand: alu[y] n - specification = alu2(y) + " %1$02XH"; + specification = alu2(y) + " %1$02XH"; dumpCount++; break; case 7: // Restart: RST y * 8 @@ -437,9 +437,9 @@ void EightBit::Disassembler::disassemble( } } -std::string EightBit::Disassembler::flag(uint8_t value, int flag, const std::string& represents) { +std::string EightBit::Disassembler::flag(uint8_t value, int flag, std::string represents, std::string off) { std::ostringstream output; - output << (value & flag ? represents : "-"); + output << (value & flag ? represents : off); return output.str(); } @@ -448,11 +448,11 @@ std::string EightBit::Disassembler::flags(uint8_t value) { output << flag(value, Intel8080::SF, "S") << flag(value, Intel8080::ZF, "Z") - << flag(value, Processor::Bit5, "5") + << flag(value, Processor::Bit5, "1", "0") << flag(value, Intel8080::AC, "A") - << flag(value, Processor::Bit3, "3") + << flag(value, Processor::Bit3, "1", "0") << flag(value, Intel8080::PF, "P") - << flag(value, Processor::Bit1, "1") + << flag(value, Processor::Bit1, "1", "0") << flag(value, Intel8080::CF, "C"); return output.str(); } diff --git a/Intel8080/src/Intel8080.cpp b/Intel8080/src/Intel8080.cpp index 9c29a39..06068f0 100644 --- a/Intel8080/src/Intel8080.cpp +++ b/Intel8080/src/Intel8080.cpp @@ -14,6 +14,7 @@ EightBit::Intel8080::Intel8080(Memory& memory, InputOutput& ports) void EightBit::Intel8080::initialise() { IntelProcessor::initialise(); AF().word = BC().word = DE().word = HL().word = 0; + adjustReservedFlags(); } #pragma region Interrupt routines