1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2025-10-03 09:16:23 +00:00

Start adding command line options, and some formatting fixes

This commit is contained in:
Jason Turner
2021-05-13 22:23:25 -06:00
parent 4cbdae3ffe
commit 28ebf888e3
6 changed files with 227 additions and 170 deletions

View File

@@ -24,7 +24,8 @@ bool optimize(std::vector<mos6502> &instructions)
// it might make sense in the future to only insert these if determined they are needed?
for (size_t op = 10; op < instructions.size(); ++op) {
if (instructions[op].opcode == mos6502::OpCode::lda || instructions[op].opcode == mos6502::OpCode::bcc || instructions[op].opcode == mos6502::OpCode::bcs) {
if (instructions[op - 1].text == "; END remove if next is lda, bcc, bcs") {
if (instructions[op - 1].text == "; END remove if next is lda, bcc, bcs"
|| (instructions[op -2].text == "; END remove if next is lda, bcc, bcs" && instructions[op-1].type == ASMLine::Type::Directive)) {
for (size_t inner_op = op - 1; inner_op > 1; --inner_op) {
instructions[inner_op] = mos6502(ASMLine::Type::Directive,
"; removed unused flag fix-up: " + instructions[inner_op].to_string());