1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2025-01-02 12:30:58 +00:00

fix complement opcode translation

This commit is contained in:
Jason Turner 2021-05-17 13:58:50 -06:00
parent e2b2601705
commit 681e35ba5f

View File

@ -586,11 +586,11 @@ void translate_instruction(const Personality &personality,
return; return;
} }
case AVR::OpCode::com: { case AVR::OpCode::com: {
// We're doing this in the same way the AVR does it, to make sure the C flag is set properly // We're doing this in the same way the AVR does it, to make sure the C flag is set properly, it expects C to be set
instructions.emplace_back(mos6502::OpCode::clc);
instructions.emplace_back(mos6502::OpCode::lda, Operand(Operand::Type::literal, "#$FF")); instructions.emplace_back(mos6502::OpCode::lda, Operand(Operand::Type::literal, "#$FF"));
instructions.emplace_back(mos6502::OpCode::sbc, personality.get_register(o1_reg_num)); instructions.emplace_back(mos6502::OpCode::eor, personality.get_register(o1_reg_num));
instructions.emplace_back(mos6502::OpCode::sta, personality.get_register(o1_reg_num)); instructions.emplace_back(mos6502::OpCode::sta, personality.get_register(o1_reg_num));
instructions.emplace_back(mos6502::OpCode::sec);
return; return;
} }
case AVR::OpCode::clr: { case AVR::OpCode::clr: {