From e6d89c425e7e3a6b52c7da4535b0bea003eac443 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Mon, 20 Mar 2023 09:59:22 +0100 Subject: [PATCH] additional instructions are only ^0111 and not ^1111 --- cpu.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/cpu.cpp b/cpu.cpp index 1a11f05..a95c8a6 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -410,7 +410,7 @@ bool cpu::double_operand_instructions(const uint16_t instr) if (operation == 0b000) return single_operand_instructions(instr); - if (operation == 0b111) + if (operation == 0b111 && word_mode == false) return additional_double_operand_instructions(instr); const uint8_t src = (instr >> 6) & 63; @@ -752,19 +752,18 @@ bool cpu::single_operand_instructions(const uint16_t instr) case 0b00000011: { // SWAB if (word_mode) // handled elsewhere return false; - else { - auto g_dst = getGAM(dst_mode, dst_reg, word_mode, false); - uint16_t v = g_dst.value.value(); + auto g_dst = getGAM(dst_mode, dst_reg, word_mode, false); - v = ((v & 0xff) << 8) | (v >> 8); + uint16_t v = g_dst.value.value(); - set_flags = putGAM(g_dst, v); + v = ((v & 0xff) << 8) | (v >> 8); - if (set_flags) { - setPSW_flags_nzv(v, true); - setPSW_c(false); - } + set_flags = putGAM(g_dst, v); + + if (set_flags) { + setPSW_flags_nzv(v, true); + setPSW_c(false); } break; @@ -1837,7 +1836,7 @@ std::map > cpu::disassemble(const uint16_t if (text.empty() == false && next_word != -1) instruction_words.push_back(next_word); } - else if (do_opcode == 0b111) { + else if (do_opcode == 0b111 && word_mode == false) { std::string src_text = format("R%d", (instruction >> 6) & 7); auto dst_text { addressing_to_string(dst_register, (addr + 2) & 65535, word_mode) };