1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2024-06-28 13:29:30 +00:00

convert sec/sbc with cmp, increase perf

This commit is contained in:
Jason Turner 2021-05-05 17:02:38 -06:00
parent ab9dd4e1b7
commit d39ad32438

View File

@ -1005,8 +1005,7 @@ void translate_instruction(std::vector<mos6502> &instructions, const AVR::OpCode
case AVR::OpCode::cpi: { case AVR::OpCode::cpi: {
// note that this will leave the C flag in the 6502 borrow state, not normal carry state // 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::lda, AVR::get_register(o1_reg_num));
instructions.emplace_back(mos6502::OpCode::sec); instructions.emplace_back(mos6502::OpCode::cmp, Operand(o2.type, fixup_8bit_literal(o2.value)));
instructions.emplace_back(mos6502::OpCode::sbc, Operand(o2.type, fixup_8bit_literal(o2.value)));
return; return;
} }
case AVR::OpCode::brlo: { case AVR::OpCode::brlo: {
@ -1074,6 +1073,7 @@ void translate_instruction(std::vector<mos6502> &instructions, const AVR::OpCode
return; return;
} else { } else {
instructions.emplace_back(mos6502::OpCode::bcs, o1); instructions.emplace_back(mos6502::OpCode::bcs, o1);
return;
} }
} }