Correct a couple of small disassembly issues in the 8080 implementation

Signed-off-by: Adrian.Conlon <adrian.conlon@arup.com>
This commit is contained in:
Adrian.Conlon 2017-07-25 14:32:31 +01:00
parent 2ae4e8331e
commit ff21263b97
3 changed files with 9 additions and 8 deletions

View File

@ -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);

View File

@ -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();
}

View File

@ -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