From 9a24625b355d0d413891efc4b72069d13bb5e55d Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sun, 20 Mar 2022 21:52:22 +0100 Subject: [PATCH] micro-opt, helpful comments, trap 10 when unknown instruction --- cpu.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cpu.cpp b/cpu.cpp index 24ed396..5638850 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -313,7 +313,7 @@ bool cpu::double_operand_instructions(const uint16_t instr) uint16_t src_value = getGAM(src_mode, src_reg, word_mode, false); if (word_mode) { if (dst_mode == 0) - setRegister(dst_reg, false, int8_t(src_value)); + setRegister(dst_reg, false, int8_t(src_value)); // int8_t: sign extension else putGAM(dst_mode, dst_reg, word_mode, src_value, false); } @@ -903,7 +903,7 @@ bool cpu::single_operand_instructions(const uint16_t instr) else { // SXT uint16_t a = getGAMAddress(dst_mode, dst_reg, word_mode, false); - int32_t vl = getPSW_n() ? -1 : 0; + int32_t vl = -getPSW_n(); setPSW_z(getPSW_n() == false); setPSW_v(false); @@ -954,7 +954,7 @@ bool cpu::conditional_branch_instructions(const uint16_t instr) break; case 0b00000111: // BLE - take = getPSW_n() != getPSW_v() | getPSW_z(); + take = getPSW_n() != getPSW_v() || getPSW_z(); break; case 0b10000000: // BPL @@ -970,7 +970,7 @@ bool cpu::conditional_branch_instructions(const uint16_t instr) break; case 0b10000011: // BLOS - take = getPSW_c() | getPSW_z(); + take = getPSW_c() || getPSW_z(); break; case 0b10000100: // BVC @@ -1600,5 +1600,7 @@ void cpu::step() } } + trap(010); + *event = 1; }