jmce - 1_02

jmce.commodore.vic20
Class Keyboard

java.lang.Object
  extended by jmce.sim.AbstractHardware
      extended by jmce.sim.AbstractPeripheral
          extended by jmce.swing.KeyboardMatrix
              extended by jmce.commodore.vic20.Keyboard
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.util.EventListener, Hardware, MemoryWriteListener, Peripheral

public class Keyboard
extends KeyboardMatrix
implements MemoryWriteListener

VIC20 Keyboard / Joystick

This class emulate the keyboard / joystick for VIC20.

Keyboard

All letter key are mapped to the same key and the special commodore key are mapped :

Commodore key Java Key
Run/Stop Esc

Joystick

The joystick is alternative to the keyboard and can be enable pressing the ALT key. When the joystick is enabled the arrow key simulate a joystick direction button and any other key the fire button.

Since:
1.01
Version:
1.00
Author:
Mario Viara

Field Summary
 
Fields inherited from class jmce.swing.KeyboardMatrix
keysLoc, keyState, numRows
 
Fields inherited from class jmce.sim.AbstractPeripheral
cpu
 
Constructor Summary
Keyboard()
           
 
Method Summary
 void keyEvent(java.awt.event.KeyEvent e, boolean pressed)
           
 void registerCPU(CPU cpu)
          Register a parent CPU for future reference.
protected  void resetJoystick()
          Reset the joystick.
protected  void resetKeyboard()
          Reset the state of the keyboard.
 void setVia1(VIA6522 via1)
           
 void setVia2(VIA6522 via2)
           
 void writeMemory(Memory memory, int address, int value, int oldValue)
          Called when a memory write event occours.
 
Methods inherited from class jmce.swing.KeyboardMatrix
focusGained, focusLost, getRow, keyEvent, keyPressed, keyReleased, keyTyped, setComponent, setKey, setKeyLocation, setNumCols, setNumRows, toString
 
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, init, 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, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName
 

Constructor Detail

Keyboard

public Keyboard()
Method Detail

setVia1

public void setVia1(VIA6522 via1)

setVia2

public void setVia2(VIA6522 via2)

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

writeMemory

public void writeMemory(Memory memory,
                        int address,
                        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:
memory - - Memory involved in the write operation.
address - - Address written.
value - - Value written.
oldValue - - Old value of this memory location.
Throws:
SIMException

resetJoystick

protected void resetJoystick()
Reset the joystick. No button pressed and update the registers.


keyEvent

public void keyEvent(java.awt.event.KeyEvent e,
                     boolean pressed)
Overrides:
keyEvent in class KeyboardMatrix

resetKeyboard

protected void resetKeyboard()
Description copied from class: KeyboardMatrix
Reset the state of the keyboard.

Overrides:
resetKeyboard in class KeyboardMatrix

jmce - 1_02