Calling SPL produces a trap via 010

This commit is contained in:
folkert van heusden 2022-03-17 16:27:04 +01:00
parent 010b23284c
commit ca862e4f7f

13
cpu.cpp
View file

@ -134,7 +134,7 @@ void cpu::setPSW_n(const bool v)
void cpu::setPSW_spl(const int v) void cpu::setPSW_spl(const int v)
{ {
psw &= 7 << 5; psw &= 7 << 5;
psw |= (v & 7) << 5; psw |= v << 5;
} }
// GAM = general addressing modes // GAM = general addressing modes
@ -938,6 +938,15 @@ bool cpu::condition_code_operations(const uint16_t instr)
if ((instr & ~7) == 0000230) { // SPLx if ((instr & ~7) == 0000230) { // SPLx
int level = instr & 7; int level = instr & 7;
setPSW_spl(level); setPSW_spl(level);
// trap via vector 010
pushStack(getPSW());
pushStack(getPC());
setPSW(b->readWord(012));
setPC(b->readWord(010));
fprintf(stderr, "SPL%d, new pc: %06o\n", level, getPC());
return true; return true;
} }
@ -1086,6 +1095,8 @@ bool cpu::misc_operations(const uint16_t instr)
void cpu::busError() void cpu::busError()
{ {
fprintf(stderr, "BUS ERROR\n");
// PSW = 177776 // PSW = 177776
// mov @#PSW, -(sp) // mov @#PSW, -(sp)
pushStack(getPSW()); pushStack(getPSW());