From d39ad32438bded26d4d65b7b81e415b5c709e8b3 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Wed, 5 May 2021 17:02:38 -0600 Subject: [PATCH] convert sec/sbc with cmp, increase perf --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0e0a235..06ab0be 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1005,8 +1005,7 @@ void translate_instruction(std::vector &instructions, const AVR::OpCode case AVR::OpCode::cpi: { // note that this will leave the C flag in the 6502 borrow state, not normal carry state instructions.emplace_back(mos6502::OpCode::lda, AVR::get_register(o1_reg_num)); - instructions.emplace_back(mos6502::OpCode::sec); - instructions.emplace_back(mos6502::OpCode::sbc, Operand(o2.type, fixup_8bit_literal(o2.value))); + instructions.emplace_back(mos6502::OpCode::cmp, Operand(o2.type, fixup_8bit_literal(o2.value))); return; } case AVR::OpCode::brlo: { @@ -1074,6 +1073,7 @@ void translate_instruction(std::vector &instructions, const AVR::OpCode return; } else { instructions.emplace_back(mos6502::OpCode::bcs, o1); + return; } }