com.monkeycoder.monkeynes.hardware.mapper
Class MemoryMapper

java.lang.Object
  |
  +--com.monkeycoder.monkeynes.hardware.mapper.MemoryMapper
Direct Known Subclasses:
MemoryMapperZero

public abstract class MemoryMapper
extends Object

This is the abstract superclass of all hardware mappers. There are supposedly hundreds of them.

Originally part of the MonkeyNES project.

Author:
David Stephens

Field Summary
protected  NesMainMemory mainMem
           
protected  NesRom rom
           
protected  NesVideoMemory vidMem
           
 
Constructor Summary
protected MemoryMapper(NesMainMemory inMainMem, NesVideoMemory inVidMem, NesRom inRom)
          Creates a new MemoryMapper.
 
Method Summary
abstract  void doCycle()
          Called to tell the mapper to do a cycle.
 NesMainMemory getMainMemory()
          Returns a reference to the main memory bank this mapper is using.
abstract  String getMapperDesc()
          Returns the description of this mapper.
abstract  String getMapperName()
          Returns the name of this mapper.
abstract  int getMapperNumber()
          Returns the mapper number of this mapper.
 NesRom getRom()
          Returns a reference to the ROM this mapper is using.
 NesVideoMemory getVideoMemory()
          Returns a reference to the video memory bank this mapper is using.
abstract  void powerOff()
          Called to tell the mapper that power is now off.
abstract  void powerOn()
          Called to tell the mapper that power is now on.
abstract  void reset()
          Called to tell the mapper that a reset has occurred.
 String toString()
          Converts the data in this mapper to a string.
abstract  boolean write(int inAddress, int inValue)
          Called to indicate to the mapper that a specific address in memory was written to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mainMem

protected NesMainMemory mainMem

vidMem

protected NesVideoMemory vidMem

rom

protected NesRom rom
Constructor Detail

MemoryMapper

protected MemoryMapper(NesMainMemory inMainMem,
                       NesVideoMemory inVidMem,
                       NesRom inRom)
Creates a new MemoryMapper.

Parameters:
inMainMem - Main memory bank accessed by this mapper.
inVidMem - Video memory bank accessed by this mapper.
inRom - ROM accessed by this mapper.
Method Detail

getMainMemory

public NesMainMemory getMainMemory()
Returns a reference to the main memory bank this mapper is using.

Returns:
Main memory bank accessed by this mapper.

getVideoMemory

public NesVideoMemory getVideoMemory()
Returns a reference to the video memory bank this mapper is using.

Returns:
Video memory bank accessed by this mapper.

getRom

public NesRom getRom()
Returns a reference to the ROM this mapper is using.

Returns:
ROM accessed by this mapper.

toString

public String toString()
Converts the data in this mapper to a string.

Overrides:
toString in class Object
Returns:
A string representing this this mapper.

getMapperNumber

public abstract int getMapperNumber()
Returns the mapper number of this mapper.

Returns:
The mapper number of this mapper.

getMapperName

public abstract String getMapperName()
Returns the name of this mapper.

Returns:
The name of this mapper.

getMapperDesc

public abstract String getMapperDesc()
Returns the description of this mapper.

Returns:
The description of this mapper.

powerOn

public abstract void powerOn()
Called to tell the mapper that power is now on.


powerOff

public abstract void powerOff()
Called to tell the mapper that power is now off.


reset

public abstract void reset()
Called to tell the mapper that a reset has occurred.


doCycle

public abstract void doCycle()
Called to tell the mapper to do a cycle.


write

public abstract boolean write(int inAddress,
                              int inValue)
Called to indicate to the mapper that a specific address in memory was written to.

Parameters:
inAddress - The address of main memory that was written.
inValue - The value that will be written to main memory.
Returns:
Whether or not the write should be allowed to happen.