1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2024-12-21 10:30:35 +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;
}
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
instructions.emplace_back(mos6502::OpCode::clc);
// 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::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::sec);
return;
}
case AVR::OpCode::clr: {