jmce - 1_02

jmce.sinclair.spectrum
Class Speaker

java.lang.Object
  extended by jmce.sim.AbstractHardware
      extended by jmce.sim.AbstractPeripheral
          extended by jmce.sinclair.spectrum.Speaker
All Implemented Interfaces:
CycleListener, Hardware, MemoryWriteListener, Peripheral, SpectrumConstants

public class Speaker
extends AbstractPeripheral
implements MemoryWriteListener, CycleListener, SpectrumConstants

ZX spectrum Speaker emulation. Also manage the color of the border.

Very simple hardware means very time expensive emulation.

Version:
1.01
Author:
Mario Viara

Field Summary
 
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
Speaker()
           
 
Method Summary
 void cycle(int n)
          Cycle listener.
 void init(Hardware parent)
          Initialize the hardware.
 void registerCPU(CPU _cpu)
          Register a parent CPU for future reference.
 java.lang.String toString()
           
 void writeMemory(Memory m, int port, int value, int oldValue)
          Called when a memory write event occours.
 
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.Hardware
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName
 

Constructor Detail

Speaker

public Speaker()
Method Detail

init

public void init(Hardware parent)
          throws SIMException
Description copied from interface: Hardware
Initialize the hardware. This method must be called before any use of the interface. Only set ... / get ... method are allowed to be called before the intialization.

Specified by:
init in interface Hardware
Overrides:
init in class AbstractHardware
Parameters:
parent - Parent of this hardware.
Throws:
SIMException

writeMemory

public void writeMemory(Memory m,
                        int port,
                        int value,
                        int oldValue)
                 throws SIMException
Description copied from interface: MemoryWriteListener
Called when a memory write event occours.

This method is called when a memory write operation occours in the specified memory.

Specified by:
writeMemory in interface MemoryWriteListener
Parameters:
m - - Memory involved in the write operation.
port - - Address written.
value - - Value written.
oldValue - - Old value of this memory location.
Throws:
SIMException

cycle

public void cycle(int n)
Description copied from interface: CycleListener
Cycle listener. This type of listener is very time consuming and must be used only when necessary because can have great impact on the simulator performance.

Specified by:
cycle in interface CycleListener
Parameters:
n - - The number of microprocessor cycle elapsed from the last call.
See Also:
CPU.addCycleListener(jmce.sim.CycleListener)

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

toString

public java.lang.String toString()
Overrides:
toString in class AbstractHardware

jmce - 1_02