quickkey.bas

Contains a standard AT keyboard driver

Author

Marcel Sondaar

License

Public Domain

Summary
quickkey.basContains a standard AT keyboard driver
Variables
buttonsStores the up/down values for all of the keys
keycodesStores the last 64 keyboard events
lastkeycounterStores the keypress counter
LastReadStores the last byte read from the keyboard controller
Keymap:Stores the mapping of keys
Functions
ReadKeyboardreads a keypress from the kbc and adjusts the state accordingly
ReadKeyWaits for a keypress, then returns the associated character.

Variables

buttons

Dim Shared buttons(to 255) As Long

Stores the up/down values for all of the keys

keycodes

Dim Shared keycodes(to 63) As Long

Stores the last 64 keyboard events

lastkeycounter

Dim Shared lastkeycounter As Long

Stores the keypress counter

LastRead

Dim Shared LastRead As Unsigned Byte

Stores the last byte read from the keyboard controller

Keymap:

Stores the mapping of keys

Functions

ReadKeyboard

Function ReadKeyboard() As Unsigned Byte

reads a keypress from the kbc and adjusts the state accordingly

a byte is read and acknowledged, and if it equals e0, another byte is read and acked. then the msb of the last byte is set it is a release, and if its clear its a press the presence of e0 tells us wether it is an extended key or not.

ReadKey

Function ReadKey() As Byte

Waits for a keypress, then returns the associated character.

Dim Shared buttons(to 255) As Long
Stores the up/down values for all of the keys
Dim Shared keycodes(to 63) As Long
Stores the last 64 keyboard events
Dim Shared lastkeycounter As Long
Stores the keypress counter
Dim Shared LastRead As Unsigned Byte
Stores the last byte read from the keyboard controller
Function ReadKeyboard() As Unsigned Byte
reads a keypress from the kbc and adjusts the state accordingly
Function ReadKey() As Byte
Waits for a keypress, then returns the associated character.