Skip to content
SashaCrofter edited this page Jul 13, 2012 · 3 revisions

An instance of KeyboardDemon should be registered to any process that requires detection of keypresses. It requests an interrupt value from the operating system, and, when it detects that interrupt, writes the pressed key, if it is ASCII, to the location registered on its instantiation. (That location is, of course, incremented.)

The Handler

All keyboards using KeyboardDaemon are given unique interrupt messages, all of which point kd.keystroke.

Data Structures

Daemon Instance List

 +---------+
 | Port0 | <- (in heap) location, stored in kd.daemonlist
 | Msg 0 |
 | OptLoc0 |
 | Port1 |
 | Msg 1 |
 | OptLoc1 |
 | ... |
 +---------+

Portx refers to a Generic Keyboard port, and the OptLocx following directly after refers to the current "options" selection, which contains all of the information necessary to support a single keyboard (and integrates with dview.)

Option Block

kd.init (slots)

Initializes the keyboard handler with enough room for slots many Generic Keyboard devices.

kd.newKeyboard (GenericKeyboard)

Defines a new keyboard in the first open memory location carried by kd.daemonlist, as defined kd.init, or adds a new one if it doesn't exist.

returns a pointer to the GenericKeyboard's OptLoc word

Clone this wiki locally