de.michab.simulator.mos6502
Class Vic

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

public class Vic
extends DefaultChip

Represents the C64's MOS6569 video interface chip.

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

Field Summary
static int BACKGRDCOL0
           
static int BACKGRDCOL1
           
static int BACKGRDCOL2
           
static int BACKGRDCOL3
           
static int CTRL1
          Control register 1
static int CTRL2
           
static int EXTERIORCOL
           
static int INTERRUPTMASK
           
static int INTERRUPTREQUEST
           
static int MSBX
          Most significant bit for X coordinate of all sprites.
static int RASTERIRQ
          Number of the rasterline that triggers irq.
static int S0Y
          Y coordinate sprite 0.
static int S1X
           
static int S1Y
           
static int S2X
           
static int S2Y
           
static int S3X
           
static int S3Y
           
static int S4X
           
static int S4Y
           
static int S5X
           
static int S5Y
           
static int S6X
           
static int S6Y
           
static int S7X
           
static int S7Y
           
static int SPRITEBACKCOLL
           
static int SPRITEBACKGRD
           
static int SPRITECOL0
           
static int SPRITECOL1
           
static int SPRITECOL2
           
static int SPRITECOL3
           
static int SPRITECOL4
           
static int SPRITECOL5
           
static int SPRITECOL6
           
static int SPRITECOL7
           
static int SPRITEENABLE
          Sprite enabled.
static int SPRITEEXPANDX
           
static int SPRITEEXPANDY
           
static int SPRITEMULTIC0
           
static int SPRITEMULTIC1
           
static int SPRITEMULTICOL
           
static int SPRITESPRITECOLL
           
static int STROBEX
          Light pen X.
static int STROBEY
          Light pen Y.
static int[] VIC_RGB_COLORS
          This defines a table of the 64s colors.
static int VIDEOMEMBASE
           
 
Constructor Summary
Vic(Cpu6510 cpu, Memory memory, int colorRamAddress, Clock clock)
          Creates a VIC with the passed initial references.
 
Method Summary
 java.awt.Component getComponent()
          Returns a java.awt.Component that will show this VIC's output.
 java.awt.Color getExteriorColor()
          Get the current frame color.
 Port[] getPorts()
          Get an array of the chip's ports.
 byte read(int portId)
          Read a byte from the given address.
 void reset()
          Reset all registers to a zero value.
protected  void setAddresses(int charAdr, int bitmap, int videoram)
          Set the chip's character address.
 void setPageAddress(int page)
          Set the page address.
 void terminate()
          Shuts down the Vic.
 void write(int portId, byte value)
          Write a byte into the given address.
 
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
 

Field Detail

VIC_RGB_COLORS

public static final int[] VIC_RGB_COLORS
This defines a table of the 64s colors. The table index maps to the c64 colour code.


S0Y

public static final int S0Y
Y coordinate sprite 0.

See Also:
Constant Field Values

S1X

public static final int S1X
See Also:
Constant Field Values

S1Y

public static final int S1Y
See Also:
Constant Field Values

S2X

public static final int S2X
See Also:
Constant Field Values

S2Y

public static final int S2Y
See Also:
Constant Field Values

S3X

public static final int S3X
See Also:
Constant Field Values

S3Y

public static final int S3Y
See Also:
Constant Field Values

S4X

public static final int S4X
See Also:
Constant Field Values

S4Y

public static final int S4Y
See Also:
Constant Field Values

S5X

public static final int S5X
See Also:
Constant Field Values

S5Y

public static final int S5Y
See Also:
Constant Field Values

S6X

public static final int S6X
See Also:
Constant Field Values

S6Y

public static final int S6Y
See Also:
Constant Field Values

S7X

public static final int S7X
See Also:
Constant Field Values

S7Y

public static final int S7Y
See Also:
Constant Field Values

MSBX

public static final int MSBX
Most significant bit for X coordinate of all sprites. Bit 0 represents sprite 0 and so on.

See Also:
Constant Field Values

CTRL1

public static final int CTRL1
Control register 1

See Also:
Constant Field Values

RASTERIRQ

public static final int RASTERIRQ
Number of the rasterline that triggers irq.

See Also:
Constant Field Values

STROBEX

public static final int STROBEX
Light pen X.

See Also:
Constant Field Values

STROBEY

public static final int STROBEY
Light pen Y.

See Also:
Constant Field Values

SPRITEENABLE

public static final int SPRITEENABLE
Sprite enabled.

See Also:
Constant Field Values

CTRL2

public static final int CTRL2
See Also:
Constant Field Values

SPRITEEXPANDY

public static final int SPRITEEXPANDY
See Also:
Constant Field Values

VIDEOMEMBASE

public static final int VIDEOMEMBASE
See Also:
Constant Field Values

INTERRUPTREQUEST

public static final int INTERRUPTREQUEST
See Also:
Constant Field Values

INTERRUPTMASK

public static final int INTERRUPTMASK
See Also:
Constant Field Values

SPRITEBACKGRD

public static final int SPRITEBACKGRD
See Also:
Constant Field Values

SPRITEMULTICOL

public static final int SPRITEMULTICOL
See Also:
Constant Field Values

SPRITEEXPANDX

public static final int SPRITEEXPANDX
See Also:
Constant Field Values

SPRITESPRITECOLL

public static final int SPRITESPRITECOLL
See Also:
Constant Field Values

SPRITEBACKCOLL

public static final int SPRITEBACKCOLL
See Also:
Constant Field Values

EXTERIORCOL

public static final int EXTERIORCOL
See Also:
Constant Field Values

BACKGRDCOL0

public static final int BACKGRDCOL0
See Also:
Constant Field Values

BACKGRDCOL1

public static final int BACKGRDCOL1
See Also:
Constant Field Values

BACKGRDCOL2

public static final int BACKGRDCOL2
See Also:
Constant Field Values

BACKGRDCOL3

public static final int BACKGRDCOL3
See Also:
Constant Field Values

SPRITEMULTIC0

public static final int SPRITEMULTIC0
See Also:
Constant Field Values

SPRITEMULTIC1

public static final int SPRITEMULTIC1
See Also:
Constant Field Values

SPRITECOL0

public static final int SPRITECOL0
See Also:
Constant Field Values

SPRITECOL1

public static final int SPRITECOL1
See Also:
Constant Field Values

SPRITECOL2

public static final int SPRITECOL2
See Also:
Constant Field Values

SPRITECOL3

public static final int SPRITECOL3
See Also:
Constant Field Values

SPRITECOL4

public static final int SPRITECOL4
See Also:
Constant Field Values

SPRITECOL5

public static final int SPRITECOL5
See Also:
Constant Field Values

SPRITECOL6

public static final int SPRITECOL6
See Also:
Constant Field Values

SPRITECOL7

public static final int SPRITECOL7
See Also:
Constant Field Values
Constructor Detail

Vic

public Vic(Cpu6510 cpu,
           Memory memory,
           int colorRamAddress,
           Clock clock)
Creates a VIC with the passed initial references.

Parameters:
cpu - A reference to the CPU for interrupt purposes.
memory - The memory for the VIC to operate on.
colorRamAddress - The address color ram should be mapped to.
Method Detail

terminate

public void terminate()
Shuts down the Vic. After this call the object should not longer be used.


read

public byte read(int portId)
Description copied from interface: Addressable
Read a byte from the given address.

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

write

public void write(int portId,
                  byte value)
Description copied from interface: Addressable
Write a byte into the given address.

Parameters:
portId - The target address.
value - The value to be written.

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.

setPageAddress

public void setPageAddress(int page)
Set the page address. Only the least 2 significant bits are used which means pages zero to three are available.

Parameters:
page - The page address.

setAddresses

protected void setAddresses(int charAdr,
                            int bitmap,
                            int videoram)
Set the chip's character address. Note that a full address is required, not only the character block. The VIC's page address isn't taken into account.

Parameters:
charAdr - The character memory address.

getComponent

public java.awt.Component getComponent()
Returns a java.awt.Component that will show this VIC's output. This has to be used to place the emulator's display in a user interface.

Returns:
The component that will show the VIC output.

reset

public void reset()
Reset all registers to a zero value.


getExteriorColor

public java.awt.Color getExteriorColor()
Get the current frame color.

Returns:
The current frame color.