1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2025-10-04 00:17:44 +00:00

Add NOP support and allow for unused symbols

This commit is contained in:
Jason Turner
2021-05-19 15:18:44 -06:00
parent f64fa3cce6
commit 49d68fe54c
3 changed files with 18 additions and 9 deletions

View File

@@ -114,6 +114,8 @@ struct AVR : ASMLine
mov,
nop,
out,
pop,
@@ -190,6 +192,7 @@ struct AVR : ASMLine
if (o == "in") { return OpCode::in; }
if (o == "out") { return OpCode::out; }
if (o == "inc") { return OpCode::inc; }
if (o == "nop") { return OpCode::nop; }
}
}
throw std::runtime_error(fmt::format("Unknown opcode: {}", o));
@@ -726,6 +729,10 @@ void translate_instruction(const Personality &personality,
return;
}
}
case AVR::OpCode::nop: {
instructions.emplace_back(mos6502::OpCode::nop);
return;
}
case AVR::OpCode::unknown: {
throw std::runtime_error("Could not translate 'unknown' instruction");
}
@@ -955,8 +962,8 @@ std::vector<mos6502> run(const Personality &personality, std::istream &input)
try {
i.text = new_labels.at(i.text);
} catch (...) {
spdlog::error("Error looking up label name: '{}'", i.text);
throw;
spdlog::warn("Unused label: '{}', consider making function static until we remove unused functions", i.text);
}
}
}