From ca862e4f7fd60978c3685562af4abb160784f88d Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Thu, 17 Mar 2022 16:27:04 +0100 Subject: [PATCH] Calling SPL produces a trap via 010 --- cpu.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cpu.cpp b/cpu.cpp index 26e6658..1366b89 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -134,7 +134,7 @@ void cpu::setPSW_n(const bool v) void cpu::setPSW_spl(const int v) { psw &= 7 << 5; - psw |= (v & 7) << 5; + psw |= v << 5; } // GAM = general addressing modes @@ -938,6 +938,15 @@ bool cpu::condition_code_operations(const uint16_t instr) if ((instr & ~7) == 0000230) { // SPLx int level = instr & 7; 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; } @@ -1086,6 +1095,8 @@ bool cpu::misc_operations(const uint16_t instr) void cpu::busError() { + fprintf(stderr, "BUS ERROR\n"); + // PSW = 177776 // mov @#PSW, -(sp) pushStack(getPSW());