#include <cpu.h>
Public Types | |
enum class | AccessType { Control , Data } |
Public Member Functions | |
Cpu (Memory &mem) | |
void | Reset (bool hard=false) |
auto & | callbacks () |
const auto & | callbacks () const |
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 () |
debug::DisassemblyViewer & | disassembly_viewer () |
const debug::DisassemblyViewer & | disassembly_viewer () const |
void | set_int_delay (bool delay) |
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) |
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) |
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 | 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 | Immediate (bool index_size=false) |
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 () |
bool | stopped () const |
Public Attributes | |
std::vector< uint32_t > | breakpoints_ |
std::function< bool(uint32_t pc)> | on_breakpoint_hit_ |
std::function< void(uint32_t address, uint8_t opcode, const std::vector< uint8_t > &operands, const std::string &mnemonic, const std::string &operand_str)> | on_instruction_executed_ |
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 | status = 0b00110000 |
debug::DisassemblyViewer * | disassembly_viewer_ = nullptr |
uint8_t | E = 1 |
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 | 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 |
Memory & | memory |
CpuCallbacks | callbacks_ |
|
strong |
void yaze::emu::Cpu::Reset | ( | bool | hard = false | ) |
Definition at line 32 of file cpu.cc.
References A, D, DB, E, int_delay_, int_wanted_, irq_wanted_, nmi_wanted_, PB, PC, reset_wanted_, status, stopped_, waiting_, X, and Y.
Referenced by yaze::emu::Snes::Reset().
|
inline |
|
inline |
Definition at line 43 of file cpu.h.
References callbacks_.
void yaze::emu::Cpu::RunOpcode | ( | ) |
Definition at line 54 of file cpu.cc.
References A, callbacks_, CheckInt(), DoInterrupt(), E, ExecuteInstruction(), GetInterruptFlag(), yaze::emu::CpuCallbacks::idle, int_wanted_, irq_wanted_, LOG_DEBUG, LOG_INFO, nmi_wanted_, on_breakpoint_hit_, PB, PC, yaze::emu::CpuCallbacks::read_byte, ReadByte(), ReadOpcode(), reset_wanted_, SetDecimalFlag(), SetFlags(), SetInterruptFlag(), SetSP(), SP(), status, stopped_, waiting_, X, and Y.
Referenced by yaze::emu::Snes::RunFrame().
void yaze::emu::Cpu::ExecuteInstruction | ( | uint8_t | opcode | ) |
Definition at line 250 of file cpu.cc.
References A, Absolute(), Adc(), AdrAbl(), AdrAbx(), AdrAby(), AdrAlx(), AdrDp(), AdrDpx(), AdrDpy(), AdrIdl(), AdrIdp(), AdrIdx(), AdrIdy(), AdrIly(), AdrImp(), AdrIsy(), AdrSr(), And(), Asl(), Bit(), callbacks_, CheckInt(), Cmp(), Cpx(), Cpy(), D, DB, Dec(), DoBranch(), E, Eor(), GetAccumulatorSize(), GetCarryFlag(), GetIndexSize(), GetNegativeFlag(), GetOverflowFlag(), GetZeroFlag(), yaze::emu::CpuCallbacks::idle, Immediate(), Inc(), Lda(), Ldx(), Ldy(), LOG_DEBUG, LogInstructions(), Lsr(), ORA(), PB, PC, PopByte(), PopWord(), PushByte(), PushWord(), ReadByte(), ReadOpcode(), ReadOpcodeWord(), ReadWord(), Rol(), Ror(), Sbc(), SetCarryFlag(), SetDecimalFlag(), SetFlags(), SetInterruptFlag(), SetOverflowFlag(), SetSP(), SetZeroFlag(), SetZN(), SP(), Sta(), status, stopped_, Stx(), Sty(), Stz(), Trb(), Tsb(), waiting_, WriteByte(), X, and Y.
Referenced by RunOpcode().
void yaze::emu::Cpu::LogInstructions | ( | uint16_t | PC, |
uint8_t | opcode, | ||
uint16_t | operand, | ||
bool | immediate, | ||
bool | accumulator_mode | ||
) |
Definition at line 1964 of file cpu.cc.
References on_instruction_executed_, opcode_to_mnemonic, PB, and PC.
Referenced by ExecuteInstruction().
|
inline |
Definition at line 51 of file cpu.h.
References irq_wanted_.
Referenced by yaze::emu::Snes::ReadReg(), yaze::emu::Snes::RunCycle(), and yaze::emu::Snes::WriteReg().
|
inline |
Definition at line 52 of file cpu.h.
References nmi_wanted_.
Referenced by yaze::emu::Snes::RunCycle(), and yaze::emu::Snes::WriteReg().
debug::DisassemblyViewer & yaze::emu::Cpu::disassembly_viewer | ( | ) |
Definition at line 18 of file cpu.cc.
References disassembly_viewer_.
const debug::DisassemblyViewer & yaze::emu::Cpu::disassembly_viewer | ( | ) | const |
Definition at line 25 of file cpu.cc.
References disassembly_viewer_.
|
inline |
Definition at line 79 of file cpu.h.
References int_delay_.
Referenced by yaze::emu::Snes::CpuIdle(), yaze::emu::Snes::CpuRead(), yaze::emu::Snes::CpuWrite(), and yaze::emu::Snes::WriteReg().
void yaze::emu::Cpu::DoInterrupt | ( | ) |
Definition at line 233 of file cpu.cc.
References callbacks_, yaze::emu::CpuCallbacks::idle, int_wanted_, nmi_wanted_, PB, PC, PushByte(), PushWord(), ReadWord(), SetDecimalFlag(), SetInterruptFlag(), and status.
Referenced by RunOpcode().
|
inline |
Definition at line 112 of file cpu.h.
References E, GetIndexSize(), SetAccumulatorSize(), SetIndexSize(), SetSP(), SP(), status, X, and Y.
Referenced by ExecuteInstruction(), and RunOpcode().
|
inline |
|
inline |
Definition at line 136 of file cpu.h.
References GetAccumulatorSize().
|
inline |
Definition at line 137 of file cpu.h.
References GetIndexSize().
|
inline |
|
inline |
|
inline |
Definition at line 140 of file cpu.h.
References SetFlag().
Referenced by SetFlags().
|
inline |
Definition at line 141 of file cpu.h.
References SetFlag().
Referenced by SetFlags().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 147 of file cpu.h.
References SetFlag().
Referenced by DoInterrupt(), ExecuteInstruction(), and RunOpcode().
|
inline |
Definition at line 148 of file cpu.h.
References SetFlag().
Referenced by DoInterrupt(), ExecuteInstruction(), and RunOpcode().
|
inline |
|
inline |
|
inline |
Definition at line 153 of file cpu.h.
References GetFlag().
Referenced by ExecuteInstruction().
|
inline |
Definition at line 154 of file cpu.h.
References GetFlag().
Referenced by ExecuteInstruction().
|
inline |
|
inline |
|
inline |
Definition at line 157 of file cpu.h.
References GetFlag().
Referenced by CheckInt(), and RunOpcode().
|
inline |
Definition at line 158 of file cpu.h.
References GetFlag().
Referenced by ExecuteInstruction().
|
inline |
|
inline |
Definition at line 163 of file cpu.h.
References PB, PC, and ReadByte().
Referenced by AdrAbl(), AdrAlx(), AdrDp(), AdrDpx(), AdrDpy(), AdrIdl(), AdrIdp(), AdrIdx(), AdrIdy(), AdrIly(), AdrIsy(), AdrSr(), DirectPage(), DirectPageIndexedX(), DirectPageIndexedY(), DirectPageIndirectLong(), DirectPageIndirectLongIndexedY(), DoBranch(), ExecuteInstruction(), ReadOpcodeWord(), RunOpcode(), and StackRelative().
|
inline |
Definition at line 165 of file cpu.h.
References CheckInt(), and ReadOpcode().
Referenced by Absolute(), AdrAbl(), AdrAbx(), AdrAby(), AdrAlx(), and ExecuteInstruction().
|
inline |
Definition at line 172 of file cpu.h.
References callbacks_, and yaze::emu::CpuCallbacks::read_byte.
Referenced by Adc(), AdrIdl(), AdrIly(), AdrImp(), And(), Asl(), Bit(), Cmp(), Cpx(), Cpy(), Dec(), Eor(), ExecuteInstruction(), Inc(), Lda(), Ldx(), Ldy(), Lsr(), ORA(), PopByte(), ReadOpcode(), ReadWord(), ReadWord(), ReadWordLong(), Rol(), Ror(), RunOpcode(), Sbc(), Trb(), and Tsb().
|
inline |
Definition at line 175 of file cpu.h.
References ReadByte().
Referenced by Adc(), AdrIdl(), AdrIdp(), AdrIdx(), AdrIdy(), AdrIly(), AdrIsy(), And(), Asl(), Bit(), Cmp(), Cpx(), Cpy(), Dec(), DoInterrupt(), Eor(), ExecuteInstruction(), Inc(), Lda(), Ldx(), Ldy(), Lsr(), ORA(), Rol(), Ror(), Sbc(), Trb(), and Tsb().
|
inline |
Definition at line 182 of file cpu.h.
References CheckInt(), and ReadByte().
|
inline |
Definition at line 189 of file cpu.h.
References ReadByte().
Referenced by DirectPageIndirectLong(), and DirectPageIndirectLongIndexedY().
|
inline |
|
inline |
|
inline |
Definition at line 212 of file cpu.h.
References callbacks_, and yaze::emu::CpuCallbacks::write_byte.
|
inline |
Definition at line 218 of file cpu.h.
References callbacks_, E, SetSP(), SP(), and yaze::emu::CpuCallbacks::write_byte.
Referenced by DoInterrupt(), ExecuteInstruction(), PushLong(), and PushWord().
|
inline |
Definition at line 223 of file cpu.h.
References CheckInt(), and PushByte().
Referenced by DoInterrupt(), ExecuteInstruction(), and PushLong().
|
inline |
Definition at line 228 of file cpu.h.
References PushByte(), and PushWord().
|
inline |
Definition at line 233 of file cpu.h.
References E, ReadByte(), SetSP(), and SP().
Referenced by ExecuteInstruction(), PopLong(), and PopWord().
|
inline |
Definition at line 238 of file cpu.h.
References CheckInt(), and PopByte().
Referenced by ExecuteInstruction(), and PopLong().
|
inline |
|
inline |
Definition at line 249 of file cpu.h.
References callbacks_, CheckInt(), yaze::emu::CpuCallbacks::idle, PC, and ReadOpcode().
Referenced by ExecuteInstruction().
uint32_t yaze::emu::Cpu::Absolute | ( | uint32_t * | low | ) |
Definition at line 97 of file addressing.cc.
References DB, and ReadOpcodeWord().
Referenced by ExecuteInstruction().
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.
References callbacks_, DB, GetIndexSize(), yaze::emu::CpuCallbacks::idle, ReadOpcodeWord(), and X.
Referenced by ExecuteInstruction().
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.
References callbacks_, DB, GetIndexSize(), yaze::emu::CpuCallbacks::idle, ReadOpcodeWord(), and Y.
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::AdrImp | ( | ) |
Definition at line 6 of file addressing.cc.
References callbacks_, CheckInt(), yaze::emu::CpuCallbacks::idle, int_wanted_, PB, PC, and ReadByte().
Referenced by ExecuteInstruction().
uint32_t yaze::emu::Cpu::AdrIdx | ( | uint32_t * | low | ) |
Definition at line 158 of file addressing.cc.
References callbacks_, D, DB, yaze::emu::CpuCallbacks::idle, ReadOpcode(), ReadWord(), and X.
Referenced by ExecuteInstruction().
uint32_t yaze::emu::Cpu::AdrIdp | ( | uint32_t * | low | ) |
Definition at line 44 of file addressing.cc.
References callbacks_, D, DB, yaze::emu::CpuCallbacks::idle, ReadOpcode(), and ReadWord().
Referenced by ExecuteInstruction().
uint32_t yaze::emu::Cpu::AdrIdy | ( | uint32_t * | low, |
bool | write | ||
) |
Definition at line 52 of file addressing.cc.
References callbacks_, D, DB, GetIndexSize(), yaze::emu::CpuCallbacks::idle, ReadOpcode(), ReadWord(), and Y.
Referenced by ExecuteInstruction().
uint32_t yaze::emu::Cpu::AdrIdl | ( | uint32_t * | low | ) |
Definition at line 63 of file addressing.cc.
References callbacks_, D, yaze::emu::CpuCallbacks::idle, ReadByte(), ReadOpcode(), and ReadWord().
Referenced by ExecuteInstruction().
uint32_t yaze::emu::Cpu::AdrIly | ( | uint32_t * | low | ) |
Definition at line 72 of file addressing.cc.
References callbacks_, D, yaze::emu::CpuCallbacks::idle, ReadByte(), ReadOpcode(), ReadWord(), and Y.
Referenced by ExecuteInstruction().
uint32_t yaze::emu::Cpu::AdrIsy | ( | uint32_t * | low | ) |
Definition at line 88 of file addressing.cc.
References callbacks_, DB, yaze::emu::CpuCallbacks::idle, ReadOpcode(), ReadWord(), SP(), and Y.
Referenced by ExecuteInstruction().
uint32_t yaze::emu::Cpu::Immediate | ( | uint32_t * | low, |
bool | xFlag | ||
) |
Definition at line 18 of file addressing.cc.
References GetAccumulatorSize(), GetIndexSize(), PB, and PC.
Referenced by ExecuteInstruction().
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.
References ReadOpcode(), and ReadOpcodeWord().
Referenced by ExecuteInstruction().
uint32_t yaze::emu::Cpu::AbsoluteLongIndexedX | ( | ) |
uint32_t yaze::emu::Cpu::AdrAlx | ( | uint32_t * | low | ) |
Definition at line 128 of file addressing.cc.
References ReadOpcode(), ReadOpcodeWord(), and X.
Referenced by ExecuteInstruction().
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.
References D, and ReadOpcode().
uint32_t yaze::emu::Cpu::AdrDp | ( | uint32_t * | low | ) |
Definition at line 135 of file addressing.cc.
References callbacks_, D, yaze::emu::CpuCallbacks::idle, and ReadOpcode().
Referenced by ExecuteInstruction().
uint16_t yaze::emu::Cpu::DirectPageIndexedX | ( | ) |
Definition at line 147 of file addressing.cc.
References D, GetAccumulatorSize(), ReadOpcode(), and X.
uint32_t yaze::emu::Cpu::AdrDpx | ( | uint32_t * | low | ) |
Definition at line 28 of file addressing.cc.
References callbacks_, D, yaze::emu::CpuCallbacks::idle, ReadOpcode(), and X.
Referenced by ExecuteInstruction().
uint16_t yaze::emu::Cpu::DirectPageIndexedY | ( | ) |
Definition at line 153 of file addressing.cc.
References ReadOpcode(), and Y.
uint32_t yaze::emu::Cpu::AdrDpy | ( | uint32_t * | low | ) |
Definition at line 36 of file addressing.cc.
References callbacks_, D, yaze::emu::CpuCallbacks::idle, ReadOpcode(), and Y.
Referenced by ExecuteInstruction().
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.
References D, ReadOpcode(), and ReadWordLong().
uint16_t yaze::emu::Cpu::DirectPageIndirectIndexedY | ( | ) |
uint32_t yaze::emu::Cpu::DirectPageIndirectLongIndexedY | ( | ) |
Definition at line 173 of file addressing.cc.
References D, GetAccumulatorSize(), ReadOpcode(), ReadWordLong(), and Y.
uint16_t yaze::emu::Cpu::Immediate | ( | bool | index_size = false | ) |
uint16_t yaze::emu::Cpu::StackRelative | ( | ) |
Definition at line 181 of file addressing.cc.
References ReadOpcode(), and SP().
uint32_t yaze::emu::Cpu::AdrSr | ( | uint32_t * | low | ) |
Definition at line 81 of file addressing.cc.
References callbacks_, yaze::emu::CpuCallbacks::idle, ReadOpcode(), and SP().
Referenced by ExecuteInstruction().
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.
References A, CheckInt(), GetAccumulatorSize(), ReadByte(), ReadWord(), SetNegativeFlag(), and SetZeroFlag().
Referenced by ExecuteInstruction().
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.
References A, CheckInt(), GetAccumulatorSize(), ReadByte(), ReadWord(), and SetZN().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Eor | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 18 of file instructions.cc.
References A, CheckInt(), GetAccumulatorSize(), ReadByte(), ReadWord(), and SetZN().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Adc | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 30 of file instructions.cc.
References A, CheckInt(), GetAccumulatorSize(), GetCarryFlag(), GetDecimalFlag(), ReadByte(), ReadWord(), SetCarryFlag(), SetOverflowFlag(), and SetZN().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Sbc | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 70 of file instructions.cc.
References A, CheckInt(), GetAccumulatorSize(), GetCarryFlag(), GetDecimalFlag(), ReadByte(), ReadWord(), SetCarryFlag(), SetOverflowFlag(), and SetZN().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Cmp | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 114 of file instructions.cc.
References A, CheckInt(), GetAccumulatorSize(), ReadByte(), ReadWord(), SetCarryFlag(), and SetZN().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Cpx | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 129 of file instructions.cc.
References CheckInt(), GetIndexSize(), ReadByte(), ReadWord(), SetCarryFlag(), SetZN(), and X.
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Cpy | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 144 of file instructions.cc.
References CheckInt(), GetIndexSize(), ReadByte(), ReadWord(), SetCarryFlag(), SetZN(), and Y.
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Bit | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 159 of file instructions.cc.
References A, CheckInt(), GetAccumulatorSize(), ReadByte(), ReadWord(), SetNegativeFlag(), SetOverflowFlag(), and SetZeroFlag().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Lda | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 176 of file instructions.cc.
References A, CheckInt(), GetAccumulatorSize(), ReadByte(), ReadWord(), and SetZN().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Ldx | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 186 of file instructions.cc.
References CheckInt(), GetIndexSize(), ReadByte(), ReadWord(), SetZN(), and X.
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Ldy | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 196 of file instructions.cc.
References CheckInt(), GetIndexSize(), ReadByte(), ReadWord(), SetZN(), and Y.
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Sta | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 206 of file instructions.cc.
References A, CheckInt(), GetAccumulatorSize(), WriteByte(), and WriteWord().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Stx | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 215 of file instructions.cc.
References CheckInt(), GetIndexSize(), WriteByte(), WriteWord(), and X.
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Sty | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 224 of file instructions.cc.
References CheckInt(), GetIndexSize(), WriteByte(), WriteWord(), and Y.
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Stz | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 233 of file instructions.cc.
References CheckInt(), GetAccumulatorSize(), WriteByte(), and WriteWord().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Ror | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 242 of file instructions.cc.
References callbacks_, CheckInt(), GetAccumulatorSize(), GetCarryFlag(), yaze::emu::CpuCallbacks::idle, ReadByte(), ReadWord(), SetCarryFlag(), SetZN(), WriteByte(), and WriteWord().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Rol | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 263 of file instructions.cc.
References callbacks_, CheckInt(), GetAccumulatorSize(), GetCarryFlag(), yaze::emu::CpuCallbacks::idle, ReadByte(), ReadWord(), SetCarryFlag(), SetZN(), WriteByte(), and WriteWord().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Lsr | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 280 of file instructions.cc.
References callbacks_, CheckInt(), GetAccumulatorSize(), yaze::emu::CpuCallbacks::idle, ReadByte(), ReadWord(), SetCarryFlag(), SetZN(), WriteByte(), and WriteWord().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Asl | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 299 of file instructions.cc.
References callbacks_, CheckInt(), GetAccumulatorSize(), yaze::emu::CpuCallbacks::idle, ReadByte(), ReadWord(), SetCarryFlag(), SetZN(), WriteByte(), and WriteWord().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Inc | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 316 of file instructions.cc.
References callbacks_, CheckInt(), GetAccumulatorSize(), yaze::emu::CpuCallbacks::idle, ReadByte(), ReadWord(), SetZN(), WriteByte(), and WriteWord().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Dec | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 331 of file instructions.cc.
References callbacks_, CheckInt(), GetAccumulatorSize(), yaze::emu::CpuCallbacks::idle, ReadByte(), ReadWord(), SetZN(), WriteByte(), and WriteWord().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Tsb | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 346 of file instructions.cc.
References A, callbacks_, CheckInt(), GetAccumulatorSize(), yaze::emu::CpuCallbacks::idle, ReadByte(), ReadWord(), SetZeroFlag(), WriteByte(), and WriteWord().
Referenced by ExecuteInstruction().
void yaze::emu::Cpu::Trb | ( | uint32_t | low, |
uint32_t | high | ||
) |
Definition at line 361 of file instructions.cc.
References A, callbacks_, CheckInt(), GetAccumulatorSize(), yaze::emu::CpuCallbacks::idle, ReadByte(), ReadWord(), SetZeroFlag(), WriteByte(), and WriteWord().
Referenced by ExecuteInstruction().
|
inline |
Definition at line 751 of file cpu.h.
References memory, and yaze::emu::Memory::SP().
Referenced by AdrIsy(), AdrSr(), ExecuteInstruction(), PopByte(), PushByte(), RunOpcode(), SetFlags(), and StackRelative().
|
inline |
Definition at line 752 of file cpu.h.
References memory, and yaze::emu::Memory::SetSP().
Referenced by ExecuteInstruction(), PopByte(), PushByte(), RunOpcode(), and SetFlags().
|
inline |
Definition at line 754 of file cpu.h.
References breakpoints_.
|
inline |
Definition at line 758 of file cpu.h.
References breakpoints_.
|
inline |
Definition at line 759 of file cpu.h.
References breakpoints_.
|
inline |
Definition at line 764 of file cpu.h.
References breakpoints_.
|
inline |
Definition at line 768 of file cpu.h.
References breakpoints_.
|
inline |
Definition at line 770 of file cpu.h.
References GetInterruptFlag(), int_delay_, int_wanted_, irq_wanted_, and nmi_wanted_.
Referenced by Adc(), AdrImp(), And(), Asl(), Bit(), Cmp(), Cpx(), Cpy(), Dec(), DoBranch(), Eor(), ExecuteInstruction(), Inc(), Lda(), Ldx(), Ldy(), Lsr(), ORA(), PopWord(), PushWord(), ReadOpcodeWord(), ReadWord(), Rol(), Ror(), RunOpcode(), Sbc(), Sta(), Stx(), Sty(), Stz(), Trb(), Tsb(), and WriteWord().
|
inline |
|
inlineprivate |
Definition at line 782 of file cpu.h.
References GetIndexSize(), SetCarryFlag(), SetNegativeFlag(), and SetZeroFlag().
|
inlineprivate |
Definition at line 799 of file cpu.h.
References status.
Referenced by SetAccumulatorSize(), SetBreakFlag(), SetCarryFlag(), SetDecimalFlag(), SetIndexSize(), SetInterruptFlag(), SetNegativeFlag(), SetOverflowFlag(), and SetZeroFlag().
|
inlineprivate |
Definition at line 807 of file cpu.h.
References status.
Referenced by GetBreakFlag(), GetCarryFlag(), GetDecimalFlag(), GetInterruptFlag(), GetNegativeFlag(), GetOverflowFlag(), and GetZeroFlag().
std::vector<uint32_t> yaze::emu::Cpu::breakpoints_ |
Definition at line 54 of file cpu.h.
Referenced by ClearBreakpoint(), ClearBreakpoints(), GetBreakpoints(), IsBreakpoint(), and SetBreakpoint().
std::function<bool(uint32_t pc)> yaze::emu::Cpu::on_breakpoint_hit_ |
Definition at line 62 of file cpu.h.
Referenced by RunOpcode().
std::function<void(uint32_t address, uint8_t opcode, const std::vector<uint8_t>& operands, const std::string& mnemonic, const std::string& operand_str)> yaze::emu::Cpu::on_instruction_executed_ |
Definition at line 66 of file cpu.h.
Referenced by LogInstructions().
uint16_t yaze::emu::Cpu::A = 0 |
uint16_t yaze::emu::Cpu::X = 0 |
Definition at line 70 of file cpu.h.
Referenced by AdrAbx(), AdrAlx(), AdrDpx(), AdrIdx(), Cpx(), DirectPageIndexedX(), ExecuteInstruction(), Ldx(), Reset(), RunOpcode(), SetFlags(), and Stx().
uint16_t yaze::emu::Cpu::Y = 0 |
Definition at line 71 of file cpu.h.
Referenced by AdrAby(), AdrDpy(), AdrIdy(), AdrIly(), AdrIsy(), Cpy(), DirectPageIndexedY(), DirectPageIndirectLongIndexedY(), ExecuteInstruction(), Ldy(), Reset(), RunOpcode(), SetFlags(), and Sty().
uint16_t yaze::emu::Cpu::D = 0 |
Definition at line 72 of file cpu.h.
Referenced by AdrDp(), AdrDpx(), AdrDpy(), AdrIdl(), AdrIdp(), AdrIdx(), AdrIdy(), AdrIly(), DirectPage(), DirectPageIndexedX(), DirectPageIndirectLong(), DirectPageIndirectLongIndexedY(), ExecuteInstruction(), and Reset().
uint8_t yaze::emu::Cpu::DB = 0 |
uint8_t yaze::emu::Cpu::PB = 0 |
Definition at line 74 of file cpu.h.
Referenced by AdrImp(), DoInterrupt(), ExecuteInstruction(), Immediate(), LogInstructions(), yaze::emu::Snes::ReadBBus(), ReadOpcode(), yaze::emu::Snes::ReadReg(), Reset(), yaze::emu::Snes::Reset(), yaze::emu::Snes::RunFrame(), RunOpcode(), yaze::emu::Snes::WriteBBus(), and yaze::emu::Snes::WriteReg().
uint16_t yaze::emu::Cpu::PC = 0 |
Definition at line 75 of file cpu.h.
Referenced by AdrImp(), DoBranch(), DoInterrupt(), ExecuteInstruction(), Immediate(), LogInstructions(), yaze::emu::Snes::ReadBBus(), ReadOpcode(), yaze::emu::Snes::ReadReg(), Reset(), yaze::emu::Snes::Reset(), yaze::emu::Snes::Rread(), yaze::emu::Snes::RunFrame(), RunOpcode(), yaze::emu::Snes::WriteBBus(), and yaze::emu::Snes::WriteReg().
uint8_t yaze::emu::Cpu::status = 0b00110000 |
Definition at line 76 of file cpu.h.
Referenced by DoInterrupt(), ExecuteInstruction(), GetAccumulatorSize(), GetFlag(), GetIndexSize(), Reset(), RunOpcode(), SetFlag(), and SetFlags().
debug::DisassemblyViewer* yaze::emu::Cpu::disassembly_viewer_ = nullptr |
Definition at line 81 of file cpu.h.
Referenced by disassembly_viewer(), and disassembly_viewer().
uint8_t yaze::emu::Cpu::E = 1 |
Definition at line 98 of file cpu.h.
Referenced by ExecuteInstruction(), PopByte(), PushByte(), Reset(), RunOpcode(), and SetFlags().
|
private |
Definition at line 811 of file cpu.h.
Referenced by ExecuteInstruction(), Reset(), and RunOpcode().
|
private |
Definition at line 812 of file cpu.h.
Referenced by ExecuteInstruction(), Reset(), RunOpcode(), and stopped().
|
private |
Definition at line 814 of file cpu.h.
Referenced by CheckInt(), Reset(), RunOpcode(), and SetIrq().
|
private |
Definition at line 815 of file cpu.h.
Referenced by CheckInt(), DoInterrupt(), Nmi(), Reset(), and RunOpcode().
|
private |
Definition at line 816 of file cpu.h.
Referenced by Reset(), and RunOpcode().
|
private |
Definition at line 817 of file cpu.h.
Referenced by AdrImp(), CheckInt(), DoInterrupt(), Reset(), and RunOpcode().
|
private |
Definition at line 818 of file cpu.h.
Referenced by CheckInt(), Reset(), and set_int_delay().
|
private |
|
private |
Definition at line 821 of file cpu.h.
Referenced by AdrAbx(), AdrAby(), AdrDp(), AdrDpx(), AdrDpy(), AdrIdl(), AdrIdp(), AdrIdx(), AdrIdy(), AdrIly(), AdrImp(), AdrIsy(), AdrSr(), Asl(), callbacks(), callbacks(), Dec(), DoBranch(), DoInterrupt(), ExecuteInstruction(), Inc(), Lsr(), PushByte(), ReadByte(), Rol(), Ror(), RunOpcode(), Trb(), Tsb(), WriteByte(), WriteLong(), and WriteWord().