1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2024-10-06 11:58:52 +00:00

Faster 16bit increment for index operations

This commit is contained in:
Jason Turner 2021-05-21 12:02:48 -06:00
parent af0a07b913
commit a04c937aeb

View File

@ -315,14 +315,12 @@ void subtract_16_bit(const Personality &personality,
void increment_16_bit(const Personality &personality, std::vector<mos6502> &instructions, int reg)
{
// instructions.emplace_back(mos6502::OpCode::sta, Operand(Operand::Type::literal, address_low_byte));
instructions.emplace_back(mos6502::OpCode::lda, personality.get_register(reg));
instructions.emplace_back(mos6502::OpCode::clc);
instructions.emplace_back(mos6502::OpCode::adc, Operand(Operand::Type::literal, "#1"));
instructions.emplace_back(mos6502::OpCode::sta, personality.get_register(reg));
instructions.emplace_back(mos6502::OpCode::lda, personality.get_register(reg + 1));
instructions.emplace_back(mos6502::OpCode::adc, Operand(Operand::Type::literal, "#0"));
instructions.emplace_back(mos6502::OpCode::sta, personality.get_register(reg + 1));
std::string skip_high_byte_label =
"skip_inc_high_byte_" + std::to_string(instructions.size());
instructions.emplace_back(mos6502::OpCode::inc, personality.get_register(reg));
instructions.emplace_back(mos6502::OpCode::bne, Operand(Operand::Type::literal, skip_high_byte_label));
instructions.emplace_back(mos6502::OpCode::inc, personality.get_register(reg+1));
instructions.emplace_back(ASMLine::Type::Label, skip_high_byte_label);
}
void translate_instruction(const Personality &personality,