Contains a standard AT keyboard driver
Marcel Sondaar
Public Domain
keyboard.bas | Contains a standard AT keyboard driver |
Variables | |
buttons | Stores the up/down values for all of the keys |
keycodes | Stores the last 64 keyboard events |
lastkeycounter | Stores the keypress counter |
LastRead | Stores the last byte read from the keyboard controller |
Functions | |
ModMain | Contains the driver’s startup code |
handler | handles the incoming calls |
handlerstub | converts the register calling convention into a FB-compatible convention |
ReadKeyboard | reads a keypress from the kbc and adjusts the state accordingly |
Sub handler ( ByVal f As Long, ByVal button As Long, ByVal state As Long, ByVal x As Long )
handles the incoming calls
f | first (mangled) parameter |
button | second parameter |
state | third parameter |
x | fourth parameter |
f | first return paramter (success value) |
button | second return parameter |
state | third return parameter |
x | fourth return parameter |
Sub handlerstub()
converts the register calling convention into a FB-compatible convention
Sub ReadKeyboard()
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.
Stores the up/down values for all of the keys
Dim Shared buttons( to 255 ) As Long
Stores the last 64 keyboard events
Dim Shared keycodes( to 63 ) As Long
Stores the keypress counter
Dim Shared lastkeycounter As Long
Stores the last byte read from the keyboard controller
Dim Shared LastRead As Unsigned Byte
Contains the driver’s startup code
Sub ModMain CDecl Alias "main" ()
handles the incoming calls
Sub handler ( ByVal f As Long, ByVal button As Long, ByVal state As Long, ByVal x As Long )
converts the register calling convention into a FB-compatible convention
Sub handlerstub()
reads a keypress from the kbc and adjusts the state accordingly
Sub ReadKeyboard()