D-Bug & Automation Forum | |
D-Bug & Automation Forum >> Coding >> Atari ST/E/Falcon/TT IKBD manual
http://d-bug.mooo.com/dbugforums/cgi-bin/yabb2/YaBB.pl?num=1280676369 Message started by ggn on 01.08.10 at 15:26:08 |
Title: Atari ST/E/Falcon/TT IKBD manual Post by ggn on 01.08.10 at 15:26:08
Intelligent Keyboard (IKBD) Protocol
Introduction The Atari Corp. Intelligent Keyboard (IKBD) is a general purpose keyboard controller that is flexible enough that it can be used in a variety of products without modification. The keyboard, with its microcontroller, provides a convenient connection point for a mouse and switch-type joysticks. The IKBD processor also maintains a time-of-day clock with one second resolution. The IKBD has been designed to be general enough that it can be used with a variety of new computer products. Product variations in a number of keyswitches, mouse resolution, etc. can be accommodated. The IKBD communicates with the main processor over a high speed bi-directional serial interface. It can function in a variety of modes to facilitate different applications of the keyboard, joysticks, or mouse. Limited use of the controller is possible in applications in which only a unidirectional communications medium is available by carefully designing the default modes. Keyboard The keyboard always returns key make/break scan codes. The IKBD generates keyboard scan codes for each key press and release. The key scan make (key closure) codes start at 1, and are defined in Appendix A. For example, the ISO key position in the scan code table should exist even if no keyswitch exists in that position on a particular keyboard. The break code for each key is obtained by ORing 0x80 with the make code. The special codes 0xF6 through 0xFF are reserved for use as follows:
The two shift keys return different scan codes in this mode. The ENTER key and the RETURN key are also distinct. Mouse The mouse port should be capable of supporting a mouse with resolution of approximately 200 counts (phase changes or 'clicks') per inch of travel. The mouse should be scanned at a rate that will permit accurate tracking at velocities up to 10 inches per second. The IKBD can report mouse motion in three distinctly different ways. It can report relative motion, absolute motion in a coordinate system maintained within the IKBD, or by converting mouse motion into keyboard cursor control key equivalents. The mouse buttons can be treated as part of the mouse or as additional keyboard keys. Relative Position Reporting In relative position mode, the IKBD will return relative mouse position records whenever a mouse event occurs. A mouse event consists of a mouse button being pressed or released, or motion in either axis exceeding a settable threshold of motion. Regardless of the threshold, all bits of resolution are returned to the host computer. Note that the IKBD may return mouse relative position reports with significantly more than the threshold delta x or y. This may happen since no relative mouse motion events will be generated: (a) while the keyboard has been 'paused' ( the event will be stored until keyboard communications is resumed) (b) while any event is being transmitted. The relative mouse position record is a three byte record of the form (regardless of keyboard mode): do_relocation %111110xy ; mouse position record flag ; where y is the right button state ; and x is the left button state X ; delta x as twos complement integer Y ; delta y as twos complement integer[/code] Note that the value of the button state bits should be valid even if the MOUSE BUTTON ACTION has set the buttons to act like part of the keyboard. If the accumulated motion before the report packet is generated exceeds the +127...-128 range, the motion is broken into multiple packets. Note that the sign of the delta y reported is a function of the Y origin selected. Absolute Position reporting The IKBD can also maintain absolute mouse position. Commands exist for reseting the mouse position, setting X/Y scaling, and interrogating the current mouse position. Mouse Cursor Key Mode The IKBD can translate mouse motion into the equivalent cursor keystrokes. The number of mouse clicks per keystroke is independently programmable in each axis. The IKBD internally maintains mouse motion information to the highest resolution available, and merely generates a pair of cursor key events for each multiple of the scale factor. Mouse motion produces the cursor key make code immediately followed by the break code for the appropriate cursor key. The mouse buttons produce scan codes above those normally assigned for the largest envisioned keyboard (i.e. LEFT=0x74 & RIGHT=0x75). Joystick Joystick Event Reporting In this mode, the IKBD generates a record whenever the joystick position is changed (i.e. for each opening or closing of a joystick switch or trigger). The joystick event record is two bytes of the form: Code (] %1111111x ; Joystick event marker ; where x is Joystick 0 or 1 %x000yyyy ; where yyyy is the stick position ; and x is the trigger [/code):
Joystick Monitoring A mode is available that devotes nearly all of the keyboard communications time to reporting the state of the joystick ports at a user specifiable rate. It remains in this mode until reset or commanded into another mode. The PAUSE command in this mode not only stop the output but also temporarily stops scanning the joysticks (samples are not queued). Fire Button Monitoring A mode is provided to permit monitoring a single input bit at a high rate. In this mode the IKBD monitors the state of the Joystick 1 fire button at the maximum rate permitted by the serial communication channel. The data is packed 8 bits per byte for transmission to the host. The IKBD remains in this mode until reset or commanded into another mode. The PAUSE command in this mode not only stops the output but also temporarily stops scanning the button (samples are not queued). Joystick Key Code Mode The IKBD may be commanded to translate the use of either joystick into the equivalent cursor control keystroke(s). The IKBD provides a single breakpoint velocity joystick cursor. Joystick events produce the make code, immediately followed by the break code for the appropriate cursor motion keys. The trigger or fire buttons of the joysticks produce pseudo key scan codes above those used by the largest key matrix envisioned (i.e. JOYSTICK0=0x74, JOYSTICK1=0x75). Time-of-Day Clock The IKBD also maintains a time-of-day clock for the system. Commands are available to set and interrogate the timer-of-day clock. Time-keeping is maintained down to a resolution of one second. Status Inquiries The current state of IKBD modes and parameters may be found by sending status inquiry commands that correspond to the IKBD set commands. Power-Up Mode The keyboard controller will perform a simple self-test on power-up to detect major controller faults (ROM checksum and RAM test) and such things as stuck keys. Any keys down at power-up are presumed to be stuck, and their BREAK (sic) code is returned (which without the preceding MAKE code is a flag for a keyboard error). If the controller self-test completes without error, the code 0xF0 is returned. (This code will be used to indicate the version/release of the IKBD controller. The first release of the IKBD is version 0xF0, should there be a second release it will be 0xF1, and so on.) The IKBD defaults to a mouse position reporting with threshold of 1 unit in either axis and the Y=0 origin at the top of the screen, and joystick event reporting mode for joystick 1, with both buttons being logically assigned to the mouse. After any joystick command, the IKBD assumes that joysticks are connected to both Joystick0 and Joystick1. Any mouse command (except MOUSE DISABLE) then causes port 0 to again be scanned as if it were a mouse, and both buttons are logically connected to it. If a mouse disable command is received while port 0 is presumed to be a mouse, the button is logically assigned to Joystick1 ( until the mouse is re enabled by another mouse command). IKBD Command Set This section contains a list of commands that can be sent to the IKBD. Command codes (such as 0x00) which are not specified should perform no operation (NOPs). RESET 0x80 0x01 N.B. The RESET command is the only two byte command understood by the IKBD. Any byte following an 0x80 command byte other than 0x01 is ignored (and causes the 0x80 to be ignored). A reset may also be caused by sending a break lasting at least 200mS to the IKBD. Executing the RESET command returns the keyboard to its default (power-up) mode and parameter settings. It does not affect the time-of-day clock. The RESET command or function causes the IKBD to perform a simple self-test. If the test is successful, the IKBD will send the code of 0xF0 within 300mS of receipt of the RESET command (or the end of the break, or power-up). The IKBD will then scan the key matrix for any stuck (closed) keys. Any keys found closed will cause the break scan code to be generated (the break code arriving without being preceded by the make code is a flag for a key matrix error). SET MOUSE BUTTON ACTION Code (] 0x07 %00000mss ; mouse button action ; (m is presumed = 1 when in MOUSE KEYCODE mode) ; mss=0xy, mouse button press or release causes mouse ; position report ; where y=1, mouse key press causes absolute report ; and x=1, mouse key release causes absolute report ; mss=100, mouse buttons act like keys [/code):
Set absolute mouse position maintenance. Resets the IKBD maintained X and Y coordinates. In this mode, the value of the internally maintained coordinates does NOT wrap between 0 and large positive numbers. Excess motion below 0 is ignored. The command sets the maximum positive value that can be attained in the scaled coordinate system. Motion beyond that value is also ignored. SET MOUSE KEYCODE MOSE Code (] 0x0A deltax ; distance in X clicks to return (LEFT) or (RIGHT) deltay ; distance in Y clicks to return (UP) or (DOWN) [/code):
This command sets the threshold before a mouse event is generated. Note that it does NOT affect the resolution of the data returned to the host. This command is valid only in RELATIVE MOUSE POSITIONING mode. The thresholds default to 1 at RESET (or power-up). SET MOUSE SCALE Code (] 0x0C X ; horizontal mouse ticks per internel X Y ; vertical mouse ticks per internel Y [/code):
The INTERROGATE MOUSE POSITION command is valid when in the ABSOLUTE MOUSE POSITIONING mode, regardless of the setting of the MOUSE BUTTON ACTION. LOAD MOUSE POSITION Code (] 0x0E 0x00 ; filler XMSB ; X coordinate XLSB ; (in scaled coordinate system) YMSB ; Y coordinate YLSB [/code):
Sets the IKBD to do nothing but monitor the serial command lne, maintain the time-of-day clock, and monitor the joystick. The rate sets the interval between joystick samples. N.B. The user should not set the rate higher than the serial communications channel will allow the 2 bytes packets to be transmitted. SET FIRE BUTTON MONITORING Code (] 0x18 Returns: (as long as in mode) %bbbbbbbb ; state of the JOYSTICK1 fire button packed ; 8 bits per byte, the first sample if the MSB [/code):
In this mode, joystick 0 is scanned in a way that simulates cursor keystrokes. On initial closure, a keystroke pair (make/break) is generated. Then up to Rn tenths of seconds later, keystroke pairs are generated every Tn tenths of seconds. After the Rn breakpoint is reached, keystroke pairs are generated every Vn tenths of seconds. This provides a velocity (auto-repeat) breakpoint feature. Note that by setting RX and/or Ry to zero, the velocity feature can be disabled. The values of TX and TY then become meaningless, and the generation of cursor 'keystrokes' is set by VX and VY. DISABLE JOYSTICKS 0x1A Disable the generation of any joystick events (and scanning may be internally disabled). Any valid joystick mode command resumes joystick monitoring. (The joystick mode commands are SET JOYSTICK EVENT REPORTING, SET JOYSTICK INTERROGATION MODE, SET JOYSTICK MONITORING, SET FIRE BUTTON MONITORING, and SET JOYSTICK KEYCODE MODE.) TIME-OF-DAY CLOCK SET Code (] 0x1B YY ; year (2 least significant digits) MM ; month DD ; day hh ; hour mm ; minute ss ; second [/code):
All time-of-day is sent in packed BCD format. MEMORY LOAD Code (] 0x20 ADRMSB ; address in controller ADRLSB ; memory to be loaded NUM ; number of bytes (0-128) { data } [/code):
This command permits the host to read from the IKBD controller memory. CONTROLLER EXECUTE Code (] 0x22 ADRMSB ; address of subroutine in ADRLSB ; controller memory to be called [/code):
The STATUS INQUIRY commands request the ikbd to return either the current mode or the parameters associated with a given command. All status reports are padded to form 8 byte long return packets. The responses to the status requests are designed so that the host may store them away (after stripping off the status report header byte) and later send them back as commands to IKBD to restore its state. The 0 pad bytes will be treated as NOPs by the IKBD. Valid STATUS INQUIRY commands are: Code (] 0x87 mouse button action 0x88 mouse mode 0x89 0x8A 0x8B mnouse threshold 0x8C mouse scale 0x8F mouse vertical coordinates 0x90 ( returns 0x0F Y=0 at bottom 0x10 Y=0 at top ) 0x92 mouse enable/disable ( returns 0x00 enabled) 0x12 disabled ) 0x94 joystick mode 0x95 0x96 0x9A joystick enable/disable ( returns 0x00 enabled 0x1A disabled ) [/code):
|
D-Bug & Automation Forum » Powered by YaBB 2.6.0! YaBB Forum Software © 2000-2024. All Rights Reserved. |