org.razvan.jzx
Class BaseKeyboard

java.lang.Object
  extended by org.razvan.jzx.BaseComponent
      extended by org.razvan.jzx.BaseKeyboard
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener

public class BaseKeyboard
extends BaseComponent
implements java.awt.event.KeyListener

Base class extended by all Keyboard components that comprise the emulator.

There are currently no children of this class, so all keyboard functionality is included in this class.

Author:
Razvan Surdulescu (c) 2001 - 2006, Erik Kunze (c) 1995, 1996, 1997, Des Herriott (c) 1993, 1994
You may use and distribute this software for free provided you include this copyright notice. You may not sell this software, use my name for publicity reasons or modify the code without permission from me.

Field Summary
protected static int JOY_DOWN
          Joystick DOWN event = Keypad 2
protected static int JOY_FIRE
          Joystick FIRE event = Keypad 0
protected static int JOY_LEFT
          Joystick LEFT event = Keypad 4
protected static int JOY_RIGHT
          Joystick RIGHT event = Keypad 5
protected static int JOY_UP
          Joystick UP event = Keypad 8
protected  BaseIO m_io
          Cached reference to the I/O component.
protected static int[][] m_keyTable
          Maps ASCII keys to a keyboard row and bit to set/reset.
protected  BaseScreen m_screen
           
protected  boolean m_unshiftCursor
          Is the cursor currently in SHIFT mode?
 
Fields inherited from class org.razvan.jzx.BaseComponent
m_logger, m_spectrum
 
Constructor Summary
BaseKeyboard()
           
 
Method Summary
 void init(BaseSpectrum spectrum, ILogger logger)
          Cache the reference to the I/O component.
 void keyPressed(java.awt.event.KeyEvent kevent)
          Modify the I/O ports in accordance with the key that was pressed.
 void keyReleased(java.awt.event.KeyEvent kevent)
          Modify the I/O ports in accordance with the key that was released.
 void keyTyped(java.awt.event.KeyEvent kevent)
          Does nothing.
 void load(BaseLoader loader)
          Does nothing.
 void reset()
          Does nothing.
 void terminate()
          Releases the cached I/O component reference.
 
Methods inherited from class org.razvan.jzx.BaseComponent
getSpectrum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JOY_UP

protected static final int JOY_UP
Joystick UP event = Keypad 8

See Also:
Constant Field Values

JOY_DOWN

protected static final int JOY_DOWN
Joystick DOWN event = Keypad 2

See Also:
Constant Field Values

JOY_LEFT

protected static final int JOY_LEFT
Joystick LEFT event = Keypad 4

See Also:
Constant Field Values

JOY_RIGHT

protected static final int JOY_RIGHT
Joystick RIGHT event = Keypad 5

See Also:
Constant Field Values

JOY_FIRE

protected static final int JOY_FIRE
Joystick FIRE event = Keypad 0

See Also:
Constant Field Values

m_keyTable

protected static final int[][] m_keyTable
Maps ASCII keys to a keyboard row and bit to set/reset.

e.g. m_keyTable['a'] means set/reset bit 0 (0xfe) of keyboard row 1. Keyboard row 8 (in the table below) means "unused". TODO: finish implementing remaining keys


m_unshiftCursor

protected boolean m_unshiftCursor
Is the cursor currently in SHIFT mode?


m_io

protected BaseIO m_io
Cached reference to the I/O component.

This is used to alter the keyboard port array.


m_screen

protected BaseScreen m_screen
Constructor Detail

BaseKeyboard

public BaseKeyboard()
Method Detail

init

public void init(BaseSpectrum spectrum,
                 ILogger logger)
Cache the reference to the I/O component.

Overrides:
init in class BaseComponent

reset

public void reset()
Does nothing.

Specified by:
reset in class BaseComponent

terminate

public void terminate()
Releases the cached I/O component reference.

Overrides:
terminate in class BaseComponent

keyTyped

public void keyTyped(java.awt.event.KeyEvent kevent)
Does nothing.

Must exist in order for this class to be able to implement the KeyListener interface.

Specified by:
keyTyped in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent kevent)
Modify the I/O ports in accordance with the key that was pressed.

Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent kevent)
Modify the I/O ports in accordance with the key that was released.

Specified by:
keyReleased in interface java.awt.event.KeyListener

load

public void load(BaseLoader loader)
Does nothing.

No keyboard state is saved, so there is nothing to load.

Specified by:
load in class BaseComponent