debug log new PC address after trap

This commit is contained in:
Folkert van Heusden 2022-03-19 09:03:17 +01:00
parent 5ac576a0ac
commit b3fd4994a8

16
cpu.cpp
View file

@ -1104,18 +1104,18 @@ void cpu::busError()
{
fprintf(stderr, "BUS ERROR\n");
// PSW = 177776
// mov @#PSW, -(sp)
pushStack(getPSW());
trap(4);
}
// mov pc, -(sp)
void cpu::trap(const uint16_t vector)
{
pushStack(getPSW());
pushStack(getPC());
// mov @#VEC+2, @#PSW
setPSW(b -> readWord(6));
setPSW(b->readWord(vector + 2));
setPC (b->readWord(vector + 0));
// mov @#VEC, pc
setPC(b -> readWord(4));
fprintf(stderr, "TRAP %o: PC is now %06o\n", vector, getPC());
}
std::pair<std::string, int> cpu::addressing_to_string(const uint8_t mode_register, const uint16_t pc)