Class Video

java.lang.Object
  |
  +--NESPictureProcessingUnit
        |
        +--Video

public final class Video
extends NESPictureProcessingUnit

This file contains all the video routines for the emulator (well, this is the theory).
This will make easier a port to a different API.
Some code is strongly inspired by Jamicom (Thanks Ninn!!). Some code is strongly inspired by Darcnes (Thanks Nyef!!). This code is GPL. :o) Copyright (c) 2000 Brice Fines.

  • This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
  • This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
  • You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  • Version:
    0.2005 06/06/00
    Author:
    Jarod CANAL
    See Also:
    "The Gnu Public License."

    Field Summary
    protected  java.awt.Canvas canvas
              Canvas.
    private  java.awt.Frame f
              Frame.
    private  java.awt.Graphics g
              Graphics.
    private  int[] lineBuffer
              Line buffer.
    private  java.awt.Image offScreenImage
              Image.
    protected  int[] PaletteCache
              Palette cache.
    private  int[][][] PatternCache
              Cache for graphic patterns.
    protected  int[] rgb
              Color palette by Matthew Conte.
    private  int[] videoBuffer
              Video buffer.
     
    Fields inherited from class NESPictureProcessingUnit
    AddressMode, BackgroundClipping, BackgroundPatternTableAddress, BackgroundVisibility, ColorIntensity, FullBackgroundColor, HalfVRAMAddress, IsDisplayTypeColorDisplay, IsExecuteNMIOnVBlankEnabled, IsPPUSlave, IsThereMoreThanEightSpritesOnScanline, Memory, NameTable1, NameTable2, Scanline, SpriteClipping, SpritePatternTableAddress, SpriteRam, SpriteSize, SpriteVisibility, TempVRAMAddressRegister, VRAMAddress, VRAMAddressIncrement, VRAMAddressRegister, VRAMDataBuffer, WasSpriteZeroHit, XOffset
     
    Constructor Summary
    Video()
              Constructor.
     
    Method Summary
    protected  void caching()
              This method fill the pattern cache.
    protected  void drawDisplay()
              Renders image on screen.
    protected  void drawLine()
              Renders scanline in video buffer.
    protected  void renderBackground()
              This method renders the background.
    protected  void renderSprites()
              This method renders the sprites on the current scanline.
     
    Methods inherited from class NESPictureProcessingUnit
    NESPictureProcessingUnit
     
    Methods inherited from class java.lang.Object
    , clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
     

    Field Detail

    rgb

    protected final int[] rgb
    Color palette by Matthew Conte.

    PatternCache

    private final int[][][] PatternCache
    Cache for graphic patterns.
    The cache represents the patterns stored in memory to save time when the console draws on screen.
    This will be certainly modified with mappers implementation later.
    Cache is [512][8][8], it has 2 banks of 256 elements which are 8x8 pixels tiles.

    PaletteCache

    protected final int[] PaletteCache
    Palette cache.
    Cache for color palette holding RGB values.
    It has 0x20 entries corresponding to the color palette.

    videoBuffer

    private final int[] videoBuffer
    Video buffer.
    Buffer that represents the whole image (256x240 pixels).

    canvas

    protected final java.awt.Canvas canvas
    Canvas.
    Canvas attached to the frame to paint inside.

    g

    private final java.awt.Graphics g
    Graphics.
    Used to paint into the canvas.

    offScreenImage

    private final java.awt.Image offScreenImage
    Image.
    Image corresponding to the video buffer, it is used by graphics to paint.

    f

    private final java.awt.Frame f
    Frame.
    Frame used to show image on screen in a window (frame).

    lineBuffer

    private final int[] lineBuffer
    Line buffer.
    Buffer representing the current line (256 pixels).
    Constructor Detail

    Video

    public Video()
    Constructor.
    Method Detail

    caching

    protected final void caching()
    This method fill the pattern cache.

    renderSprites

    protected final void renderSprites()
    This method renders the sprites on the current scanline.

    renderBackground

    protected final void renderBackground()
    This method renders the background.

    drawDisplay

    protected final void drawDisplay()
    Renders image on screen.

    drawLine

    protected final void drawLine()
    Renders scanline in video buffer.