Skip to content

keyboardDaemon.dasm16

SashaCrofter edited this page Jul 18, 2012 · 2 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

 +----------------+
 | Direct Write | <- the location at which to write the raw ascii
 | Screen Write | <- the location at which to write the colorized ascii
 | Notify On Exit | <- jumped to when "Exit Key" is pressed
 | Exit Key |
 | Min-Position | <- if 0, there is no minimum-position (onscreen)
 | Max-Position | <- if 0, there is no maximum-position (onscreen)
 | Char Color |
 | Reserved |
 | .... | <- Total length is 16 words
 +----------------+

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