dioscuri.module.keyboard
Class Keyboard

java.lang.Object
  extended by dioscuri.module.AbstractModule
      extended by dioscuri.module.ModuleKeyboard
          extended by dioscuri.module.keyboard.Keyboard
All Implemented Interfaces:
Addressable, Module, Updateable

public class Keyboard
extends ModuleKeyboard

An implementation of a keyboard module.

See Also:

Metadata module ******************************************** general.type : keyboard general.name : XT/AT/PS2 compatible Keyboard general.architecture : Von Neumann general.description : Models a 101-key XT/AT/PS2 compatible keyboard general.creator : Tessella Support Services, Koninklijke Bibliotheek, Nationaal Archief of the Netherlands general.version : 1.0 general.keywords : Keyboard, XT, AT, PS/2, Intel 8042 general.relations : Motherboard general.yearOfIntroduction : general.yearOfEnding : general.ancestor : general.successor :

Notes: - Keyboard can handle XT, AT and PS/2 compatible keyboards - This class uses a lot (if not all) of Bochs source code from keyboard.{h,cc}; - Conversions from C++ to Java have been made, and will need revising and/or updating - Aside from handling keystrokes, the keyboard controller is responsible for: + the status of the PC speaker via 0x61. This is not implemented yet. + A20 address line (memory looping turned on or off) to be enabled/disabled. + mouse support - Information used in this module was taken from: + http://mudlist.eorbit.net/~adam/pickey/ports.html + http://homepages.cwi.nl/~aeb/linux/kbd/scancodes.html


Nested Class Summary
 
Nested classes/interfaces inherited from interface dioscuri.interfaces.Module
Module.Type
 
Field Summary
 
Fields inherited from class dioscuri.module.AbstractModule
type
 
Constructor Summary
Keyboard(Emulator owner)
          Class constructor
 
Method Summary
protected  void clearInterrupt(int irqNumber)
           
 void enqueueControllerBuffer(byte data, int source)
          Queue data in the keyboard controller buffer
 void generateScancode(java.awt.event.KeyEvent keyEvent, int eventType)
          Method generateScancode Generates a scancode from a KeyEvent.
The scancode depends on what scancode set is currently active, and whether the key is pressed or released
 java.lang.String getDump()
          Return a dump of module status
 byte getIOPortByte(int portAddress)
          
 byte[] getIOPortDoubleWord(int portAddress)
          
 byte[] getIOPortWord(int portAddress)
          
 int getUpdateInterval()
          Get the update interval.
 boolean reset()
          Reset all parameters of module.
protected  void setInterrupt(int irqNumber)
           
 void setIOPortByte(int portAddress, byte value)
          
 void setIOPortDoubleWord(int portAddress, byte[] dataDoubleWord)
          
 void setIOPortWord(int portAddress, byte[] dataWord)
          
 void setTimeOut(byte status)
          
 void setUpdateInterval(int interval)
          Defines the interval between subsequent updates
 void update()
          Update device Calls the keyboard controller 'poll' function and raises the IRQs resulting from that call
 
Methods inherited from class dioscuri.module.AbstractModule
getConnection, getConnections, getDebugMode, getExpectedConnections, getType, isConnected, setConnection, setDebugMode, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dioscuri.interfaces.Module
getConnection, getConnections, getDebugMode, getExpectedConnections, getType, isConnected, setConnection, setDebugMode, start, stop
 

Constructor Detail

Keyboard

public Keyboard(Emulator owner)
Class constructor

Method Detail

reset

public boolean reset()
Reset all parameters of module.

Specified by:
reset in interface Module
Specified by:
reset in class AbstractModule
Returns:
true iff the AbstractModule was reset properly.
See Also:
AbstractModule

getDump

public java.lang.String getDump()
Return a dump of module status

Provides a dummy implementation since many of the subclasses of this abstract module class do not need or use a getDump() implementation. The ones that do, can override this method.

Specified by:
getDump in interface Module
Overrides:
getDump in class AbstractModule
Returns:
string containing a dump of this module
See Also:
AbstractModule

getUpdateInterval

public int getUpdateInterval()
Get the update interval.

Returns:
the update interval
See Also:
Updateable

setUpdateInterval

public void setUpdateInterval(int interval)
Defines the interval between subsequent updates

Parameters:
interval - the interval between subsequent updates in ms.
See Also:
Updateable

update

public void update()
Update device Calls the keyboard controller 'poll' function and raises the IRQs resulting from that call


getIOPortByte

public byte getIOPortByte(int portAddress)
                   throws UnknownPortException,
                          WriteOnlyPortException

Returns:
Throws:
UnknownPortException
WriteOnlyPortException
See Also:
Addressable

setIOPortByte

public void setIOPortByte(int portAddress,
                          byte value)
                   throws UnknownPortException

Throws:
UnknownPortException
See Also:
Addressable

getIOPortWord

public byte[] getIOPortWord(int portAddress)
                     throws ModuleException,
                            WriteOnlyPortException

Returns:
Throws:
ModuleException
WriteOnlyPortException
See Also:
Addressable

setIOPortWord

public void setIOPortWord(int portAddress,
                          byte[] dataWord)
                   throws ModuleException

Throws:
ModuleException
See Also:
Addressable

getIOPortDoubleWord

public byte[] getIOPortDoubleWord(int portAddress)
                           throws ModuleException,
                                  WriteOnlyPortException

Returns:
Throws:
ModuleException
WriteOnlyPortException
See Also:
Addressable

setIOPortDoubleWord

public void setIOPortDoubleWord(int portAddress,
                                byte[] dataDoubleWord)
                         throws ModuleException

Throws:
ModuleException
See Also:
Addressable

setInterrupt

protected void setInterrupt(int irqNumber)
Parameters:
irqNumber -

clearInterrupt

protected void clearInterrupt(int irqNumber)
Parameters:
irqNumber -

generateScancode

public void generateScancode(java.awt.event.KeyEvent keyEvent,
                             int eventType)
Method generateScancode Generates a scancode from a KeyEvent.
The scancode depends on what scancode set is currently active, and whether the key is pressed or released

Specified by:
generateScancode in class ModuleKeyboard
Parameters:
keyEvent - the KeyEvent containing key-press information
eventType - Type of KeyEvent, either pressed (0x00) or released (0x01)
See Also:
ModuleKeyboard

setTimeOut

public void setTimeOut(byte status)

Specified by:
setTimeOut in class ModuleKeyboard
See Also:
ModuleKeyboard

enqueueControllerBuffer

public void enqueueControllerBuffer(byte data,
                                    int source)
Queue data in the keyboard controller buffer

Specified by:
enqueueControllerBuffer in class ModuleKeyboard
See Also:
ModuleKeyboard