mirror of
https://github.com/lefticus/6502-cpp.git
synced 2025-10-27 01:16:23 +00:00
Faster 16bit increment for index operations
This commit is contained in:
@@ -315,14 +315,12 @@ void subtract_16_bit(const Personality &personality,
|
|||||||
|
|
||||||
void increment_16_bit(const Personality &personality, std::vector<mos6502> &instructions, int reg)
|
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));
|
std::string skip_high_byte_label =
|
||||||
instructions.emplace_back(mos6502::OpCode::lda, personality.get_register(reg));
|
"skip_inc_high_byte_" + std::to_string(instructions.size());
|
||||||
instructions.emplace_back(mos6502::OpCode::clc);
|
instructions.emplace_back(mos6502::OpCode::inc, personality.get_register(reg));
|
||||||
instructions.emplace_back(mos6502::OpCode::adc, Operand(Operand::Type::literal, "#1"));
|
instructions.emplace_back(mos6502::OpCode::bne, Operand(Operand::Type::literal, skip_high_byte_label));
|
||||||
instructions.emplace_back(mos6502::OpCode::sta, personality.get_register(reg));
|
instructions.emplace_back(mos6502::OpCode::inc, personality.get_register(reg+1));
|
||||||
instructions.emplace_back(mos6502::OpCode::lda, personality.get_register(reg + 1));
|
instructions.emplace_back(ASMLine::Type::Label, skip_high_byte_label);
|
||||||
instructions.emplace_back(mos6502::OpCode::adc, Operand(Operand::Type::literal, "#0"));
|
|
||||||
instructions.emplace_back(mos6502::OpCode::sta, personality.get_register(reg + 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void translate_instruction(const Personality &personality,
|
void translate_instruction(const Personality &personality,
|
||||||
|
|||||||
Reference in New Issue
Block a user