mirror of
https://github.com/lefticus/6502-cpp.git
synced 2024-10-06 11:58:52 +00:00
Add AVR tst opcode
This commit is contained in:
parent
5b6bfd138d
commit
5b764ad179
@ -140,6 +140,8 @@ struct AVR : ASMLine
|
||||
sub,
|
||||
subi,
|
||||
swap,
|
||||
|
||||
tst,
|
||||
};
|
||||
|
||||
[[nodiscard]] static constexpr OpCode parse_opcode(Type t, std::string_view o)
|
||||
@ -196,6 +198,7 @@ struct AVR : ASMLine
|
||||
if (o == "inc") { return OpCode::inc; }
|
||||
if (o == "nop") { return OpCode::nop; }
|
||||
if (o == "jmp") { return OpCode::jmp; }
|
||||
if (o == "tst") { return OpCode::tst; }
|
||||
}
|
||||
}
|
||||
throw std::runtime_error(fmt::format("Unknown opcode: {}", o));
|
||||
@ -347,7 +350,14 @@ void translate_instruction(const Personality &personality,
|
||||
|
||||
switch (op) {
|
||||
case AVR::OpCode::jmp: instructions.emplace_back(mos6502::OpCode::jmp, o1); return;
|
||||
case AVR::OpCode::tst: {
|
||||
// just an lda will set the relevant flags that the tst operation sets, so I think this is
|
||||
// sufficient
|
||||
instructions.emplace_back(mos6502::OpCode::lda, personality.get_register(o1_reg_num));
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
case AVR::OpCode::dec: instructions.emplace_back(mos6502::OpCode::dec, personality.get_register(o1_reg_num)); return;
|
||||
case AVR::OpCode::ldi:
|
||||
instructions.emplace_back(mos6502::OpCode::lda, Operand(o2.type, fixup_8bit_literal(o2.value)));
|
||||
|
Loading…
Reference in New Issue
Block a user