com.monkeycoder.monkeynes.hardware
Class CpuState

java.lang.Object
  |
  +--com.monkeycoder.monkeynes.hardware.CpuState

public class CpuState
extends Object

This class represents a saved CPU state.

Originally part of the MonkeyNES project.

Author:
David Stephens

Constructor Summary
CpuState()
          Creates a new CpuState where all registers are set to 0.
CpuState(CpuRegister16 inPc, CpuRegister inSp, CpuRegister inAcc, CpuRegister inIx, CpuRegister inIy, CpuRegister inPs)
          Creates a new CpuState where all registers are set to existing registers.
 
Method Summary
 CpuRegister getAccumulator()
          Returns the actual Accumulator (ACC) register
 CpuRegister getProcessorStatus()
          Returns the actual Processor Status (PS) register
 CpuRegister16 getProgramCounter()
          Returns the actual Program Counter (PC) register
 CpuRegister getStackPointer()
          Returns the actual Stack Pointer (SP) register
 CpuRegister getXIndex()
          Returns the actual X-Index (IX) register
 CpuRegister getYIndex()
          Returns the actual Y-Index (IY) register
 void setState(CpuRegister16 inPc, CpuRegister inSp, CpuRegister inAcc, CpuRegister inIx, CpuRegister inIy, CpuRegister inPs)
          Sets all the registers in this CpuState to existing registers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CpuState

public CpuState()
Creates a new CpuState where all registers are set to 0.


CpuState

public CpuState(CpuRegister16 inPc,
                CpuRegister inSp,
                CpuRegister inAcc,
                CpuRegister inIx,
                CpuRegister inIy,
                CpuRegister inPs)
Creates a new CpuState where all registers are set to existing registers.

Parameters:
inPc - The Program Counter (PC) register.
inAcc - The Accumulator (ACC) register.
inIx - The X-Index (IX) register.
inIy - The Y-Index (IY) register.
inPs - The Processor Status (PS) register.
Method Detail

setState

public void setState(CpuRegister16 inPc,
                     CpuRegister inSp,
                     CpuRegister inAcc,
                     CpuRegister inIx,
                     CpuRegister inIy,
                     CpuRegister inPs)
Sets all the registers in this CpuState to existing registers.

Parameters:
inPc - The Program Counter (PC) register.
inAcc - The Accumulator (ACC) register.
inIx - The X-Index (IX) register.
inIy - The Y-Index (IY) register.
inPs - The Processor Status (PS) register.

getProgramCounter

public CpuRegister16 getProgramCounter()
Returns the actual Program Counter (PC) register

Returns:
The Program Counter (PC) register.

getStackPointer

public CpuRegister getStackPointer()
Returns the actual Stack Pointer (SP) register

Returns:
The Stack Pointer (SP) register.

getAccumulator

public CpuRegister getAccumulator()
Returns the actual Accumulator (ACC) register

Returns:
The Accumulator (ACC) register.

getXIndex

public CpuRegister getXIndex()
Returns the actual X-Index (IX) register

Returns:
The X-Index (IX) register.

getYIndex

public CpuRegister getYIndex()
Returns the actual Y-Index (IY) register

Returns:
The Y-Index (IY) register.

getProcessorStatus

public CpuRegister getProcessorStatus()
Returns the actual Processor Status (PS) register

Returns:
The Processor Status (PS) register.