|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.michab.simulator.DefaultChip de.michab.simulator.mos6502.Cpu6510
Implements a MOS6510 processor as built into the C64. For the implementation the following documentation was used:
Field Summary | |
static int |
IRQ_VECTOR
|
static int |
NMI_VECTOR
|
static int |
RESET_VECTOR
Processor specific constants. |
static int |
STATUS_FLAG_BREAK
|
static int |
STATUS_FLAG_CARRY
|
static int |
STATUS_FLAG_DECIMAL
|
static int |
STATUS_FLAG_INTERRUPT
|
static int |
STATUS_FLAG_NEGATIVE
|
static int |
STATUS_FLAG_OVERFLOW
|
static int |
STATUS_FLAG_ZERO
|
Fields inherited from interface de.michab.simulator.Processor |
BIT_0, BIT_1, BIT_2, BIT_3, BIT_4, BIT_5, BIT_6, BIT_7, BIT_8, DEC_0, DEC_1, DEC_2, DEC_3, DEC_4, DEC_5, DEC_6, DEC_7, DEC_8, DEC_9 |
Constructor Summary | |
Cpu6510(Memory mem,
Clock clock)
Create a processor tied to the passed memory. |
Method Summary | |
int |
getAccu()
Read the accu. |
Memory |
getMemory()
Get the Memory this CPU is attached to. |
int |
getPC()
Read the program counter. |
Port[] |
getPorts()
Get this processors ports. |
byte |
getStatusRegister()
Get our status flags into a byte value. |
int |
getX()
Read the x register. |
int |
getY()
Read the y register. |
void |
IRQ()
Handles the IRQ interrupt. |
boolean |
isStatusFlagSet(int statusEnum)
Test a single status register flag. |
void |
NMI()
Handles the NMI interrupt. |
byte |
read(int i)
Read this processor's ports. |
void |
reset()
Initialises the program counter from the reset vector. |
void |
setAccu(int a)
Sets the accu register. |
void |
setDebugger(Debugger d)
Sets a debugger on this processor instance. |
void |
setPC(int pc)
Set the program counter to a new address. |
void |
setPortListener(int portId,
Forwarder listener)
Sets a listener on the passed port. |
void |
setStatusRegister(byte status)
Set our status flags from a byte value. |
void |
setX(int x)
Sets the x register. |
void |
setY(int y)
Sets the y register. |
void |
stealCycles(int count)
experimental TODO |
java.lang.String |
toString()
Returns a string representation of this processor for debug purposes. |
void |
write(int i,
byte b)
Write this processor's ports. |
Methods inherited from class de.michab.simulator.DefaultChip |
createPorts |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int STATUS_FLAG_CARRY
public static final int STATUS_FLAG_ZERO
public static final int STATUS_FLAG_INTERRUPT
public static final int STATUS_FLAG_DECIMAL
public static final int STATUS_FLAG_BREAK
public static final int STATUS_FLAG_OVERFLOW
public static final int STATUS_FLAG_NEGATIVE
public static final int RESET_VECTOR
public static final int IRQ_VECTOR
public static final int NMI_VECTOR
Constructor Detail |
public Cpu6510(Memory mem, Clock clock)
mem
- The memory to attach to the new processor instance.clock
- A reference to the system clock.Method Detail |
public Memory getMemory()
Memory
this CPU
is attached to.
Memory
this CPU
is attached to.public void write(int i, byte b)
write
in interface Addressable
i
- The port number to write.b
- The value to write.public byte read(int i)
read
in interface Addressable
i
- The port number.
public void setPortListener(int portId, Forwarder listener)
portId
- The port the listener is assigned to.listener
- The listener for the port.public Port[] getPorts()
getPorts
in interface Chip
public int getX()
public void setX(int x)
x
- The new content for the x register.public int getY()
public void setY(int y)
y
- The new value for the y register.public int getAccu()
public void setAccu(int a)
a
- The new value for the accumulator.public void setPC(int pc)
pc
- The new address for the program counter.public int getPC()
public void IRQ()
public void NMI()
public void stealCycles(int count)
count
- public final byte getStatusRegister()
setStatusRegister(byte)
public final void setStatusRegister(byte status)
status
- The new value of the status register.public boolean isStatusFlagSet(int statusEnum)
statusEnum
- One of the status register constants, e.g.
STATUS_FLAG_BREAK.
STATUS_FLAG_BREAK
,
STATUS_FLAG_CARRY
,
STATUS_FLAG_DECIMAL
,
STATUS_FLAG_INTERRUPT
,
STATUS_FLAG_NEGATIVE
,
STATUS_FLAG_OVERFLOW
,
STATUS_FLAG_ZERO
public void reset()
reset
in interface Chip
public java.lang.String toString()
public void setDebugger(Debugger d)
null
.
setDebugger
in interface Processor
d
- The debugger to be set.Processor.setDebugger( Debugger )
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |