jmce - 1_02

jmce.sinclair.spectrum
Class Memory128K

java.lang.Object
  extended by jmce.sim.AbstractHardware
      extended by jmce.sim.AbstractPeripheral
          extended by jmce.sim.memory.AbstractMemory
              extended by jmce.sim.memory.CombinedMemory
                  extended by jmce.sinclair.spectrum.Memory128K
All Implemented Interfaces:
Hardware, Memory, MemoryReadListener, MemoryWriteListener, Peripheral, ResetListener, SpectrumConstants, SpectrumMemory

public class Memory128K
extends CombinedMemory
implements MemoryWriteListener, SpectrumConstants, SpectrumMemory, ResetListener, MemoryReadListener

Spectrum 128K Memory.

The spectrum 128K memory look like this :

 0FFFF
 0C000  Bank0   Bank1   Bank2   Bank3   Bank4   Bank5   Bank6   Bank7
 08000  Bank2
 04000  Bank5
 00000  Rom0    Rom1
 

The Rom0 is the editor and Rom1 the Basic. Bank0-7 are bank of 16K memory. Bank5 is the default screen memory and Bank7 the alternate screen. To control the memory manager the one byte register ad 0x7ffd is used.

MMU Control register at 7FFD

        Bit5    If set the MMU is disable till a new reset.
        Bit4    0 Select Rom0 at 0000 1 Select Rom1.
        Bit3    0 Select Bank5 as display memory 1 Select Bank7
        Bit2-0  Select Bank mapped at  C000.
 

Since:
1.02
Version:
1.00
Author:
Mario Viara

Field Summary
 
Fields inherited from class jmce.sim.memory.AbstractMemory
size, vms
 
Fields inherited from class jmce.sim.AbstractPeripheral
cpu
 
Fields inherited from interface jmce.sinclair.spectrum.SpectrumConstants
ATTRIBUTE_BRIGHT, ATTRIBUTE_FLASH, MMU_DISABLE, MMU_PORT, MMU_ROM, MMU_VIDEO, ROM_MEMORY_END, SCREEN_ATTRIBUTE_END, SCREEN_ATTRIBUTE_SIZE, SCREEN_ATTRIBUTE_START, SCREEN_MEMORY_END, SCREEN_MEMORY_SIZE, SCREEN_MEMORY_START, ULA_BORDER, ULA_IN, ULA_KBD, ULA_MIC, ULA_OUT, ULA_PORT
 
Constructor Summary
Memory128K()
           
 
Method Summary
 Memory getVideoMemory()
           
 int readMemory(Memory memory, int address, int value)
          Global I/O read listener
 void registerCPU(CPU cpu)
          Register a parent CPU for future reference.
 void reset(CPU cpu)
           
 void writeMemory(Memory memory, int address, int value, int oldValue)
          Global I/O write listener
 void writeMMU(int value)
          Write MMU register
 
Methods inherited from class jmce.sim.memory.CombinedMemory
get, getSize, init, mapAddress, mapMemory, set, setSize, toString
 
Methods inherited from class jmce.sim.memory.AbstractMemory
addHardwareMemory, addMemory, addMemoryReadListener, addMemoryReadListener, addMemoryWriteListener, addMemoryWriteListener, clrBit, getMemory, getMemoryAt, getMemoryCount, getMemoryName, getMemoryReadListenerAt, getMemoryReadListenerAt, getMemoryReadListenerCount, getMemoryReadListenerCount, getMemoryWriteListenerAt, getMemoryWriteListenerAt, getMemoryWriteListenerCount, getMemoryWriteListenerCount, getReadOnly, isBit, removeMemoryReadListener, removeMemoryReadListener, removeMemoryWriteListener, removeMemoryWriteListener, setBit, setMemory, setMemoryName, setReadOnly, setReadOnly, setReadOnly
 
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, 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.Memory
addMemoryReadListener, addMemoryReadListener, addMemoryWriteListener, addMemoryWriteListener, clrBit, getMemory, getMemoryName, getMemoryReadListenerAt, getMemoryReadListenerAt, getMemoryReadListenerCount, getMemoryReadListenerCount, getMemoryWriteListenerAt, getMemoryWriteListenerAt, getMemoryWriteListenerCount, getMemoryWriteListenerCount, getReadOnly, getSize, isBit, removeMemoryReadListener, removeMemoryReadListener, removeMemoryWriteListener, removeMemoryWriteListener, setBit, setMemory, setMemoryName, setReadOnly, setReadOnly, setReadOnly, setSize
 
Methods inherited from interface jmce.sim.Peripheral
idle
 
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
 

Constructor Detail

Memory128K

public Memory128K()
Method Detail

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

writeMMU

public void writeMMU(int value)
Write MMU register


readMemory

public int readMemory(Memory memory,
                      int address,
                      int value)
               throws SIMException
Global I/O read listener

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
Global I/O write listener

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

getVideoMemory

public Memory getVideoMemory()
Specified by:
getVideoMemory in interface SpectrumMemory

reset

public void reset(CPU cpu)
           throws SIMException
Specified by:
reset in interface ResetListener
Throws:
SIMException

jmce - 1_02