fix complement opcode translation

This commit is contained in:
Jason Turner 2021-05-17 13:58:50 -06:00
parent e2b2601705
commit 681e35ba5f
1 changed files with 3 additions and 3 deletions

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: {