yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::emu::Cpu Class Reference

#include <cpu.h>

Collaboration diagram for yaze::emu::Cpu:

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 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 ()
 
auto mutable_log_instructions () -> bool *
 

Public Attributes

std::vector< uint32_t > breakpoints_
 
std::vector< InstructionEntryinstruction_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_
 
Memorymemory
 

Detailed Description

Definition at line 32 of file cpu.h.

Member Enumeration Documentation

◆ AccessType

enum class yaze::emu::Cpu::AccessType
strong
Enumerator
Control 
Data 

Definition at line 136 of file cpu.h.

Constructor & Destructor Documentation

◆ Cpu()

yaze::emu::Cpu::Cpu ( Memory & mem,
CpuCallbacks & callbacks )
inlineexplicit

Definition at line 34 of file cpu.h.

References callbacks_, and memory.

Member Function Documentation

◆ Reset()

void yaze::emu::Cpu::Reset ( bool hard = false)

Definition at line 15 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.

◆ RunOpcode()

◆ ExecuteInstruction()

◆ LogInstructions()

void yaze::emu::Cpu::LogInstructions ( uint16_t PC,
uint8_t opcode,
uint16_t operand,
bool immediate,
bool accumulator_mode )

Definition at line 1802 of file cpu.cc.

References A, D, DB, yaze::core::FeatureFlags::get(), instruction_log_, opcode_to_mnemonic, PB, PC, SP(), status, X, and Y.

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ SetIrq()

void yaze::emu::Cpu::SetIrq ( bool state)
inline

Definition at line 44 of file cpu.h.

References irq_wanted_.

◆ Nmi()

void yaze::emu::Cpu::Nmi ( )
inline

Definition at line 45 of file cpu.h.

References nmi_wanted_.

◆ DoInterrupt()

void yaze::emu::Cpu::DoInterrupt ( )

Definition at line 87 of file cpu.cc.

References callbacks_, int_wanted_, nmi_wanted_, PB, PC, PushByte(), PushWord(), ReadWord(), SetDecimalFlag(), SetInterruptFlag(), and status.

Referenced by RunOpcode().

◆ SetFlags()

void yaze::emu::Cpu::SetFlags ( uint8_t val)
inline

Definition at line 87 of file cpu.h.

References E, GetIndexSize(), SetAccumulatorSize(), SetIndexSize(), SetSP(), SP(), status, X, and Y.

Referenced by ExecuteInstruction(), and RunOpcode().

◆ SetZN()

void yaze::emu::Cpu::SetZN ( uint16_t value,
bool byte )
inline

Definition at line 100 of file cpu.h.

References SetNegativeFlag(), and SetZeroFlag().

Referenced by Adc(), And(), Asl(), Cmp(), Cpx(), Cpy(), Dec(), Eor(), ExecuteInstruction(), Inc(), Lda(), Ldx(), Ldy(), Lsr(), Rol(), Ror(), and Sbc().

Here is the call graph for this function:

◆ m()

bool yaze::emu::Cpu::m ( )
inline

Definition at line 111 of file cpu.h.

References GetAccumulatorSize().

Here is the call graph for this function:

◆ xf()

bool yaze::emu::Cpu::xf ( )
inline

Definition at line 112 of file cpu.h.

References GetIndexSize().

Here is the call graph for this function:

◆ GetAccumulatorSize()

int yaze::emu::Cpu::GetAccumulatorSize ( ) const
inline

◆ GetIndexSize()

int yaze::emu::Cpu::GetIndexSize ( ) const
inline

Definition at line 114 of file cpu.h.

References status.

Referenced by AdrAbx(), AdrAby(), AdrIdy(), compare(), Cpx(), Cpy(), ExecuteInstruction(), Immediate(), Ldx(), Ldy(), SetFlags(), Stx(), Sty(), and xf().

◆ SetAccumulatorSize()

void yaze::emu::Cpu::SetAccumulatorSize ( bool set)
inline

Definition at line 115 of file cpu.h.

References SetFlag().

Referenced by SetFlags().

Here is the call graph for this function:

◆ SetIndexSize()

void yaze::emu::Cpu::SetIndexSize ( bool set)
inline

Definition at line 116 of file cpu.h.

References SetFlag().

Referenced by SetFlags().

Here is the call graph for this function:

◆ SetNegativeFlag()

void yaze::emu::Cpu::SetNegativeFlag ( bool set)
inline

Definition at line 119 of file cpu.h.

References SetFlag().

Referenced by Bit(), compare(), ORA(), and SetZN().

Here is the call graph for this function:

◆ SetOverflowFlag()

void yaze::emu::Cpu::SetOverflowFlag ( bool set)
inline

Definition at line 120 of file cpu.h.

References SetFlag().

Referenced by Adc(), Bit(), ExecuteInstruction(), and Sbc().

Here is the call graph for this function:

◆ SetBreakFlag()

void yaze::emu::Cpu::SetBreakFlag ( bool set)
inline

Definition at line 121 of file cpu.h.

References SetFlag().

Here is the call graph for this function:

◆ SetDecimalFlag()

void yaze::emu::Cpu::SetDecimalFlag ( bool set)
inline

Definition at line 122 of file cpu.h.

References SetFlag().

Referenced by DoInterrupt(), ExecuteInstruction(), and RunOpcode().

Here is the call graph for this function:

◆ SetInterruptFlag()

void yaze::emu::Cpu::SetInterruptFlag ( bool set)
inline

Definition at line 123 of file cpu.h.

References SetFlag().

Referenced by DoInterrupt(), ExecuteInstruction(), and RunOpcode().

Here is the call graph for this function:

◆ SetZeroFlag()

void yaze::emu::Cpu::SetZeroFlag ( bool set)
inline

Definition at line 124 of file cpu.h.

References SetFlag().

Referenced by Bit(), compare(), ExecuteInstruction(), ORA(), SetZN(), Trb(), and Tsb().

Here is the call graph for this function:

◆ SetCarryFlag()

void yaze::emu::Cpu::SetCarryFlag ( bool set)
inline

Definition at line 125 of file cpu.h.

References SetFlag().

Referenced by Adc(), Asl(), Cmp(), compare(), Cpx(), Cpy(), ExecuteInstruction(), Lsr(), Rol(), Ror(), and Sbc().

Here is the call graph for this function:

◆ GetNegativeFlag()

bool yaze::emu::Cpu::GetNegativeFlag ( ) const
inline

Definition at line 128 of file cpu.h.

References GetFlag().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ GetOverflowFlag()

bool yaze::emu::Cpu::GetOverflowFlag ( ) const
inline

Definition at line 129 of file cpu.h.

References GetFlag().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ GetBreakFlag()

bool yaze::emu::Cpu::GetBreakFlag ( ) const
inline

Definition at line 130 of file cpu.h.

References GetFlag().

Here is the call graph for this function:

◆ GetDecimalFlag()

bool yaze::emu::Cpu::GetDecimalFlag ( ) const
inline

Definition at line 131 of file cpu.h.

References GetFlag().

Referenced by Adc(), and Sbc().

Here is the call graph for this function:

◆ GetInterruptFlag()

bool yaze::emu::Cpu::GetInterruptFlag ( ) const
inline

Definition at line 132 of file cpu.h.

References GetFlag().

Referenced by CheckInt().

Here is the call graph for this function:

◆ GetZeroFlag()

bool yaze::emu::Cpu::GetZeroFlag ( ) const
inline

Definition at line 133 of file cpu.h.

References GetFlag().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ GetCarryFlag()

bool yaze::emu::Cpu::GetCarryFlag ( ) const
inline

Definition at line 134 of file cpu.h.

References GetFlag().

Referenced by Adc(), ExecuteInstruction(), Rol(), Ror(), and Sbc().

Here is the call graph for this function:

◆ ReadOpcode()

uint8_t yaze::emu::Cpu::ReadOpcode ( )
inline

◆ ReadOpcodeWord()

uint16_t yaze::emu::Cpu::ReadOpcodeWord ( bool int_check = false)
inline

Definition at line 140 of file cpu.h.

References CheckInt(), and ReadOpcode().

Referenced by Absolute(), AdrAbl(), AdrAbx(), AdrAby(), AdrAlx(), and ExecuteInstruction().

Here is the call graph for this function:

◆ ReadByte()

uint8_t yaze::emu::Cpu::ReadByte ( uint32_t address)
inline

◆ ReadWord()

uint16_t yaze::emu::Cpu::ReadWord ( uint32_t address,
uint32_t address_high,
bool int_check = false )
inline

Definition at line 148 of file cpu.h.

References CheckInt(), and 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(), RunOpcode(), Sbc(), Trb(), and Tsb().

Here is the call graph for this function:

◆ ReadWordLong()

uint32_t yaze::emu::Cpu::ReadWordLong ( uint32_t address)
inline

Definition at line 155 of file cpu.h.

References ReadByte().

Referenced by DirectPageIndirectLong(), and DirectPageIndirectLongIndexedY().

Here is the call graph for this function:

◆ WriteByte()

void yaze::emu::Cpu::WriteByte ( uint32_t address,
uint8_t value )
inline

Definition at line 162 of file cpu.h.

References callbacks_.

Referenced by Asl(), Dec(), ExecuteInstruction(), Inc(), Lsr(), Rol(), Ror(), Sta(), Stx(), Sty(), Stz(), Trb(), and Tsb().

◆ WriteWord()

void yaze::emu::Cpu::WriteWord ( uint32_t address,
uint32_t address_high,
uint16_t value,
bool reversed = false,
bool int_check = false )
inline

Definition at line 166 of file cpu.h.

References callbacks_, and CheckInt().

Referenced by Asl(), Dec(), Inc(), Lsr(), Rol(), Ror(), Sta(), Stx(), Sty(), Stz(), Trb(), and Tsb().

Here is the call graph for this function:

◆ WriteLong()

void yaze::emu::Cpu::WriteLong ( uint32_t address,
uint32_t value )
inline

Definition at line 178 of file cpu.h.

References callbacks_.

◆ PushByte()

void yaze::emu::Cpu::PushByte ( uint8_t value)
inline

Definition at line 184 of file cpu.h.

References callbacks_, E, SetSP(), and SP().

Referenced by DoInterrupt(), ExecuteInstruction(), PushLong(), and PushWord().

Here is the call graph for this function:

◆ PushWord()

void yaze::emu::Cpu::PushWord ( uint16_t value,
bool int_check = false )
inline

Definition at line 189 of file cpu.h.

References CheckInt(), and PushByte().

Referenced by DoInterrupt(), ExecuteInstruction(), and PushLong().

Here is the call graph for this function:

◆ PushLong()

void yaze::emu::Cpu::PushLong ( uint32_t value)
inline

Definition at line 194 of file cpu.h.

References PushByte(), and PushWord().

Here is the call graph for this function:

◆ PopByte()

uint8_t yaze::emu::Cpu::PopByte ( )
inline

Definition at line 199 of file cpu.h.

References E, ReadByte(), SetSP(), and SP().

Referenced by ExecuteInstruction(), PopLong(), and PopWord().

Here is the call graph for this function:

◆ PopWord()

uint16_t yaze::emu::Cpu::PopWord ( bool int_check = false)
inline

Definition at line 204 of file cpu.h.

References CheckInt(), and PopByte().

Referenced by ExecuteInstruction(), and PopLong().

Here is the call graph for this function:

◆ PopLong()

uint32_t yaze::emu::Cpu::PopLong ( )
inline

Definition at line 209 of file cpu.h.

References PopByte(), and PopWord().

Here is the call graph for this function:

◆ DoBranch()

void yaze::emu::Cpu::DoBranch ( bool check)
inline

Definition at line 215 of file cpu.h.

References callbacks_, CheckInt(), PC, and ReadOpcode().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ set_int_delay()

void yaze::emu::Cpu::set_int_delay ( bool delay)
inline

Definition at line 225 of file cpu.h.

References int_delay_.

◆ Absolute()

uint32_t yaze::emu::Cpu::Absolute ( uint32_t * low)

Definition at line 97 of file addressing.cc.

References DB, and ReadOpcodeWord().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ AbsoluteIndexedX()

uint32_t yaze::emu::Cpu::AbsoluteIndexedX ( )

◆ AdrAbx()

uint32_t yaze::emu::Cpu::AdrAbx ( uint32_t * low,
bool write )

Definition at line 103 of file addressing.cc.

References callbacks_, DB, GetIndexSize(), ReadOpcodeWord(), and X.

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ AbsoluteIndexedY()

uint32_t yaze::emu::Cpu::AbsoluteIndexedY ( )

◆ AdrAby()

uint32_t yaze::emu::Cpu::AdrAby ( uint32_t * low,
bool write )

Definition at line 112 of file addressing.cc.

References callbacks_, DB, GetIndexSize(), ReadOpcodeWord(), and Y.

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ AdrImp()

void yaze::emu::Cpu::AdrImp ( )

Definition at line 6 of file addressing.cc.

References callbacks_, CheckInt(), int_wanted_, PB, PC, and ReadByte().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ AdrIdx()

uint32_t yaze::emu::Cpu::AdrIdx ( uint32_t * low)

Definition at line 158 of file addressing.cc.

References callbacks_, D, DB, ReadOpcode(), ReadWord(), and X.

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ AdrIdp()

uint32_t yaze::emu::Cpu::AdrIdp ( uint32_t * low)

Definition at line 44 of file addressing.cc.

References callbacks_, D, DB, ReadOpcode(), and ReadWord().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ AdrIdy()

uint32_t yaze::emu::Cpu::AdrIdy ( uint32_t * low,
bool write )

Definition at line 52 of file addressing.cc.

References callbacks_, D, DB, GetIndexSize(), ReadOpcode(), ReadWord(), and Y.

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ AdrIdl()

uint32_t yaze::emu::Cpu::AdrIdl ( uint32_t * low)

Definition at line 63 of file addressing.cc.

References callbacks_, D, ReadByte(), ReadOpcode(), and ReadWord().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ AdrIly()

uint32_t yaze::emu::Cpu::AdrIly ( uint32_t * low)

Definition at line 72 of file addressing.cc.

References callbacks_, D, ReadByte(), ReadOpcode(), ReadWord(), and Y.

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ AdrIsy()

uint32_t yaze::emu::Cpu::AdrIsy ( uint32_t * low)

Definition at line 88 of file addressing.cc.

References callbacks_, DB, ReadOpcode(), ReadWord(), SP(), and Y.

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ Immediate() [1/2]

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().

Here is the call graph for this function:

◆ AbsoluteIndexedIndirect()

uint16_t yaze::emu::Cpu::AbsoluteIndexedIndirect ( )

◆ AbsoluteIndirect()

uint16_t yaze::emu::Cpu::AbsoluteIndirect ( )

◆ AbsoluteIndirectLong()

uint32_t yaze::emu::Cpu::AbsoluteIndirectLong ( )

◆ AbsoluteLong()

uint32_t yaze::emu::Cpu::AbsoluteLong ( )

◆ AdrAbl()

uint32_t yaze::emu::Cpu::AdrAbl ( uint32_t * low)

Definition at line 121 of file addressing.cc.

References ReadOpcode(), and ReadOpcodeWord().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ AbsoluteLongIndexedX()

uint32_t yaze::emu::Cpu::AbsoluteLongIndexedX ( )

◆ AdrAlx()

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().

Here is the call graph for this function:

◆ BlockMove()

void yaze::emu::Cpu::BlockMove ( uint16_t source,
uint16_t dest,
uint16_t length )

◆ DirectPage()

uint16_t yaze::emu::Cpu::DirectPage ( )

Definition at line 142 of file addressing.cc.

References D, and ReadOpcode().

Here is the call graph for this function:

◆ AdrDp()

uint32_t yaze::emu::Cpu::AdrDp ( uint32_t * low)

Definition at line 135 of file addressing.cc.

References callbacks_, D, and ReadOpcode().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ DirectPageIndexedX()

uint16_t yaze::emu::Cpu::DirectPageIndexedX ( )

Definition at line 147 of file addressing.cc.

References D, GetAccumulatorSize(), ReadOpcode(), and X.

Here is the call graph for this function:

◆ AdrDpx()

uint32_t yaze::emu::Cpu::AdrDpx ( uint32_t * low)

Definition at line 28 of file addressing.cc.

References callbacks_, D, ReadOpcode(), and X.

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ DirectPageIndexedY()

uint16_t yaze::emu::Cpu::DirectPageIndexedY ( )

Definition at line 153 of file addressing.cc.

References ReadOpcode(), and Y.

Here is the call graph for this function:

◆ AdrDpy()

uint32_t yaze::emu::Cpu::AdrDpy ( uint32_t * low)

Definition at line 36 of file addressing.cc.

References callbacks_, D, ReadOpcode(), and Y.

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ DirectPageIndexedIndirectX()

uint16_t yaze::emu::Cpu::DirectPageIndexedIndirectX ( )

◆ DirectPageIndirect()

uint16_t yaze::emu::Cpu::DirectPageIndirect ( )

◆ DirectPageIndirectLong()

uint32_t yaze::emu::Cpu::DirectPageIndirectLong ( )

Definition at line 167 of file addressing.cc.

References D, ReadOpcode(), and ReadWordLong().

Here is the call graph for this function:

◆ DirectPageIndirectIndexedY()

uint16_t yaze::emu::Cpu::DirectPageIndirectIndexedY ( )

◆ DirectPageIndirectLongIndexedY()

uint32_t yaze::emu::Cpu::DirectPageIndirectLongIndexedY ( )

Definition at line 173 of file addressing.cc.

References D, GetAccumulatorSize(), ReadOpcode(), ReadWordLong(), and Y.

Here is the call graph for this function:

◆ Immediate() [2/2]

uint16_t yaze::emu::Cpu::Immediate ( bool index_size = false)

◆ StackRelative()

uint16_t yaze::emu::Cpu::StackRelative ( )

Definition at line 181 of file addressing.cc.

References ReadOpcode(), and SP().

Here is the call graph for this function:

◆ AdrSr()

uint32_t yaze::emu::Cpu::AdrSr ( uint32_t * low)

Definition at line 81 of file addressing.cc.

References callbacks_, ReadOpcode(), and SP().

Referenced by ExecuteInstruction().

Here is the call graph for this function:

◆ StackRelativeIndirectIndexedY()

uint32_t yaze::emu::Cpu::StackRelativeIndirectIndexedY ( )

◆ ADC()

void yaze::emu::Cpu::ADC ( uint16_t operand)

◆ AND()

void yaze::emu::Cpu::AND ( uint32_t address,
bool immediate = false )

◆ ANDAbsoluteLong()

void yaze::emu::Cpu::ANDAbsoluteLong ( uint32_t address)

◆ ASL()

void yaze::emu::Cpu::ASL ( uint16_t address)

◆ BCC()

void yaze::emu::Cpu::BCC ( int8_t offset)

◆ BCS()

void yaze::emu::Cpu::BCS ( int8_t offset)

◆ BEQ()

void yaze::emu::Cpu::BEQ ( int8_t offset)

◆ BIT()

void yaze::emu::Cpu::BIT ( uint16_t address)

◆ BMI()

void yaze::emu::Cpu::BMI ( int8_t offset)

◆ BNE()

void yaze::emu::Cpu::BNE ( int8_t offset)

◆ BPL()

void yaze::emu::Cpu::BPL ( int8_t offset)

◆ BRA()

void yaze::emu::Cpu::BRA ( int8_t offset)

◆ BRK()

void yaze::emu::Cpu::BRK ( )

◆ BRL()

void yaze::emu::Cpu::BRL ( int16_t offset)

◆ BVC()

void yaze::emu::Cpu::BVC ( int8_t offset)

◆ BVS()

void yaze::emu::Cpu::BVS ( int8_t offset)

◆ CLC()

void yaze::emu::Cpu::CLC ( )

◆ CLD()

void yaze::emu::Cpu::CLD ( )

◆ CLI()

void yaze::emu::Cpu::CLI ( )

◆ CLV()

void yaze::emu::Cpu::CLV ( )

◆ CMP()

void yaze::emu::Cpu::CMP ( uint32_t address,
bool immediate = false )

◆ COP()

void yaze::emu::Cpu::COP ( )

◆ CPX()

void yaze::emu::Cpu::CPX ( uint32_t address,
bool immediate = false )

◆ CPY()

void yaze::emu::Cpu::CPY ( uint32_t address,
bool immediate = false )

◆ DEC()

void yaze::emu::Cpu::DEC ( uint32_t address,
bool accumulator = false )

◆ DEX()

void yaze::emu::Cpu::DEX ( )

◆ DEY()

void yaze::emu::Cpu::DEY ( )

◆ EOR()

void yaze::emu::Cpu::EOR ( uint32_t address,
bool immediate = false )

◆ INC()

void yaze::emu::Cpu::INC ( uint32_t address,
bool accumulator = false )

◆ INX()

void yaze::emu::Cpu::INX ( )

◆ INY()

void yaze::emu::Cpu::INY ( )

◆ JMP()

void yaze::emu::Cpu::JMP ( uint16_t address)

◆ JML()

void yaze::emu::Cpu::JML ( uint16_t address)

◆ JSR()

void yaze::emu::Cpu::JSR ( uint16_t address)

◆ JSL()

void yaze::emu::Cpu::JSL ( uint16_t address)

◆ LDA()

void yaze::emu::Cpu::LDA ( uint16_t address,
bool immediate = false,
bool direct_page = false,
bool data_bank = false )

◆ LDX()

void yaze::emu::Cpu::LDX ( uint16_t address,
bool immediate = false )

◆ LDY()

void yaze::emu::Cpu::LDY ( uint16_t address,
bool immediate = false )

◆ LSR()

void yaze::emu::Cpu::LSR ( uint16_t address,
bool accumulator = false )

◆ MVN()

void yaze::emu::Cpu::MVN ( )

◆ MVP()

void yaze::emu::Cpu::MVP ( )

◆ NOP()

void yaze::emu::Cpu::NOP ( )

◆ ORA()

void yaze::emu::Cpu::ORA ( uint32_t low,
uint32_t high )

◆ PEA()

void yaze::emu::Cpu::PEA ( )

◆ PEI()

void yaze::emu::Cpu::PEI ( )

◆ PER()

void yaze::emu::Cpu::PER ( )

◆ PHA()

void yaze::emu::Cpu::PHA ( )

◆ PHB()

void yaze::emu::Cpu::PHB ( )

◆ PHD()

void yaze::emu::Cpu::PHD ( )

◆ PHK()

void yaze::emu::Cpu::PHK ( )

◆ PHP()

void yaze::emu::Cpu::PHP ( )

◆ PHX()

void yaze::emu::Cpu::PHX ( )

◆ PHY()

void yaze::emu::Cpu::PHY ( )

◆ PLA()

void yaze::emu::Cpu::PLA ( )

◆ PLB()

void yaze::emu::Cpu::PLB ( )

◆ PLD()

void yaze::emu::Cpu::PLD ( )

◆ PLP()

void yaze::emu::Cpu::PLP ( )

◆ PLX()

void yaze::emu::Cpu::PLX ( )

◆ PLY()

void yaze::emu::Cpu::PLY ( )

◆ REP()

void yaze::emu::Cpu::REP ( )

◆ ROL()

void yaze::emu::Cpu::ROL ( uint32_t address,
bool accumulator = false )

◆ ROR()

void yaze::emu::Cpu::ROR ( uint32_t address,
bool accumulator = false )

◆ RTI()

void yaze::emu::Cpu::RTI ( )

◆ RTL()

void yaze::emu::Cpu::RTL ( )

◆ RTS()

void yaze::emu::Cpu::RTS ( )

◆ SBC()

void yaze::emu::Cpu::SBC ( uint32_t operand,
bool immediate = false )

◆ SEC()

void yaze::emu::Cpu::SEC ( )

◆ SED()

void yaze::emu::Cpu::SED ( )

◆ SEI()

void yaze::emu::Cpu::SEI ( )

◆ SEP()

void yaze::emu::Cpu::SEP ( )

◆ STA()

void yaze::emu::Cpu::STA ( uint32_t address)

◆ STP()

void yaze::emu::Cpu::STP ( )

◆ STX()

void yaze::emu::Cpu::STX ( uint16_t address)

◆ STY()

void yaze::emu::Cpu::STY ( uint16_t address)

◆ STZ()

void yaze::emu::Cpu::STZ ( uint16_t address)

◆ TAX()

void yaze::emu::Cpu::TAX ( )

◆ TAY()

void yaze::emu::Cpu::TAY ( )

◆ TCD()

void yaze::emu::Cpu::TCD ( )

◆ TCS()

void yaze::emu::Cpu::TCS ( )

◆ TDC()

void yaze::emu::Cpu::TDC ( )

◆ TRB()

void yaze::emu::Cpu::TRB ( uint16_t address)

◆ TSB()

void yaze::emu::Cpu::TSB ( uint16_t address)

◆ TSC()

void yaze::emu::Cpu::TSC ( )

◆ TSX()

void yaze::emu::Cpu::TSX ( )

◆ TXA()

void yaze::emu::Cpu::TXA ( )

◆ TXS()

void yaze::emu::Cpu::TXS ( )

◆ TXY()

void yaze::emu::Cpu::TXY ( )

◆ TYA()

void yaze::emu::Cpu::TYA ( )

◆ TYX()

void yaze::emu::Cpu::TYX ( )

◆ WAI()

void yaze::emu::Cpu::WAI ( )

◆ WDM()

void yaze::emu::Cpu::WDM ( )

◆ XBA()

void yaze::emu::Cpu::XBA ( )

◆ XCE()

void yaze::emu::Cpu::XCE ( )

◆ And()

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().

◆ Eor()

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().

◆ Adc()

void yaze::emu::Cpu::Adc ( uint32_t low,
uint32_t high )

◆ Sbc()

void yaze::emu::Cpu::Sbc ( uint32_t low,
uint32_t high )

◆ Cmp()

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().

◆ Cpx()

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().

◆ Cpy()

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().

◆ Bit()

void yaze::emu::Cpu::Bit ( uint32_t low,
uint32_t high )

◆ Lda()

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().

◆ Ldx()

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().

◆ Ldy()

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().

◆ Sta()

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().

Here is the call graph for this function:

◆ Stx()

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().

Here is the call graph for this function:

◆ Sty()

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().

Here is the call graph for this function:

◆ Stz()

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().

Here is the call graph for this function:

◆ Ror()

void yaze::emu::Cpu::Ror ( uint32_t low,
uint32_t high )

◆ Rol()

void yaze::emu::Cpu::Rol ( uint32_t low,
uint32_t high )

◆ Lsr()

void yaze::emu::Cpu::Lsr ( uint32_t low,
uint32_t high )

◆ Asl()

void yaze::emu::Cpu::Asl ( uint32_t low,
uint32_t high )

◆ Inc()

void yaze::emu::Cpu::Inc ( uint32_t low,
uint32_t high )

◆ Dec()

void yaze::emu::Cpu::Dec ( uint32_t low,
uint32_t high )

◆ Tsb()

void yaze::emu::Cpu::Tsb ( uint32_t low,
uint32_t high )

◆ Trb()

void yaze::emu::Cpu::Trb ( uint32_t low,
uint32_t high )

◆ SP()

uint16_t yaze::emu::Cpu::SP ( ) const
inline

◆ SetSP()

void yaze::emu::Cpu::SetSP ( uint16_t value)
inline

Definition at line 719 of file cpu.h.

References memory.

Referenced by ExecuteInstruction(), PopByte(), PushByte(), RunOpcode(), and SetFlags().

◆ IsBreakpoint()

bool yaze::emu::Cpu::IsBreakpoint ( uint32_t address)
inline

Definition at line 721 of file cpu.h.

References breakpoints_.

◆ SetBreakpoint()

void yaze::emu::Cpu::SetBreakpoint ( uint32_t address)
inline

Definition at line 725 of file cpu.h.

References breakpoints_.

◆ ClearBreakpoint()

void yaze::emu::Cpu::ClearBreakpoint ( uint32_t address)
inline

Definition at line 726 of file cpu.h.

References breakpoints_.

◆ ClearBreakpoints()

void yaze::emu::Cpu::ClearBreakpoints ( )
inline

Definition at line 731 of file cpu.h.

References breakpoints_.

◆ GetBreakpoints()

auto yaze::emu::Cpu::GetBreakpoints ( )
inline

Definition at line 735 of file cpu.h.

References breakpoints_.

◆ CheckInt()

void yaze::emu::Cpu::CheckInt ( )
inline

◆ mutable_log_instructions()

auto yaze::emu::Cpu::mutable_log_instructions ( ) -> bool*
inline

Definition at line 743 of file cpu.h.

References log_instructions_.

◆ compare()

void yaze::emu::Cpu::compare ( uint16_t register_value,
uint16_t memory_value )
inlineprivate

Definition at line 746 of file cpu.h.

References GetIndexSize(), SetCarryFlag(), SetNegativeFlag(), and SetZeroFlag().

Here is the call graph for this function:

◆ SetFlag()

void yaze::emu::Cpu::SetFlag ( uint8_t mask,
bool set )
inlineprivate

◆ GetFlag()

bool yaze::emu::Cpu::GetFlag ( uint8_t mask) const
inlineprivate

Member Data Documentation

◆ breakpoints_

std::vector<uint32_t> yaze::emu::Cpu::breakpoints_

Definition at line 47 of file cpu.h.

Referenced by ClearBreakpoint(), ClearBreakpoints(), GetBreakpoints(), IsBreakpoint(), and SetBreakpoint().

◆ instruction_log_

std::vector<InstructionEntry> yaze::emu::Cpu::instruction_log_

Definition at line 48 of file cpu.h.

Referenced by LogInstructions().

◆ A

uint16_t yaze::emu::Cpu::A = 0

Definition at line 65 of file cpu.h.

Referenced by Adc(), And(), Bit(), Cmp(), Eor(), ExecuteInstruction(), Lda(), LogInstructions(), ORA(), Reset(), Sbc(), Sta(), Trb(), and Tsb().

◆ X

uint16_t yaze::emu::Cpu::X = 0

◆ Y

◆ D

◆ DB

uint8_t yaze::emu::Cpu::DB = 0

◆ PB

uint8_t yaze::emu::Cpu::PB = 0

◆ PC

uint16_t yaze::emu::Cpu::PC = 0

◆ E

uint8_t yaze::emu::Cpu::E = 1

Definition at line 72 of file cpu.h.

Referenced by ExecuteInstruction(), PopByte(), PushByte(), Reset(), RunOpcode(), and SetFlags().

◆ status

uint8_t yaze::emu::Cpu::status = 0b00110000

◆ log_instructions_

bool yaze::emu::Cpu::log_instructions_ = false
private

Definition at line 773 of file cpu.h.

Referenced by ExecuteInstruction(), and mutable_log_instructions().

◆ waiting_

bool yaze::emu::Cpu::waiting_ = false
private

Definition at line 775 of file cpu.h.

Referenced by ExecuteInstruction(), Reset(), and RunOpcode().

◆ stopped_

bool yaze::emu::Cpu::stopped_ = false
private

Definition at line 776 of file cpu.h.

Referenced by ExecuteInstruction(), Reset(), and RunOpcode().

◆ irq_wanted_

bool yaze::emu::Cpu::irq_wanted_ = false
private

Definition at line 778 of file cpu.h.

Referenced by CheckInt(), Reset(), RunOpcode(), and SetIrq().

◆ nmi_wanted_

bool yaze::emu::Cpu::nmi_wanted_ = false
private

Definition at line 779 of file cpu.h.

Referenced by CheckInt(), DoInterrupt(), Nmi(), Reset(), and RunOpcode().

◆ reset_wanted_

bool yaze::emu::Cpu::reset_wanted_ = false
private

Definition at line 780 of file cpu.h.

Referenced by Reset(), and RunOpcode().

◆ int_wanted_

bool yaze::emu::Cpu::int_wanted_ = false
private

Definition at line 781 of file cpu.h.

Referenced by AdrImp(), CheckInt(), DoInterrupt(), Reset(), and RunOpcode().

◆ int_delay_

bool yaze::emu::Cpu::int_delay_ = false
private

Definition at line 782 of file cpu.h.

Referenced by CheckInt(), Reset(), and set_int_delay().

◆ callbacks_

◆ memory

Memory& yaze::emu::Cpu::memory
private

Definition at line 785 of file cpu.h.

Referenced by Cpu(), SetSP(), and SP().


The documentation for this class was generated from the following files: