From 96d49461946a5ddc97ca754fdc455f9424575346 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Thu, 4 Apr 2024 22:29:16 +0200 Subject: [PATCH] SBC flag fix --- cpu.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cpu.cpp b/cpu.cpp index d2a591a..bbf2b81 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -1048,11 +1048,7 @@ bool cpu::single_operand_instructions(const uint16_t instr) setPSW_n(SIGN(v, word_mode)); setPSW_z(IS_0(v, word_mode)); setPSW_v((word_mode == wm_byte ? (vo & 0xff) == 0x80 : vo == 0x8000) && org_c); - - if (IS_0(vo, word_mode) && org_c) - setPSW_c(true); - else - setPSW_c(false); + setPSW_c(IS_0(vo, word_mode) && org_c); setRegister(dst_reg, v); } @@ -1069,8 +1065,7 @@ bool cpu::single_operand_instructions(const uint16_t instr) if (set_flags) { setPSW_n(SIGN(v, word_mode)); setPSW_z(IS_0(v, word_mode)); - setPSW_v(word_mode == wm_byte ? (vo & 0xff) == 0x80 : vo == 0x8000); - + setPSW_v((word_mode == wm_byte ? (vo & 0xff) == 0x80 : vo == 0x8000) && org_c); setPSW_c(IS_0(vo, word_mode) && org_c); } }