C# Class DotNES.CPU

This is an emulator for the 6502 component of the Ricoh 2A03 microprocessor. Lots of great information is available or http://wiki.nesdev.com/w/index.php/CPU
Show file Open project: brandonpelfrey/dotnes

Public Properties

Property Type Description
nmi bool

Public Methods

Method Description
CPU ( NESConsole console ) : System
coldBoot ( ) : void

Set up the CPU to be in the state it would be after a normal power cycle. Details sampled from physical hardware: http://wiki.nesdev.com/w/index.php/CPU_power_up_state

getPC ( ) : ushort
printCPUState ( ) : void
setFlag ( StatusFlag flag, byte val ) : void
setLoggerEnabled ( bool enable ) : void
step ( ) : int

Execute the next CPU instruction and return the number of cycles used.

warmBoot ( ) : void

Set up the CPU to be in the state it would be after the reset line is held high. (e.g. User presses the RESET button on an NES) Details sampled from physical hardware: http://wiki.nesdev.com/w/index.php/CPU_power_up_state

Private Methods

Method Description
ADC_Absolute ( ) : int
ADC_AbsoluteWithRegister ( ushort registerValue ) : int
ADC_AbsoluteX ( ) : int
ADC_AbsoluteY ( ) : int
ADC_Immediate ( ) : int
ADC_IndirectX ( ) : int
ADC_IndirectY ( ) : int
ADC_ZeroPage ( ) : int
ADC_ZeroPageX ( ) : int
AND_Absolute ( ) : int
AND_AbsoluteWithRegister ( ushort registerValue ) : int
AND_AbsoluteX ( ) : int
AND_AbsoluteY ( ) : int
AND_Immediate ( ) : int
AND_IndirectX ( ) : int
AND_IndirectY ( ) : int
AND_ZeroPage ( ) : int
AND_ZeroPageX ( ) : int
ASL_Absolute ( ) : int
ASL_AbsoluteX ( ) : int
ASL_Accumulator ( ) : int
ASL_ZeroPage ( ) : int
ASL_ZeroPageX ( ) : int
BCC_Relative ( ) : int
BCS_Relative ( ) : int
BEQ_Relative ( ) : int
BIT_Absolute ( ) : int
BIT_ZeroPage ( ) : int
BMI_Relative ( ) : int
BNE_Relative ( ) : int
BPL_Relative ( ) : int
BRK_Implied ( ) : int
BVC_Relative ( ) : int
BVS_Relative ( ) : int
Branch ( bool condition ) : int
CLC_Implicit ( ) : int
CLD_Implicit ( ) : int
CLI_Implicit ( ) : int
CLV_Implicit ( ) : int
CMP_Absolute ( ) : int
CMP_AbsoluteX ( ) : int
CMP_AbsoluteY ( ) : int
CMP_Immeditate ( ) : int
CMP_IndirectX ( ) : int
CMP_IndirectY ( ) : int
CMP_ZeroPage ( ) : int
CMP_ZeroPageX ( ) : int
CMX_Absolute ( ) : int
CMX_Immeditate ( ) : int
CMX_ZeroPage ( ) : int
CPY_Absolute ( ) : int
CPY_Immeditate ( ) : int
CPY_ZeroPage ( ) : int
DEC_Absolute ( ) : int
DEC_AbsoluteX ( ) : int
DEC_ZeroPage ( ) : int
DEC_ZeroPageX ( ) : int
DEX_Implied ( ) : int
DEY_Implied ( ) : int
EOR_Absolute ( ) : int
EOR_AbsoluteWithRegister ( byte registerValue ) : int
EOR_AbsoluteX ( ) : int
EOR_AbsoluteY ( ) : int
EOR_Immediate ( ) : int
EOR_IndirectX ( ) : int
EOR_IndirectY ( ) : int
EOR_ZeroPage ( ) : int
EOR_ZeroPageX ( ) : int
INC_Absolute ( ) : int
INC_AbsoluteX ( ) : int
INC_ZeroPage ( ) : int
INC_ZeroPageX ( ) : int
INX_Implied ( ) : int
INY_Implied ( ) : int
JMP_Absolute ( ) : int
JMP_Indirect ( ) : int
JSR_Absolute ( ) : int
LDA_Absolute ( ) : int
LDA_AbsoluteWithRegister ( byte registerValue ) : int
LDA_AbsoluteX ( ) : int
LDA_AbsoluteY ( ) : int
LDA_Immediate ( ) : int
LDA_IndirectX ( ) : int
LDA_IndirectY ( ) : int
LDA_ZeroPage ( ) : int
LDA_ZeroPageX ( ) : int
LDX_Absolute ( ) : int
LDX_AbsoluteY ( ) : int
LDX_Immediate ( ) : int
LDX_ZeroPage ( ) : int
LDX_ZeroPageY ( ) : int
LDY_Absolute ( ) : int
LDY_AbsoluteX ( ) : int
LDY_Immediate ( ) : int
LDY_ZeroPage ( ) : int
LDY_ZeroPageX ( ) : int
LSR_Absolute ( ) : int
LSR_AbsoluteX ( ) : int
LSR_Accumulator ( ) : int
LSR_ZeroPage ( ) : int
LSR_ZeroPageX ( ) : int
NOP_Implied ( ) : int
ORA_Absolute ( ) : int
ORA_AbsoluteWithRegister ( byte registerValue ) : int
ORA_AbsoluteX ( ) : int
ORA_AbsoluteY ( ) : int
ORA_Immediate ( ) : int
ORA_IndirectX ( ) : int
ORA_IndirectY ( ) : int
ORA_ZeroPage ( ) : int
ORA_ZeroPageX ( ) : int
PHA ( ) : int
PHP ( ) : int
PLA ( ) : int
PLP ( ) : int
ROL_Absolute ( ) : int
ROL_AbsoluteX ( ) : int
ROL_Accumulator ( ) : int
ROL_ZeroPage ( ) : int
ROL_ZeroPageX ( ) : int
ROR_Absolute ( ) : int
ROR_AbsoluteX ( ) : int
ROR_Accumulator ( ) : int
ROR_ZeroPage ( ) : int
ROR_ZeroPageX ( ) : int
RTI_Implied ( ) : int
RTS_Implied ( ) : int
SBC_Absolute ( ) : int
SBC_AbsoluteWithRegister ( byte registerValue ) : int
SBC_AbsoluteX ( ) : int
SBC_AbsoluteY ( ) : int
SBC_Immediate ( ) : int
SBC_IndirectX ( ) : int
SBC_IndirectY ( ) : int
SBC_ZeroPage ( ) : int
SBC_ZeroPageX ( ) : int
SEC_Implicit ( ) : int
SED_Implicit ( ) : int
SEI_Implicit ( ) : int
STA_Absolute ( ) : int
STA_AbsoluteX ( ) : int
STA_AbsoluteY ( ) : int
STA_IndirectX ( ) : int
STA_IndirectY ( ) : int
STA_ZeroPage ( ) : int
STA_ZeroPageX ( ) : int
STX_Absolute ( ) : int
STX_ZeroPage ( ) : int
STX_ZeroPageY ( ) : int
STY_Absolute ( ) : int
STY_ZeroPage ( ) : int
STY_ZeroPageX ( ) : int
TAX ( ) : int
TAY ( ) : int
TSX ( ) : int
TXA ( ) : int
TXS ( ) : int
TYA ( ) : int
argOne ( ) : byte
argOne16 ( ) : ushort
argTwo ( ) : byte
compareValues ( byte registerValue, byte argumentValue ) : void
getFlag ( StatusFlag flag ) : byte
initializeOpCodeTable ( ) : void
jumpToNMIVector ( ) : void
jumpToResetVector ( ) : void
popStack16 ( ) : ushort
popStack8 ( ) : byte
pushStack16 ( ushort val ) : void
pushStack8 ( byte val ) : void
samePage ( ushort addressOne, ushort addressTwo ) : bool
setCarryForResult ( int result ) : void
setNegativeForOperand ( byte operand ) : void
setOverflowForOperands ( byte val1, byte val2, int result ) : void
setZeroForOperand ( byte operand ) : void
stackAddressOf ( byte stackPointer ) : ushort

Method Details

CPU() public method

public CPU ( NESConsole console ) : System
console DotNES.Core.NESConsole
return System

coldBoot() public method

Set up the CPU to be in the state it would be after a normal power cycle. Details sampled from physical hardware: http://wiki.nesdev.com/w/index.php/CPU_power_up_state
public coldBoot ( ) : void
return void

getPC() public method

public getPC ( ) : ushort
return ushort

printCPUState() public method

public printCPUState ( ) : void
return void

setFlag() public method

public setFlag ( StatusFlag flag, byte val ) : void
flag StatusFlag
val byte
return void

setLoggerEnabled() public method

public setLoggerEnabled ( bool enable ) : void
enable bool
return void

step() public method

Execute the next CPU instruction and return the number of cycles used.
public step ( ) : int
return int

warmBoot() public method

Set up the CPU to be in the state it would be after the reset line is held high. (e.g. User presses the RESET button on an NES) Details sampled from physical hardware: http://wiki.nesdev.com/w/index.php/CPU_power_up_state
public warmBoot ( ) : void
return void

Property Details

nmi public property

public bool nmi
return bool