#include <cpu.h>
Public Types | |
enum class | AccessType { Control , Data } |
Public Member Functions | |
Cpu (Memory &mem, CpuCallbacks &callbacks) | |
void | Reset (bool hard=false) |
void | RunOpcode () |
void | ExecuteInstruction (uint8_t opcode) |
void | LogInstructions (uint16_t PC, uint8_t opcode, uint16_t operand, bool immediate, bool accumulator_mode) |
void | SetIrq (bool state) |
void | Nmi () |
void | DoInterrupt () |
void | SetFlags (uint8_t val) |
void | SetZN (uint16_t value, bool byte) |
bool | m () |
bool | xf () |
int | GetAccumulatorSize () const |
int | GetIndexSize () const |
void | SetAccumulatorSize (bool set) |
void | SetIndexSize (bool set) |
void | SetNegativeFlag (bool set) |
void | SetOverflowFlag (bool set) |
void | SetBreakFlag (bool set) |
void | SetDecimalFlag (bool set) |
void | SetInterruptFlag (bool set) |
void | SetZeroFlag (bool set) |
void | SetCarryFlag (bool set) |
bool | GetNegativeFlag () const |
bool | GetOverflowFlag () const |
bool | GetBreakFlag () const |
bool | GetDecimalFlag () const |
bool | GetInterruptFlag () const |
bool | GetZeroFlag () const |
bool | GetCarryFlag () const |
uint8_t | ReadOpcode () |
uint16_t | ReadOpcodeWord (bool int_check=false) |
uint8_t | ReadByte (uint32_t address) |
uint16_t | ReadWord (uint32_t address, uint32_t address_high, bool int_check=false) |
uint32_t | ReadWordLong (uint32_t address) |
void | WriteByte (uint32_t address, uint8_t value) |
void | WriteWord (uint32_t address, uint32_t address_high, uint16_t value, bool reversed=false, bool int_check=false) |
void | WriteLong (uint32_t address, uint32_t value) |
void | PushByte (uint8_t value) |
void | PushWord (uint16_t value, bool int_check=false) |
void | PushLong (uint32_t value) |
uint8_t | PopByte () |
uint16_t | PopWord (bool int_check=false) |
uint32_t | PopLong () |
void | DoBranch (bool check) |
void | set_int_delay (bool delay) |
uint32_t | Absolute (uint32_t *low) |
uint32_t | AbsoluteIndexedX () |
uint32_t | AdrAbx (uint32_t *low, bool write) |
uint32_t | AbsoluteIndexedY () |
uint32_t | AdrAby (uint32_t *low, bool write) |
void | AdrImp () |
uint32_t | AdrIdx (uint32_t *low) |
uint32_t | AdrIdp (uint32_t *low) |
uint32_t | AdrIdy (uint32_t *low, bool write) |
uint32_t | AdrIdl (uint32_t *low) |
uint32_t | AdrIly (uint32_t *low) |
uint32_t | AdrIsy (uint32_t *low) |
uint32_t | Immediate (uint32_t *low, bool xFlag) |
uint16_t | Immediate (bool index_size=false) |
uint16_t | AbsoluteIndexedIndirect () |
uint16_t | AbsoluteIndirect () |
uint32_t | AbsoluteIndirectLong () |
uint32_t | AbsoluteLong () |
uint32_t | AdrAbl (uint32_t *low) |
uint32_t | AbsoluteLongIndexedX () |
uint32_t | AdrAlx (uint32_t *low) |
void | BlockMove (uint16_t source, uint16_t dest, uint16_t length) |
uint16_t | DirectPage () |
uint32_t | AdrDp (uint32_t *low) |
uint16_t | DirectPageIndexedX () |
uint32_t | AdrDpx (uint32_t *low) |
uint16_t | DirectPageIndexedY () |
uint32_t | AdrDpy (uint32_t *low) |
uint16_t | DirectPageIndexedIndirectX () |
uint16_t | DirectPageIndirect () |
uint32_t | DirectPageIndirectLong () |
uint16_t | DirectPageIndirectIndexedY () |
uint32_t | DirectPageIndirectLongIndexedY () |
uint16_t | StackRelative () |
uint32_t | AdrSr (uint32_t *low) |
uint32_t | StackRelativeIndirectIndexedY () |
void | ADC (uint16_t operand) |
void | AND (uint32_t address, bool immediate=false) |
void | ANDAbsoluteLong (uint32_t address) |
void | ASL (uint16_t address) |
void | BCC (int8_t offset) |
void | BCS (int8_t offset) |
void | BEQ (int8_t offset) |
void | BIT (uint16_t address) |
void | BMI (int8_t offset) |
void | BNE (int8_t offset) |
void | BPL (int8_t offset) |
void | BRA (int8_t offset) |
void | BRK () |
void | BRL (int16_t offset) |
void | BVC (int8_t offset) |
void | BVS (int8_t offset) |
void | CLC () |
void | CLD () |
void | CLI () |
void | CLV () |
void | CMP (uint32_t address, bool immediate=false) |
void | COP () |
void | CPX (uint32_t address, bool immediate=false) |
void | CPY (uint32_t address, bool immediate=false) |
void | DEC (uint32_t address, bool accumulator=false) |
void | DEX () |
void | DEY () |
void | EOR (uint32_t address, bool immediate=false) |
void | INC (uint32_t address, bool accumulator=false) |
void | INX () |
void | INY () |
void | JMP (uint16_t address) |
void | JML (uint16_t address) |
void | JSR (uint16_t address) |
void | JSL (uint16_t address) |
void | LDA (uint16_t address, bool immediate=false, bool direct_page=false, bool data_bank=false) |
void | LDX (uint16_t address, bool immediate=false) |
void | LDY (uint16_t address, bool immediate=false) |
void | LSR (uint16_t address, bool accumulator=false) |
void | MVN () |
void | MVP () |
void | NOP () |
void | ORA (uint32_t low, uint32_t high) |
void | PEA () |
void | PEI () |
void | PER () |
void | PHA () |
void | PHB () |
void | PHD () |
void | PHK () |
void | PHP () |
void | PHX () |
void | PHY () |
void | PLA () |
void | PLB () |
void | PLD () |
void | PLP () |
void | PLX () |
void | PLY () |
void | REP () |
void | ROL (uint32_t address, bool accumulator=false) |
void | ROR (uint32_t address, bool accumulator=false) |
void | RTI () |
void | RTL () |
void | RTS () |
void | SBC (uint32_t operand, bool immediate=false) |
void | SEC () |
void | SED () |
void | SEI () |
void | SEP () |
void | STA (uint32_t address) |
void | STP () |
void | STX (uint16_t address) |
void | STY (uint16_t address) |
void | STZ (uint16_t address) |
void | TAX () |
void | TAY () |
void | TCD () |
void | TCS () |
void | TDC () |
void | TRB (uint16_t address) |
void | TSB (uint16_t address) |
void | TSC () |
void | TSX () |
void | TXA () |
void | TXS () |
void | TXY () |
void | TYA () |
void | TYX () |
void | WAI () |
void | WDM () |
void | XBA () |
void | XCE () |
void | And (uint32_t low, uint32_t high) |
void | Eor (uint32_t low, uint32_t high) |
void | Adc (uint32_t low, uint32_t high) |
void | Sbc (uint32_t low, uint32_t high) |
void | Cmp (uint32_t low, uint32_t high) |
void | Cpx (uint32_t low, uint32_t high) |
void | Cpy (uint32_t low, uint32_t high) |
void | Bit (uint32_t low, uint32_t high) |
void | Lda (uint32_t low, uint32_t high) |
void | Ldx (uint32_t low, uint32_t high) |
void | Ldy (uint32_t low, uint32_t high) |
void | Sta (uint32_t low, uint32_t high) |
void | Stx (uint32_t low, uint32_t high) |
void | Sty (uint32_t low, uint32_t high) |
void | Stz (uint32_t low, uint32_t high) |
void | Ror (uint32_t low, uint32_t high) |
void | Rol (uint32_t low, uint32_t high) |
void | Lsr (uint32_t low, uint32_t high) |
void | Asl (uint32_t low, uint32_t high) |
void | Inc (uint32_t low, uint32_t high) |
void | Dec (uint32_t low, uint32_t high) |
void | Tsb (uint32_t low, uint32_t high) |
void | Trb (uint32_t low, uint32_t high) |
uint16_t | SP () const |
void | SetSP (uint16_t value) |
bool | IsBreakpoint (uint32_t address) |
void | SetBreakpoint (uint32_t address) |
void | ClearBreakpoint (uint32_t address) |
void | ClearBreakpoints () |
auto | GetBreakpoints () |
void | CheckInt () |
auto | mutable_log_instructions () -> bool * |
Public Attributes | |
std::vector< uint32_t > | breakpoints_ |
std::vector< InstructionEntry > | instruction_log_ |
uint16_t | A = 0 |
uint16_t | X = 0 |
uint16_t | Y = 0 |
uint16_t | D = 0 |
uint8_t | DB = 0 |
uint8_t | PB = 0 |
uint16_t | PC = 0 |
uint8_t | E = 1 |
uint8_t | status = 0b00110000 |
Private Member Functions | |
void | compare (uint16_t register_value, uint16_t memory_value) |
void | SetFlag (uint8_t mask, bool set) |
bool | GetFlag (uint8_t mask) const |
Private Attributes | |
bool | log_instructions_ = false |
bool | waiting_ = false |
bool | stopped_ = false |
bool | irq_wanted_ = false |
bool | nmi_wanted_ = false |
bool | reset_wanted_ = false |
bool | int_wanted_ = false |
bool | int_delay_ = false |
CpuCallbacks | callbacks_ |
Memory & | memory |
|
strong |
|
inlineexplicit |
void yaze::emu::Cpu::LogInstructions | ( | uint16_t | PC, |
uint8_t | opcode, | ||
uint16_t | operand, | ||
bool | immediate, | ||
bool | accumulator_mode ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
uint32_t yaze::emu::Cpu::Absolute | ( | uint32_t * | low | ) |
Definition at line 97 of file addressing.cc.
uint32_t yaze::emu::Cpu::AbsoluteIndexedX | ( | ) |
uint32_t yaze::emu::Cpu::AdrAbx | ( | uint32_t * | low, |
bool | write ) |
Definition at line 103 of file addressing.cc.
uint32_t yaze::emu::Cpu::AbsoluteIndexedY | ( | ) |
uint32_t yaze::emu::Cpu::AdrAby | ( | uint32_t * | low, |
bool | write ) |
Definition at line 112 of file addressing.cc.
void yaze::emu::Cpu::AdrImp | ( | ) |
Definition at line 6 of file addressing.cc.
uint32_t yaze::emu::Cpu::AdrIdx | ( | uint32_t * | low | ) |
Definition at line 158 of file addressing.cc.
uint32_t yaze::emu::Cpu::AdrIdp | ( | uint32_t * | low | ) |
Definition at line 44 of file addressing.cc.
uint32_t yaze::emu::Cpu::AdrIdy | ( | uint32_t * | low, |
bool | write ) |
Definition at line 52 of file addressing.cc.
uint32_t yaze::emu::Cpu::AdrIdl | ( | uint32_t * | low | ) |
Definition at line 63 of file addressing.cc.
uint32_t yaze::emu::Cpu::AdrIly | ( | uint32_t * | low | ) |
Definition at line 72 of file addressing.cc.
uint32_t yaze::emu::Cpu::AdrIsy | ( | uint32_t * | low | ) |
Definition at line 88 of file addressing.cc.
uint32_t yaze::emu::Cpu::Immediate | ( | uint32_t * | low, |
bool | xFlag ) |
Definition at line 18 of file addressing.cc.
uint16_t yaze::emu::Cpu::Immediate | ( | bool | index_size = false | ) |
uint16_t yaze::emu::Cpu::AbsoluteIndexedIndirect | ( | ) |
uint16_t yaze::emu::Cpu::AbsoluteIndirect | ( | ) |
uint32_t yaze::emu::Cpu::AbsoluteIndirectLong | ( | ) |
uint32_t yaze::emu::Cpu::AbsoluteLong | ( | ) |
uint32_t yaze::emu::Cpu::AdrAbl | ( | uint32_t * | low | ) |
Definition at line 121 of file addressing.cc.
uint32_t yaze::emu::Cpu::AbsoluteLongIndexedX | ( | ) |
uint32_t yaze::emu::Cpu::AdrAlx | ( | uint32_t * | low | ) |
Definition at line 128 of file addressing.cc.
void yaze::emu::Cpu::BlockMove | ( | uint16_t | source, |
uint16_t | dest, | ||
uint16_t | length ) |
uint16_t yaze::emu::Cpu::DirectPage | ( | ) |
Definition at line 142 of file addressing.cc.
uint32_t yaze::emu::Cpu::AdrDp | ( | uint32_t * | low | ) |
Definition at line 135 of file addressing.cc.
uint16_t yaze::emu::Cpu::DirectPageIndexedX | ( | ) |
Definition at line 147 of file addressing.cc.
uint32_t yaze::emu::Cpu::AdrDpx | ( | uint32_t * | low | ) |
Definition at line 28 of file addressing.cc.
uint16_t yaze::emu::Cpu::DirectPageIndexedY | ( | ) |
Definition at line 153 of file addressing.cc.
uint32_t yaze::emu::Cpu::AdrDpy | ( | uint32_t * | low | ) |
Definition at line 36 of file addressing.cc.
uint16_t yaze::emu::Cpu::DirectPageIndexedIndirectX | ( | ) |
uint16_t yaze::emu::Cpu::DirectPageIndirect | ( | ) |
uint32_t yaze::emu::Cpu::DirectPageIndirectLong | ( | ) |
Definition at line 167 of file addressing.cc.
uint16_t yaze::emu::Cpu::DirectPageIndirectIndexedY | ( | ) |
uint32_t yaze::emu::Cpu::DirectPageIndirectLongIndexedY | ( | ) |
Definition at line 173 of file addressing.cc.
uint16_t yaze::emu::Cpu::StackRelative | ( | ) |
Definition at line 181 of file addressing.cc.
uint32_t yaze::emu::Cpu::AdrSr | ( | uint32_t * | low | ) |
Definition at line 81 of file addressing.cc.
uint32_t yaze::emu::Cpu::StackRelativeIndirectIndexedY | ( | ) |
void yaze::emu::Cpu::ADC | ( | uint16_t | operand | ) |
void yaze::emu::Cpu::AND | ( | uint32_t | address, |
bool | immediate = false ) |
void yaze::emu::Cpu::ANDAbsoluteLong | ( | uint32_t | address | ) |
void yaze::emu::Cpu::ASL | ( | uint16_t | address | ) |
void yaze::emu::Cpu::BCC | ( | int8_t | offset | ) |
void yaze::emu::Cpu::BCS | ( | int8_t | offset | ) |
void yaze::emu::Cpu::BEQ | ( | int8_t | offset | ) |
void yaze::emu::Cpu::BIT | ( | uint16_t | address | ) |
void yaze::emu::Cpu::BMI | ( | int8_t | offset | ) |
void yaze::emu::Cpu::BNE | ( | int8_t | offset | ) |
void yaze::emu::Cpu::BPL | ( | int8_t | offset | ) |
void yaze::emu::Cpu::BRA | ( | int8_t | offset | ) |
void yaze::emu::Cpu::BRK | ( | ) |
void yaze::emu::Cpu::BRL | ( | int16_t | offset | ) |
void yaze::emu::Cpu::BVC | ( | int8_t | offset | ) |
void yaze::emu::Cpu::BVS | ( | int8_t | offset | ) |
void yaze::emu::Cpu::CLC | ( | ) |
void yaze::emu::Cpu::CLD | ( | ) |
void yaze::emu::Cpu::CLI | ( | ) |
void yaze::emu::Cpu::CLV | ( | ) |
void yaze::emu::Cpu::CMP | ( | uint32_t | address, |
bool | immediate = false ) |
void yaze::emu::Cpu::COP | ( | ) |
void yaze::emu::Cpu::CPX | ( | uint32_t | address, |
bool | immediate = false ) |
void yaze::emu::Cpu::CPY | ( | uint32_t | address, |
bool | immediate = false ) |
void yaze::emu::Cpu::DEC | ( | uint32_t | address, |
bool | accumulator = false ) |
void yaze::emu::Cpu::DEX | ( | ) |
void yaze::emu::Cpu::DEY | ( | ) |
void yaze::emu::Cpu::EOR | ( | uint32_t | address, |
bool | immediate = false ) |
void yaze::emu::Cpu::INC | ( | uint32_t | address, |
bool | accumulator = false ) |
void yaze::emu::Cpu::INX | ( | ) |
void yaze::emu::Cpu::INY | ( | ) |
void yaze::emu::Cpu::JMP | ( | uint16_t | address | ) |
void yaze::emu::Cpu::JML | ( | uint16_t | address | ) |
void yaze::emu::Cpu::JSR | ( | uint16_t | address | ) |
void yaze::emu::Cpu::JSL | ( | uint16_t | address | ) |
void yaze::emu::Cpu::LDA | ( | uint16_t | address, |
bool | immediate = false, | ||
bool | direct_page = false, | ||
bool | data_bank = false ) |
void yaze::emu::Cpu::LDX | ( | uint16_t | address, |
bool | immediate = false ) |
void yaze::emu::Cpu::LDY | ( | uint16_t | address, |
bool | immediate = false ) |
void yaze::emu::Cpu::LSR | ( | uint16_t | address, |
bool | accumulator = false ) |
void yaze::emu::Cpu::MVN | ( | ) |
void yaze::emu::Cpu::MVP | ( | ) |
void yaze::emu::Cpu::NOP | ( | ) |
void yaze::emu::Cpu::ORA | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 376 of file instructions.cc.
void yaze::emu::Cpu::PEA | ( | ) |
void yaze::emu::Cpu::PEI | ( | ) |
void yaze::emu::Cpu::PER | ( | ) |
void yaze::emu::Cpu::PHA | ( | ) |
void yaze::emu::Cpu::PHB | ( | ) |
void yaze::emu::Cpu::PHD | ( | ) |
void yaze::emu::Cpu::PHK | ( | ) |
void yaze::emu::Cpu::PHP | ( | ) |
void yaze::emu::Cpu::PHX | ( | ) |
void yaze::emu::Cpu::PHY | ( | ) |
void yaze::emu::Cpu::PLA | ( | ) |
void yaze::emu::Cpu::PLB | ( | ) |
void yaze::emu::Cpu::PLD | ( | ) |
void yaze::emu::Cpu::PLP | ( | ) |
void yaze::emu::Cpu::PLX | ( | ) |
void yaze::emu::Cpu::PLY | ( | ) |
void yaze::emu::Cpu::REP | ( | ) |
void yaze::emu::Cpu::ROL | ( | uint32_t | address, |
bool | accumulator = false ) |
void yaze::emu::Cpu::ROR | ( | uint32_t | address, |
bool | accumulator = false ) |
void yaze::emu::Cpu::RTI | ( | ) |
void yaze::emu::Cpu::RTL | ( | ) |
void yaze::emu::Cpu::RTS | ( | ) |
void yaze::emu::Cpu::SBC | ( | uint32_t | operand, |
bool | immediate = false ) |
void yaze::emu::Cpu::SEC | ( | ) |
void yaze::emu::Cpu::SED | ( | ) |
void yaze::emu::Cpu::SEI | ( | ) |
void yaze::emu::Cpu::SEP | ( | ) |
void yaze::emu::Cpu::STA | ( | uint32_t | address | ) |
void yaze::emu::Cpu::STP | ( | ) |
void yaze::emu::Cpu::STX | ( | uint16_t | address | ) |
void yaze::emu::Cpu::STY | ( | uint16_t | address | ) |
void yaze::emu::Cpu::STZ | ( | uint16_t | address | ) |
void yaze::emu::Cpu::TAX | ( | ) |
void yaze::emu::Cpu::TAY | ( | ) |
void yaze::emu::Cpu::TCD | ( | ) |
void yaze::emu::Cpu::TCS | ( | ) |
void yaze::emu::Cpu::TDC | ( | ) |
void yaze::emu::Cpu::TRB | ( | uint16_t | address | ) |
void yaze::emu::Cpu::TSB | ( | uint16_t | address | ) |
void yaze::emu::Cpu::TSC | ( | ) |
void yaze::emu::Cpu::TSX | ( | ) |
void yaze::emu::Cpu::TXA | ( | ) |
void yaze::emu::Cpu::TXS | ( | ) |
void yaze::emu::Cpu::TXY | ( | ) |
void yaze::emu::Cpu::TYA | ( | ) |
void yaze::emu::Cpu::TYX | ( | ) |
void yaze::emu::Cpu::WAI | ( | ) |
void yaze::emu::Cpu::WDM | ( | ) |
void yaze::emu::Cpu::XBA | ( | ) |
void yaze::emu::Cpu::XCE | ( | ) |
void yaze::emu::Cpu::And | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 6 of file instructions.cc.
void yaze::emu::Cpu::Eor | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 18 of file instructions.cc.
void yaze::emu::Cpu::Adc | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 30 of file instructions.cc.
void yaze::emu::Cpu::Sbc | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 70 of file instructions.cc.
void yaze::emu::Cpu::Cmp | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 114 of file instructions.cc.
void yaze::emu::Cpu::Cpx | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 129 of file instructions.cc.
void yaze::emu::Cpu::Cpy | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 144 of file instructions.cc.
void yaze::emu::Cpu::Bit | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 159 of file instructions.cc.
void yaze::emu::Cpu::Lda | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 176 of file instructions.cc.
void yaze::emu::Cpu::Ldx | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 186 of file instructions.cc.
void yaze::emu::Cpu::Ldy | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 196 of file instructions.cc.
void yaze::emu::Cpu::Sta | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 206 of file instructions.cc.
void yaze::emu::Cpu::Stx | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 215 of file instructions.cc.
void yaze::emu::Cpu::Sty | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 224 of file instructions.cc.
void yaze::emu::Cpu::Stz | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 233 of file instructions.cc.
void yaze::emu::Cpu::Ror | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 242 of file instructions.cc.
void yaze::emu::Cpu::Rol | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 263 of file instructions.cc.
void yaze::emu::Cpu::Lsr | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 280 of file instructions.cc.
void yaze::emu::Cpu::Asl | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 299 of file instructions.cc.
void yaze::emu::Cpu::Inc | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 316 of file instructions.cc.
void yaze::emu::Cpu::Dec | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 331 of file instructions.cc.
void yaze::emu::Cpu::Tsb | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 346 of file instructions.cc.
void yaze::emu::Cpu::Trb | ( | uint32_t | low, |
uint32_t | high ) |
Definition at line 361 of file instructions.cc.
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
private |