Klasse VIC

java.lang.Object
libsidplay.components.pla.Bank
libsidplay.components.mos656x.VIC
Bekannte direkte Unterklassen:
MOS6567, MOS6569

public abstract class VIC extends Bank
Implements the functionality of the C64's VIC II chip For a good German documentation on the MOS 6567/6569 Videocontroller (VIC-II), see
 http://www.minet.uni-jena.de/~andreasg/c64/vic_artikel/vic_artikel_1.htm,
 http://cbmmuseum.kuto.de/zusatz_6569_vic2.html or
 http://unusedino.de/ec64/technical/misc/vic656x/vic656x-german.html.
 An English version of the documentation you can find at
 http://www.unusedino.de/ec64/technical/misc/vic656x/vic656x.html.
 
Autor:
Jörg Jahnke (joergjahnke@users.sourceforge.net), Antti S. Lankila (alankila@bel.fi)
  • Felddetails

    • MAX_HEIGHT

      public static final int MAX_HEIGHT
      Siehe auch:
    • MAX_WIDTH

      public static final int MAX_WIDTH
      Siehe auch:
    • FIRST_DMA_LINE

      protected static final int FIRST_DMA_LINE
      First line when we check for bad lines
      Siehe auch:
    • LAST_DMA_LINE

      protected static final int LAST_DMA_LINE
      Last line when we check for bad lines
      Siehe auch:
    • COL_D021

      private static final byte COL_D021
      Siehe auch:
    • COL_D022

      private static final byte COL_D022
      Siehe auch:
    • COL_D023

      private static final byte COL_D023
      Siehe auch:
    • COL_CBUF

      private static final byte COL_CBUF
      Siehe auch:
    • COL_CBUF_MC

      private static final byte COL_CBUF_MC
      Siehe auch:
    • COL_VBUF_L

      private static final byte COL_VBUF_L
      Siehe auch:
    • COL_VBUF_H

      private static final byte COL_VBUF_H
      Siehe auch:
    • COL_ECM

      private static final byte COL_ECM
      Siehe auch:
    • COL_NONE

      private static final byte COL_NONE
      Siehe auch:
    • videoModeColorDecoder

      private static final byte[] videoModeColorDecoder
    • videoModeColorDecoderOffset

      private int videoModeColorDecoderOffset
    • videoModeColors

      private final byte[] videoModeColors
      Current dynamic colors
    • borderColor

      private int borderColor
      Current border color
    • phi1Data

      protected byte phi1Data
      contains the memory fetch data
    • pixelColor

      private int pixelColor
      Pixel color being rendered.
    • mcFlip

      private boolean mcFlip
      multicolor flip-flop state
    • phi1DataPipe

      private int phi1DataPipe
      xscroll-delayed phi1 data
    • palEmulation

      protected IPALEmulation palEmulation
    • pla

      private final PLA pla
      PLA chip
    • credit

      private static final String credit
      Credits
      Siehe auch:
    • IRQ_RASTER

      private static final byte IRQ_RASTER
      raster IRQ flag
      Siehe auch:
    • IRQ_SPRITE_BACKGROUND_COLLISION

      protected static final byte IRQ_SPRITE_BACKGROUND_COLLISION
      sprite-background collision IRQ flag
      Siehe auch:
    • IRQ_SPRITE_SPRITE_COLLISION

      protected static final byte IRQ_SPRITE_SPRITE_COLLISION
      sprite-sprite collision IRQ flag
      Siehe auch:
    • MOS656X_INTERRUPT_LP

      private static final byte MOS656X_INTERRUPT_LP
      Light-Pen IRQ flag
      Siehe auch:
    • registers

      protected final byte[] registers
      memory for chip registers
    • vc

      protected int vc
      video counter, a 10 bit counter
    • vcBase

      protected int vcBase
      video counter base, a 10 bit data register
    • rc

      protected int rc
      row counter, a 3 bit counter
    • isDisplayActive

      protected boolean isDisplayActive
      is the display active or idle?
    • areBadLinesEnabled

      protected boolean areBadLinesEnabled
      are bad lines enabled for this frame?
    • rasterY

      protected int rasterY
      current raster line
    • rasterYIRQCondition

      protected boolean rasterYIRQCondition
      Is rasterYIRQ condition true?
    • sprites

      protected final Sprite[] sprites
      the 8 sprites
    • spriteLinkedListHead

      protected final Sprite spriteLinkedListHead
      The head of sprite linked list. The top is never rendered; it's just an anchor.
    • colorData

      private final byte[] colorData
      contains the color data of the current character
    • videoMatrixData

      protected final byte[] videoMatrixData
      contains the video matrix data for the current character
    • showBorderVertical

      protected boolean showBorderVertical
      vertical border flip-flop
    • showBorderMain

      private boolean showBorderMain
      main border flip-flop
    • isBadLine

      protected boolean isBadLine
      is the current line a bad line
    • videoMatrixBase

      protected int videoMatrixBase
      video matrix base address
    • charMemBase

      protected int charMemBase
      character memory base address
    • bitmapMemBase

      protected int bitmapMemBase
      bitmap memory base address
    • yscroll

      private int yscroll
      vertical scrolling value
    • xscroll

      protected byte xscroll
      horizontal scrolling value
    • latchedXscroll

      protected int latchedXscroll
      xscroll value within window region text columns 1 .. 39
    • irqFlags

      private byte irqFlags
      internal IRQ flags
    • irqMask

      private byte irqMask
      masks for the IRQ flags
    • lineCycle

      protected int lineCycle
      Current visible line
    • graphicsRendering

      protected boolean graphicsRendering
      Is display rendering enabled?
    • context

      protected final EventScheduler context
      CPU's event context.
    • lpx

      private byte lpx
      Light pen coordinates
    • lpy

      private byte lpy
      Light pen coordinates
    • lpTriggered

      protected boolean lpTriggered
      Has light pen IRQ been triggered in this frame already?
    • startOfFrame

      protected boolean startOfFrame
      Set when new frame starts.
    • CYCLES_PER_LINE

      protected final int CYCLES_PER_LINE
      Number of cycles per line.
    • MAX_RASTERS

      protected final int MAX_RASTERS
      Number of raster lines
    • lpAsserted

      private boolean lpAsserted
      Is CIA asserting lightpen?
    • latchedColor

      private byte latchedColor
    • latchedVmd

      private byte latchedVmd
    • videoDriver

      protected VideoDriver videoDriver
      Consumer for VIC screen output as ARGB data
    • singleColorLUT

      protected static final int[] singleColorLUT
    • makeDisplayActive

      private final Event makeDisplayActive
      Display is enabled because badline condition was on for at least 1 clock
    • badLineStateChange

      private final Event badLineStateChange
      AEC state was updated.
    • rasterYIRQEdgeDetector

      protected final Event rasterYIRQEdgeDetector
      RasterY IRQ edge detector.
  • Konstruktordetails

    • VIC

      public VIC(PLA pla, EventScheduler context, int cpl, int maxRasters)
      Creates a new instance of VIC6569
      Parameter:
      pla -
      context -
      cpl -
  • Methodendetails

    • setVideoDriver

      public void setVideoDriver(VideoDriver videoDriver)
      Set consumer of VIC screen output as ARGB data
      Parameter:
      videoDriver - consumer of C64 screen pixels as ARGB data
    • readSpriteXCoordinate

      private int readSpriteXCoordinate(int spriteNo)
      Read the x-coordinate of a sprite
      Parameter:
      spriteNo - no of the sprite (0-7)
      Gibt zurück:
      x-coordinate
    • readRSEL

      protected boolean readRSEL()
      Read the RSEL flag which determines whether we display 24 or 25 lines of text
      Gibt zurück:
      true if RSEL is set and we use 25 lines, otherwise false
    • readCSEL

      private boolean readCSEL()
      Read the CSEL flag which determines whether we display 38 or 40 columns of text
      Gibt zurück:
      true if CSEL is set and we use 40 columns, otherwise false
    • readDEN

      protected boolean readDEN()
      Read the DEN flag which tells whether the display is enabled
      Gibt zurück:
      true if DEN is set, otherwise false
    • readRasterLineIRQ

      protected int readRasterLineIRQ()
      Read the value of the raster line IRQ
      Gibt zurück:
      raster line when to trigger an IRQ
    • evaluateIsBadLine

      protected boolean evaluateIsBadLine()
    • handleIrqState

      private void handleIrqState()
      Signal CPU interrupt if requested by VIC.
    • determineVideoMemoryBaseAddresses

      private void determineVideoMemoryBaseAddresses()
      Get the video memory base address, which is determined by the inverted bits 0-1 of port A on CIA 2, plus the video matrix base address plus the character data base address plus the bitmap memory base address.
    • activateIRQFlag

      protected void activateIRQFlag(byte flag)
      Set an IRQ flag and trigger an IRQ if the corresponding IRQ mask is set. The IRQ only gets activated, i.e. flag 0x80 gets set, if it was not active before.
    • doVideoMatrixAccess

      protected void doVideoMatrixAccess()
      Read video matrix and color data for the next character
    • getVideoMatrixBase

      public int getVideoMatrixBase()
    • drawSpritesAndGraphics

      protected void drawSpritesAndGraphics()
      This monster method calculates:
      • graphics sequencer output,
      • sprite sequencer output,
      • border sequencer output
      and combines all of them together.
    • spriteCollisionsOnly

      protected final void spriteCollisionsOnly()
      This version just detects sprite-sprite collisions. It is appropriate to use outside renderable screen, where graphics sequencer is known to have quiesced.
    • getLastReadByte

      public final byte getLastReadByte()
      In certain cases, CPU sees the stale bus data from VIC. VIC reads on every cycle, and this describes what it reads.
    • fetchSpritePointer

      protected void fetchSpritePointer(int n)
      Get memory address of sprite data.
      Parameter:
      n - sprite number
    • fetchSpriteData

      protected void fetchSpriteData(int n)
      Fetch 1 byte of memory starting from the sprite address.
      Parameter:
      n - sprite number
    • read

      public final byte read(int register)
      Read VIC register.
      Setzt außer Kraft:
      read in Klasse Bank
      Parameter:
      register - Register to read.
      Gibt zurück:
      value at address
    • lightpenEdgeDetector

      protected void lightpenEdgeDetector()
      Handle lightpen state change
    • write

      public final void write(int register, byte data)
      Write to VIC register.
      Setzt außer Kraft:
      write in Klasse Bank
      Parameter:
      register - Register to write to.
      data - Data byte to write.
    • setSpriteDataFromCPU

      private void setSpriteDataFromCPU(byte data)
      If CPU reads/writes to VIC at just the cycle VIC is supposed to do a PHI2 fetch for sprite data, the data fetched is set from the interaction with CPU.
      Parameter:
      data - The Sprite data to set.
    • getCurrentSpriteCycle

      private int getCurrentSpriteCycle()
    • handleSpriteVisibilityEvent

      private void handleSpriteVisibilityEvent(Sprite sprite)
      Schedule the rendering to begin
      Parameter:
      sprite - The Sprite to handle the visibility event of.
    • reset

      public void reset()
      Resets this VIC II Chip.
    • credits

      public static String credits()
      Gets the credit string.
      Gibt zurück:
      The credit string.
    • getPalEmulation

      public IPALEmulation getPalEmulation()
      PAL emulation
    • setPalEmulation

      public void setPalEmulation(IPALEmulation palEmulation)
    • triggerLightpen

      public void triggerLightpen()
      Trigger the lightpen. Sets the lightpen usage flag.
    • clearLightpen

      public void clearLightpen()
      Clears the lightpen usage flag.
    • interrupt

      protected void interrupt(boolean b)
    • setBA

      protected void setBA(boolean b)
    • vicReadColorMemoryPHI2

      protected byte vicReadColorMemoryPHI2(int address)
    • vicReadMemoryPHI1

      protected byte vicReadMemoryPHI1(int address)
    • vicReadMemoryPHI2

      protected byte vicReadMemoryPHI2(int address)
    • getBorderWidth

      public int getBorderWidth()
    • getBorderHeight

      public abstract int getBorderHeight()
    • getRasterYMax

      public abstract int getRasterYMax()
    • getRegisters

      public byte[] getRegisters()