jmce - 1_02

jmce.mos
Class VIC6561

java.lang.Object
  extended by jmce.sim.AbstractHardware
      extended by jmce.sim.AbstractPeripheral
          extended by jmce.mos.VIC6561
All Implemented Interfaces:
CycleListener, Hardware, MemoryReadListener, MemoryWriteListener, Peripheral, SwingHardware
Direct Known Subclasses:
VIC6561

public class VIC6561
extends AbstractPeripheral
implements MemoryWriteListener, MemoryReadListener, SwingHardware, CycleListener

VIC6561

Video Interface controller based over MOS 6561.

Register

The VIC6561 use 16 consecutive memory location mapped to the register CRx from 0 to F.

 00 - Control register 00
        BIT 7   Interlaced
        BIT 6-0 Screen origin X - Coordinate
        
 01 - Control register 01
        Screen origin Y - Coordinate
        
 02 - Control register 02
        Bit 7   Bit 9 of video/colour ram address.
        Bit 6-0 Number of columns
        
 03 - Control register 03
        Bit 7   User for light pen
        Bit 6-1 Number of rows
        Bit 0   Font size 0=8x8 , 1=8x16
        
 0A - Control register 0A
        Frequence channel 0 x 16
        
 0B - Control register 0B
        Frequence channel 1 x 8
        
 0C - Control register 0C
        Frequence channel 2 x 4
        
 0D - Control register 0D
        Frequence noise generator x 16
        
 0E - Control register 0E
        Volume 0 .. 15
        
 0F - Control register 0F
        Bit 7-4 Background color 0-15.
        Bit 3   Reverse screen when 0.
        BIT 2-0 Border color.
 

Since:
1.01
Version:
1.00
Author:
Mario Viara

Field Summary
static int CR2
          Control register 2 number of columns
static int CR3
          Control register 3 number of rows
static int CR5
          Control register 5 memory address
static int CRE
          Control register E
static int CRF
          Control register F color
static int[] noisepattern
           
static int sample
           
protected  int scaleHeight
           
protected  int scaleWidth
           
protected  int sizeHeight
           
protected  int sizeWidth
           
 
Fields inherited from class jmce.sim.AbstractPeripheral
cpu
 
Constructor Summary
VIC6561()
           
 
Method Summary
 int convertAddress(int add)
          Convert an address from the video memory.
 void cycle(int n)
          Cycle listener.
 int getBase()
          Return the base address
 java.awt.Component getComponent()
           
protected  int getVideoByte(int add)
           
 int readMemory(Memory memory, int address, int value)
          Called when the memory is readed.
 void registerCPU(CPU cpu)
          Register a parent CPU for future reference.
 void setBase(int base)
          Set the base address
 void setScaleHeight(int n)
          Set scale height
 void setScaleWidth(int n)
          Set scale width
 void setSizeHeight(int n)
          Set screen height
 void setSizeWidth(int n)
          Set screen width
 java.lang.String toString()
           
 void writeMemory(Memory memory, int address, int value, int oldValue)
          Called when a memory write event occours.
 
Methods inherited from class jmce.sim.AbstractPeripheral
idle, setIdle, setLive
 
Methods inherited from class jmce.sim.AbstractHardware
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jmce.sim.Hardware
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName
 

Field Detail

sample

public static int sample

scaleWidth

protected int scaleWidth

scaleHeight

protected int scaleHeight

sizeWidth

protected int sizeWidth

sizeHeight

protected int sizeHeight

noisepattern

public static final int[] noisepattern

CR2

public static final int CR2
Control register 2 number of columns

See Also:
Constant Field Values

CR3

public static final int CR3
Control register 3 number of rows

See Also:
Constant Field Values

CR5

public static final int CR5
Control register 5 memory address

See Also:
Constant Field Values

CRE

public static final int CRE
Control register E

See Also:
Constant Field Values

CRF

public static final int CRF
Control register F color

See Also:
Constant Field Values
Constructor Detail

VIC6561

public VIC6561()
Method Detail

setSizeWidth

public void setSizeWidth(int n)
Set screen width


setSizeHeight

public void setSizeHeight(int n)
Set screen height


setScaleWidth

public void setScaleWidth(int n)
Set scale width


setScaleHeight

public void setScaleHeight(int n)
Set scale height


getBase

public int getBase()
Return the base address


setBase

public void setBase(int base)
Set the base address


convertAddress

public int convertAddress(int add)
Convert an address from the video memory. Can be override from subclass if the 6561 is the address line are not all connected in the correct order. For example the VIC20 have the A13 connected to the inverse of A15. This is necessary because the VIC6561 have only 14 address bit and normally is connected to cpu with 16 bit address.

Parameters:
add - - Address of memory.
Returns:
The address in CPU format.

getVideoByte

protected int getVideoByte(int add)
                    throws SIMException
Throws:
SIMException

registerCPU

public void registerCPU(CPU cpu)
                 throws SIMException
Description copied from interface: Peripheral
Register a parent CPU for future reference.

Specified by:
registerCPU in interface Peripheral
Overrides:
registerCPU in class AbstractPeripheral
Throws:
SIMException

readMemory

public int readMemory(Memory memory,
                      int address,
                      int value)
               throws SIMException
Description copied from interface: MemoryReadListener
Called when the memory is readed.

This is method is called to notify a read at the specified memory loction.

Specified by:
readMemory in interface MemoryReadListener
Parameters:
memory - - Memory readed.
address - - Address where the operation occours.
value - - Value readed from the phisical memory or from previus installed listener.
Returns:
Value readed from the memory.
Throws:
SIMException

writeMemory

public void writeMemory(Memory memory,
                        int address,
                        int value,
                        int oldValue)
                 throws SIMException
Description copied from interface: MemoryWriteListener
Called when a memory write event occours.

This method is called when a memory write operation occours in the specified memory.

Specified by:
writeMemory in interface MemoryWriteListener
Parameters:
memory - - Memory involved in the write operation.
address - - Address written.
value - - Value written.
oldValue - - Old value of this memory location.
Throws:
SIMException

getComponent

public java.awt.Component getComponent()
Specified by:
getComponent in interface SwingHardware

cycle

public void cycle(int n)
           throws SIMException
Description copied from interface: CycleListener
Cycle listener. This type of listener is very time consuming and must be used only when necessary because can have great impact on the simulator performance.

Specified by:
cycle in interface CycleListener
Parameters:
n - - The number of microprocessor cycle elapsed from the last call.
Throws:
SIMException
See Also:
CPU.addCycleListener(jmce.sim.CycleListener)

toString

public java.lang.String toString()
Overrides:
toString in class AbstractHardware

jmce - 1_02