Concise Atari ST 68000 Programmer's Reference Guide
INTELLIGENT KEYBOARD COMMAND INSTRUCTIONS
The Atari ST keyboard unit contains a 1MHz HD 6301 8-bit microprocessor with some on-board memory storage to maintain the time of day clock etc. The keyboard and its peripheral items, joystick and mouse may be initialized, monitored for position or status and the time of day clock read or set.
The intelligent keyboard (ikbd) communicates with the main processor over a 7.8 Kbit/s bidirectional serial link, sending individual keycodes or receiving instructions and returning status codes in packets of data through a pair of addresses, one for transmit and one for receive.
Characters can be read from the keyboard input queue in main system RAM, it is filled by an interrupt routine that transfers data from the ikbd to memory automatically. Characters are written to the keyboard by placing the character code in the keyboard data register after bit 1 of the keyboard command/status register is set.
The keyboard transmits make and break keycodes for each key press and release. Appendix D provides the codes for the individual keys, bit 7 being set for break and cleared for make.
To differentiate the keyboard codes from the data packets transmitted to and from the ikbd to the main processor; the codes #$F6 to #$FF precede status information packets. The packets provide reports of mouse position and status, time of day and joystick status. The packets may be stored and used later, with the header byte removed, to restore the condition of the ikbd.