// // Disassembler6502.hpp // Clock Signal // // Created by Thomas Harte on 10/11/2016. // Copyright © 2016 Thomas Harte. All rights reserved. // #ifndef Disassembler6502_hpp #define Disassembler6502_hpp #include #include #include #include #include #include namespace StaticAnalyser { namespace MOS6502 { struct Instruction { uint16_t address; enum { BRK, JSR, RTI, RTS, JMP, CLC, SEC, CLD, SED, CLI, SEI, CLV, NOP, SLO, RLA, SRE, RRA, ALR, ARR, SAX, LAX, DCP, ISC, ANC, XAA, AXS, AND, EOR, ORA, BIT, ADC, SBC, AHX, SHY, SHX, TAS, LAS, LDA, STA, LDX, STX, LDY, STY, BPL, BMI, BVC, BVS, BCC, BCS, BNE, BEQ, CMP, CPX, CPY, INC, DEC, DEX, DEY, INX, INY, ASL, ROL, LSR, ROR, TAX, TXA, TAY, TYA, TSX, TXS, PLA, PHA, PLP, PHP, KIL } operation; enum { Absolute, AbsoluteX, AbsoluteY, Immediate, Implied, ZeroPage, ZeroPageX, ZeroPageY, Indirect, IndexedIndirectX, IndirectIndexedY, Relative, } addressing_mode; uint16_t operand; }; struct Disassembly { std::map instructions_by_address; std::set outward_calls; std::set internal_calls; std::set external_stores, external_loads, external_modifies; std::set internal_stores, internal_loads, internal_modifies; }; Disassembly Disassemble(const std::vector &memory, const std::function &address_mapper, std::vector entry_points); std::function OffsetMapper(uint16_t start_address); } } #endif /* Disassembler6502_hpp */