de.michab.simulator.mos6502
Class Cia

java.lang.Object
  extended byde.michab.simulator.DefaultChip
      extended byde.michab.simulator.mos6502.Cia
All Implemented Interfaces:
Addressable, Chip

public final class Cia
extends DefaultChip

Represents an instance of the 64's 6526 Complex Input/output Adapter. Represents a facade to the classes implementing the functional components of the chip and is responsible for dispatching the values written into or read from this chip's registers.

Version:
$Revision: 1.19 $
Author:
Michael G. Binz

Constructor Summary
Cia(Cpu6510 cpu, Clock clock)
          Creates a CIA.
 
Method Summary
 void connectPortA(Forwarder listener)
          Connects IO port A to a bus that is written on each internal write operation on that port.
 void connectPortB(Forwarder listener)
          Connects IO port B to a bus that is written on each internal write operation on that port.
 Forwarder getInputPortA()
          Get a writeable reference to port A.
 Forwarder getInputPortB()
          Get a writeable reference to port B.
 Port[] getPorts()
          Get an array of the chip's ports.
 byte read(int portId)
          The central read entry.
 void reset()
          Resets the Chip.
 void write(int portId, byte value)
          This is the common write entry.
 
Methods inherited from class de.michab.simulator.DefaultChip
createPorts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cia

public Cia(Cpu6510 cpu,
           Clock clock)
Creates a CIA. The passed CPU reference is used for interrupt purposes.

Parameters:
cpu - The CPU receiving the interrupts.
Method Detail

connectPortA

public void connectPortA(Forwarder listener)
Connects IO port A to a bus that is written on each internal write operation on that port. Only output lines are written.


connectPortB

public void connectPortB(Forwarder listener)
Connects IO port B to a bus that is written on each internal write operation on that port. Only output lines are written.


getInputPortA

public Forwarder getInputPortA()
Get a writeable reference to port A. The returned forwarder can be connected to bus systems.


getInputPortB

public Forwarder getInputPortB()
Get a writeable reference to port B. The returned forwarder can be connected to bus systems.


read

public byte read(int portId)
The central read entry. Called on each write to one of the internal registers (Ports).

Parameters:
portId - The source address.
Returns:
The byte read.

write

public void write(int portId,
                  byte value)
This is the common write entry.

Parameters:
portId - The port to write.
value - The value to write.

getPorts

public Port[] getPorts()
Description copied from interface: Chip
Get an array of the chip's ports. May return null if this chip does not support ports.

Returns:
An array of the chip's ports.

reset

public void reset()
Resets the Chip.