Back to home page

OSCL-LXR

 
 

    


0001 ====================================
0002 Intelligent Keyboard (ikbd) Protocol
0003 ====================================
0004 
0005 
0006 Introduction
0007 ============
0008 
0009 The Atari Corp. Intelligent Keyboard (ikbd) is a general purpose keyboard
0010 controller that is flexible enough that it can be used in a variety of
0011 products without modification. The keyboard, with its microcontroller,
0012 provides a convenient connection point for a mouse and switch-type joysticks.
0013 The ikbd processor also maintains a time-of-day clock with one second
0014 resolution.
0015 The ikbd has been designed to be general enough that it can be used with a
0016 variety of new computer products. Product variations in a number of
0017 keyswitches, mouse resolution, etc. can be accommodated.
0018 The ikbd communicates with the main processor over a high speed bi-directional
0019 serial interface. It can function in a variety of modes to facilitate
0020 different applications of the keyboard,  joysticks, or mouse. Limited use of
0021 the controller is possible in applications in which only a unidirectional
0022 communications medium is available by carefully designing the default modes.
0023 
0024 Keyboard
0025 ========
0026 
0027 The keyboard always returns key make/break scan codes. The ikbd generates
0028 keyboard scan codes for each key press and release. The key scan make (key
0029 closure) codes start at 1, and are defined in Appendix A. For example, the
0030 ISO key position in the scan code table should exist even if no keyswitch
0031 exists in that position on a particular keyboard. The break code for each key
0032 is obtained by ORing 0x80 with the make code.
0033 
0034 The special codes 0xF6 through 0xFF are reserved for use as follows:
0035 
0036 =================== ====================================================
0037     Code            Command
0038 =================== ====================================================
0039     0xF6            status report
0040     0xF7            absolute mouse position record
0041     0xF8-0xFB       relative mouse position records (lsbs determined by
0042                     mouse button states)
0043     0xFC            time-of-day
0044     0xFD            joystick report (both sticks)
0045     0xFE            joystick 0 event
0046     0xFF            joystick 1 event
0047 =================== ====================================================
0048 
0049 The two shift keys return different scan codes in this mode. The ENTER key
0050 and the RETurn key are also distinct.
0051 
0052 Mouse
0053 =====
0054 
0055 The mouse port should be capable of supporting a mouse with resolution of
0056 approximately 200 counts (phase changes or 'clicks') per inch of travel. The
0057 mouse should be scanned at a rate that will permit accurate tracking at
0058 velocities up to 10 inches per second.
0059 The ikbd can report mouse motion in three distinctly different ways. It can
0060 report relative motion, absolute motion in a coordinate system maintained
0061 within the ikbd, or by converting mouse motion into keyboard cursor control
0062 key equivalents.
0063 The mouse buttons can be treated as part of the mouse or as additional
0064 keyboard keys.
0065 
0066 Relative Position Reporting
0067 ---------------------------
0068 
0069 In relative position mode, the ikbd will return relative mouse position
0070 records whenever a mouse event occurs. A mouse event consists of a mouse
0071 button being pressed or released, or motion in either axis exceeding a
0072 settable threshold of motion. Regardless of the threshold, all bits of
0073 resolution are returned to the host computer.
0074 Note that the ikbd may return mouse relative position reports with
0075 significantly more than the threshold delta x or y. This may happen since no
0076 relative mouse motion events will be generated: (a) while the keyboard has
0077 been 'paused' ( the event will be stored until keyboard communications is
0078 resumed) (b) while any event is being transmitted.
0079 
0080 The relative mouse position record is a three byte record of the form
0081 (regardless of keyboard mode)::
0082 
0083     %111110xy           ; mouse position record flag
0084                         ; where y is the right button state
0085                         ; and x is the left button state
0086     X                   ; delta x as twos complement integer
0087     Y                   ; delta y as twos complement integer
0088 
0089 Note that the value of the button state bits should be valid even if the
0090 MOUSE BUTTON ACTION has set the buttons to act like part of the keyboard.
0091 If the accumulated motion before the report packet is generated exceeds the
0092 +127...-128 range, the motion is broken into multiple packets.
0093 Note that the sign of the delta y reported is a function of the Y origin
0094 selected.
0095 
0096 Absolute Position reporting
0097 ---------------------------
0098 
0099 The ikbd can also maintain absolute mouse position. Commands exist for
0100 resetting the mouse position, setting X/Y scaling, and interrogating the
0101 current mouse position.
0102 
0103 Mouse Cursor Key Mode
0104 ---------------------
0105 
0106 The ikbd can translate mouse motion into the equivalent cursor keystrokes.
0107 The number of mouse clicks per keystroke is independently programmable in
0108 each axis. The ikbd internally maintains mouse motion information to the
0109 highest resolution available, and merely generates a pair of cursor key events
0110 for each multiple of the scale factor.
0111 Mouse motion produces the cursor key make code immediately followed by the
0112 break code for the appropriate cursor key. The mouse buttons produce scan
0113 codes above those normally assigned for the largest envisioned keyboard (i.e.
0114 LEFT=0x74 & RIGHT=0x75).
0115 
0116 Joystick
0117 ========
0118 
0119 Joystick Event Reporting
0120 ------------------------
0121 
0122 In this mode, the ikbd generates a record whenever the joystick position is
0123 changed (i.e. for each opening or closing of a joystick switch or trigger).
0124 
0125 The joystick event record is two bytes of the form::
0126 
0127     %1111111x           ; Joystick event marker
0128                         ; where x is Joystick 0 or 1
0129     %x000yyyy           ; where yyyy is the stick position
0130                         ; and x is the trigger
0131 
0132 Joystick Interrogation
0133 ----------------------
0134 
0135 The current state of the joystick ports may be interrogated at any time in
0136 this mode by sending an 'Interrogate Joystick' command to the ikbd.
0137 
0138 The ikbd response to joystick interrogation is a three byte report of the form::
0139 
0140     0xFD                ; joystick report header
0141     %x000yyyy           ; Joystick 0
0142     %x000yyyy           ; Joystick 1
0143                         ; where x is the trigger
0144                         ; and yyy is the stick position
0145 
0146 Joystick Monitoring
0147 -------------------
0148 
0149 A mode is available that devotes nearly all of the keyboard communications
0150 time to reporting the state of the joystick ports at a user specifiable rate.
0151 It remains in this mode until reset or commanded into another mode. The PAUSE
0152 command in this mode not only stop the output but also temporarily stops
0153 scanning the joysticks (samples are not queued).
0154 
0155 Fire Button Monitoring
0156 ----------------------
0157 
0158 A mode is provided to permit monitoring a single input bit at a high rate. In
0159 this mode the ikbd monitors the state of the Joystick 1 fire button at the
0160 maximum rate permitted by the serial communication channel. The data is packed
0161 8 bits per byte for transmission to the host. The ikbd remains in this mode
0162 until reset or commanded into another mode. The PAUSE command in this mode not
0163 only stops the output but also temporarily stops scanning the button (samples
0164 are not queued).
0165 
0166 Joystick Key Code Mode
0167 ----------------------
0168 
0169 The ikbd may be commanded to translate the use of either joystick into the
0170 equivalent cursor control keystroke(s). The ikbd provides a single breakpoint
0171 velocity joystick cursor.
0172 Joystick events produce the make code, immediately followed by the break code
0173 for the appropriate cursor motion keys. The trigger or fire buttons of the
0174 joysticks produce pseudo key scan codes above those used by the largest key
0175 matrix envisioned (i.e. JOYSTICK0=0x74, JOYSTICK1=0x75).
0176 
0177 Time-of-Day Clock
0178 =================
0179 
0180 The ikbd also maintains a time-of-day clock for the system. Commands are
0181 available to set and interrogate the timer-of-day clock. Time-keeping is
0182 maintained down to a resolution of one second.
0183 
0184 Status Inquiries
0185 ================
0186 
0187 The current state of ikbd modes and parameters may be found by sending status
0188 inquiry commands that correspond to the ikbd set commands.
0189 
0190 Power-Up Mode
0191 =============
0192 
0193 The keyboard controller will perform a simple self-test on power-up to detect
0194 major controller faults (ROM checksum and RAM test) and such things as stuck
0195 keys. Any keys down at power-up are presumed to be stuck, and their BREAK
0196 (sic) code is returned (which without the preceding MAKE code is a flag for a
0197 keyboard error). If the controller self-test completes without error, the code
0198 0xF0 is returned. (This code will be used to indicate the version/release of
0199 the ikbd controller. The first release of the ikbd is version 0xF0, should
0200 there be a second release it will be 0xF1, and so on.)
0201 The ikbd defaults to a mouse position reporting with threshold of 1 unit in
0202 either axis and the Y=0 origin at the top of the screen, and joystick event
0203 reporting mode for joystick 1, with both buttons being logically assigned to
0204 the mouse. After any joystick command, the ikbd assumes that joysticks are
0205 connected to both Joystick0 and Joystick1. Any mouse command (except MOUSE
0206 DISABLE) then causes port 0 to again be scanned as if it were a mouse, and
0207 both buttons are logically connected to it. If a mouse disable command is
0208 received while port 0 is presumed to be a mouse, the button is logically
0209 assigned to Joystick1 (until the mouse is reenabled by another mouse command).
0210 
0211 ikbd Command Set
0212 ================
0213 
0214 This section contains a list of commands that can be sent to the ikbd. Command
0215 codes (such as 0x00) which are not specified should perform no operation
0216 (NOPs).
0217 
0218 RESET
0219 -----
0220 
0221 ::
0222 
0223     0x80
0224     0x01
0225 
0226 N.B. The RESET command is the only two byte command understood by the ikbd.
0227 Any byte following an 0x80 command byte other than 0x01 is ignored (and causes
0228 the 0x80 to be ignored).
0229 A reset may also be caused by sending a break lasting at least 200mS to the
0230 ikbd.
0231 Executing the RESET command returns the keyboard to its default (power-up)
0232 mode and parameter settings. It does not affect the time-of-day clock.
0233 The RESET command or function causes the ikbd to perform a simple self-test.
0234 If the test is successful, the ikbd will send the code of 0xF0 within 300mS
0235 of receipt of the RESET command (or the end of the break, or power-up). The
0236 ikbd will then scan the key matrix for any stuck (closed) keys. Any keys found
0237 closed will cause the break scan code to be generated (the break code arriving
0238 without being preceded by the make code is a flag for a key matrix error).
0239 
0240 SET MOUSE BUTTON ACTION
0241 -----------------------
0242 
0243 ::
0244 
0245     0x07
0246     %00000mss           ; mouse button action
0247                         ;       (m is presumed = 1 when in MOUSE KEYCODE mode)
0248                         ; mss=0xy, mouse button press or release causes mouse
0249                         ;  position report
0250                         ;  where y=1, mouse key press causes absolute report
0251                         ;  and x=1, mouse key release causes absolute report
0252                         ; mss=100, mouse buttons act like keys
0253 
0254 This command sets how the ikbd should treat the buttons on the mouse. The
0255 default mouse button action mode is %00000000, the buttons are treated as part
0256 of the mouse logically.
0257 When buttons act like keys, LEFT=0x74 & RIGHT=0x75.
0258 
0259 SET RELATIVE MOUSE POSITION REPORTING
0260 -------------------------------------
0261 
0262 ::
0263 
0264     0x08
0265 
0266 Set relative mouse position reporting. (DEFAULT) Mouse position packets are
0267 generated asynchronously by the ikbd whenever motion exceeds the setable
0268 threshold in either axis (see SET MOUSE THRESHOLD). Depending upon the mouse
0269 key mode, mouse position reports may also be generated when either mouse
0270 button is pressed or released. Otherwise the mouse buttons behave as if they
0271 were keyboard keys.
0272 
0273 SET ABSOLUTE MOUSE POSITIONING
0274 ------------------------------
0275 
0276 ::
0277 
0278     0x09
0279     XMSB                ; X maximum (in scaled mouse clicks)
0280     XLSB
0281     YMSB                ; Y maximum (in scaled mouse clicks)
0282     YLSB
0283 
0284 Set absolute mouse position maintenance. Resets the ikbd maintained X and Y
0285 coordinates.
0286 In this mode, the value of the internally maintained coordinates does NOT wrap
0287 between 0 and large positive numbers. Excess motion below 0 is ignored. The
0288 command sets the maximum positive value that can be attained in the scaled
0289 coordinate system. Motion beyond that value is also ignored.
0290 
0291 SET MOUSE KEYCODE MODE
0292 ----------------------
0293 
0294 ::
0295 
0296     0x0A
0297     deltax              ; distance in X clicks to return (LEFT) or (RIGHT)
0298     deltay              ; distance in Y clicks to return (UP) or (DOWN)
0299 
0300 Set mouse monitoring routines to return cursor motion keycodes instead of
0301 either RELATIVE or ABSOLUTE motion records. The ikbd returns the appropriate
0302 cursor keycode after mouse travel exceeding the user specified deltas in
0303 either axis. When the keyboard is in key scan code mode, mouse motion will
0304 cause the make code immediately followed by the break code. Note that this
0305 command is not affected by the mouse motion origin.
0306 
0307 SET MOUSE THRESHOLD
0308 -------------------
0309 
0310 ::
0311 
0312     0x0B
0313     X                   ; x threshold in mouse ticks (positive integers)
0314     Y                   ; y threshold in mouse ticks (positive integers)
0315 
0316 This command sets the threshold before a mouse event is generated. Note that
0317 it does NOT affect the resolution of the data returned to the host. This
0318 command is valid only in RELATIVE MOUSE POSITIONING mode. The thresholds
0319 default to 1 at RESET (or power-up).
0320 
0321 SET MOUSE SCALE
0322 ---------------
0323 
0324 ::
0325 
0326     0x0C
0327     X                   ; horizontal mouse ticks per internal X
0328     Y                   ; vertical mouse ticks per internal Y
0329 
0330 This command sets the scale factor for the ABSOLUTE MOUSE POSITIONING mode.
0331 In this mode, the specified number of mouse phase changes ('clicks') must
0332 occur before the internally maintained coordinate is changed by one
0333 (independently scaled for each axis). Remember that the mouse position
0334 information is available only by interrogating the ikbd in the ABSOLUTE MOUSE
0335 POSITIONING mode unless the ikbd has been commanded to report on button press
0336 or release (see SET MOUSE BUTTON ACTION).
0337 
0338 INTERROGATE MOUSE POSITION
0339 --------------------------
0340 
0341 ::
0342 
0343     0x0D
0344     Returns:
0345             0xF7       ; absolute mouse position header
0346     BUTTONS
0347             0000dcba   ; where a is right button down since last interrogation
0348                        ; b is right button up since last
0349                        ; c is left button down since last
0350                        ; d is left button up since last
0351             XMSB       ; X coordinate
0352             XLSB
0353             YMSB       ; Y coordinate
0354             YLSB
0355 
0356 The INTERROGATE MOUSE POSITION command is valid when in the ABSOLUTE MOUSE
0357 POSITIONING mode, regardless of the setting of the MOUSE BUTTON ACTION.
0358 
0359 LOAD MOUSE POSITION
0360 -------------------
0361 
0362 ::
0363 
0364     0x0E
0365     0x00                ; filler
0366     XMSB                ; X coordinate
0367     XLSB                ; (in scaled coordinate system)
0368     YMSB                ; Y coordinate
0369     YLSB
0370 
0371 This command allows the user to preset the internally maintained absolute
0372 mouse position.
0373 
0374 SET Y=0 AT BOTTOM
0375 -----------------
0376 
0377 ::
0378 
0379     0x0F
0380 
0381 This command makes the origin of the Y axis to be at the bottom of the
0382 logical coordinate system internal to the ikbd for all relative or absolute
0383 mouse motion. This causes mouse motion toward the user to be negative in sign
0384 and away from the user to be positive.
0385 
0386 SET Y=0 AT TOP
0387 --------------
0388 
0389 ::
0390 
0391     0x10
0392 
0393 Makes the origin of the Y axis to be at the top of the logical coordinate
0394 system within the ikbd for all relative or absolute mouse motion. (DEFAULT)
0395 This causes mouse motion toward the user to be positive in sign and away from
0396 the user to be negative.
0397 
0398 RESUME
0399 ------
0400 
0401 ::
0402 
0403     0x11
0404 
0405 Resume sending data to the host. Since any command received by the ikbd after
0406 its output has been paused also causes an implicit RESUME this command can be
0407 thought of as a NO OPERATION command. If this command is received by the ikbd
0408 and it is not PAUSED, it is simply ignored.
0409 
0410 DISABLE MOUSE
0411 -------------
0412 
0413 ::
0414 
0415     0x12
0416 
0417 All mouse event reporting is disabled (and scanning may be internally
0418 disabled). Any valid mouse mode command resumes mouse motion monitoring. (The
0419 valid mouse mode commands are SET RELATIVE MOUSE POSITION REPORTING, SET
0420 ABSOLUTE MOUSE POSITIONING, and SET MOUSE KEYCODE MODE. )
0421 N.B. If the mouse buttons have been commanded to act like keyboard keys, this
0422 command DOES affect their actions.
0423 
0424 PAUSE OUTPUT
0425 ------------
0426 
0427 ::
0428 
0429     0x13
0430 
0431 Stop sending data to the host until another valid command is received. Key
0432 matrix activity is still monitored and scan codes or ASCII characters enqueued
0433 (up to the maximum supported by the microcontroller) to be sent when the host
0434 allows the output to be resumed. If in the JOYSTICK EVENT REPORTING mode,
0435 joystick events are also queued.
0436 Mouse motion should be accumulated while the output is paused. If the ikbd is
0437 in RELATIVE MOUSE POSITIONING REPORTING mode, motion is accumulated beyond the
0438 normal threshold limits to produce the minimum number of packets necessary for
0439 transmission when output is resumed. Pressing or releasing either mouse button
0440 causes any accumulated motion to be immediately queued as packets, if the
0441 mouse is in RELATIVE MOUSE POSITION REPORTING mode.
0442 Because of the limitations of the microcontroller memory this command should
0443 be used sparingly, and the output should not be shut of for more than <tbd>
0444 milliseconds at a time.
0445 The output is stopped only at the end of the current 'even'. If the PAUSE
0446 OUTPUT command is received in the middle of a multiple byte report, the packet
0447 will still be transmitted to conclusion and then the PAUSE will take effect.
0448 When the ikbd is in either the JOYSTICK MONITORING mode or the FIRE BUTTON
0449 MONITORING mode, the PAUSE OUTPUT command also temporarily stops the
0450 monitoring process (i.e. the samples are not enqueued for transmission).
0451 
0452 SET JOYSTICK EVENT REPORTING
0453 ----------------------------
0454 
0455 ::
0456 
0457     0x14
0458 
0459 Enter JOYSTICK EVENT REPORTING mode (DEFAULT). Each opening or closure of a
0460 joystick switch or trigger causes a joystick event record to be generated.
0461 
0462 SET JOYSTICK INTERROGATION MODE
0463 -------------------------------
0464 
0465 ::
0466 
0467     0x15
0468 
0469 Disables JOYSTICK EVENT REPORTING. Host must send individual JOYSTICK
0470 INTERROGATE commands to sense joystick state.
0471 
0472 JOYSTICK INTERROGATE
0473 --------------------
0474 
0475 ::
0476 
0477     0x16
0478 
0479 Return a record indicating the current state of the joysticks. This command
0480 is valid in either the JOYSTICK EVENT REPORTING mode or the JOYSTICK
0481 INTERROGATION MODE.
0482 
0483 SET JOYSTICK MONITORING
0484 -----------------------
0485 
0486 ::
0487 
0488     0x17
0489     rate                ; time between samples in hundredths of a second
0490     Returns: (in packets of two as long as in mode)
0491             %000000xy   ; where y is JOYSTICK1 Fire button
0492                         ; and x is JOYSTICK0 Fire button
0493             %nnnnmmmm   ; where m is JOYSTICK1 state
0494                         ; and n is JOYSTICK0 state
0495 
0496 Sets the ikbd to do nothing but monitor the serial command line, maintain the
0497 time-of-day clock, and monitor the joystick. The rate sets the interval
0498 between joystick samples.
0499 N.B. The user should not set the rate higher than the serial communications
0500 channel will allow the 2 bytes packets to be transmitted.
0501 
0502 SET FIRE BUTTON MONITORING
0503 --------------------------
0504 
0505 ::
0506 
0507     0x18
0508     Returns: (as long as in mode)
0509             %bbbbbbbb   ; state of the JOYSTICK1 fire button packed
0510                         ; 8 bits per byte, the first sample if the MSB
0511 
0512 Set the ikbd to do nothing but monitor the serial command line, maintain the
0513 time-of-day clock, and monitor the fire button on Joystick 1. The fire button
0514 is scanned at a rate that causes 8 samples to be made in the time it takes for
0515 the previous byte to be sent to the host (i.e. scan rate = 8/10 * baud rate).
0516 The sample interval should be as constant as possible.
0517 
0518 SET JOYSTICK KEYCODE MODE
0519 -------------------------
0520 
0521 ::
0522 
0523     0x19
0524     RX                  ; length of time (in tenths of seconds) until
0525                         ; horizontal velocity breakpoint is reached
0526     RY                  ; length of time (in tenths of seconds) until
0527                         ; vertical velocity breakpoint is reached
0528     TX                  ; length (in tenths of seconds) of joystick closure
0529                         ; until horizontal cursor key is generated before RX
0530                         ; has elapsed
0531     TY                  ; length (in tenths of seconds) of joystick closure
0532                         ; until vertical cursor key is generated before RY
0533                         ; has elapsed
0534     VX                  ; length (in tenths of seconds) of joystick closure
0535                         ; until horizontal cursor keystrokes are generated
0536                         ; after RX has elapsed
0537     VY                  ; length (in tenths of seconds) of joystick closure
0538                         ; until vertical cursor keystrokes are generated
0539                         ; after RY has elapsed
0540 
0541 In this mode, joystick 0 is scanned in a way that simulates cursor keystrokes.
0542 On initial closure, a keystroke pair (make/break) is generated. Then up to Rn
0543 tenths of seconds later, keystroke pairs are generated every Tn tenths of
0544 seconds. After the Rn breakpoint is reached, keystroke pairs are generated
0545 every Vn tenths of seconds. This provides a velocity (auto-repeat) breakpoint
0546 feature.
0547 Note that by setting RX and/or Ry to zero, the velocity feature can be
0548 disabled. The values of TX and TY then become meaningless, and the generation
0549 of cursor 'keystrokes' is set by VX and VY.
0550 
0551 DISABLE JOYSTICKS
0552 -----------------
0553 
0554 ::
0555 
0556     0x1A
0557 
0558 Disable the generation of any joystick events (and scanning may be internally
0559 disabled). Any valid joystick mode command resumes joystick monitoring. (The
0560 joystick mode commands are SET JOYSTICK EVENT REPORTING, SET JOYSTICK
0561 INTERROGATION MODE, SET JOYSTICK MONITORING, SET FIRE BUTTON MONITORING, and
0562 SET JOYSTICK KEYCODE MODE.)
0563 
0564 TIME-OF-DAY CLOCK SET
0565 ---------------------
0566 
0567 ::
0568 
0569     0x1B
0570     YY                  ; year (2 least significant digits)
0571     MM                  ; month
0572     DD                  ; day
0573     hh                  ; hour
0574     mm                  ; minute
0575     ss                  ; second
0576 
0577 All time-of-day data should be sent to the ikbd in packed BCD format.
0578 Any digit that is not a valid BCD digit should be treated as a 'don't care'
0579 and not alter that particular field of the date or time. This permits setting
0580 only some subfields of the time-of-day clock.
0581 
0582 INTERROGATE TIME-OF-DAT CLOCK
0583 -----------------------------
0584 
0585 ::
0586 
0587     0x1C
0588     Returns:
0589             0xFC        ; time-of-day event header
0590             YY          ; year (2 least significant digits)
0591             MM          ; month
0592             DD          ; day
0593             hh          ; hour
0594             mm          ; minute
0595             ss          ; second
0596 
0597     All time-of-day is sent in packed BCD format.
0598 
0599 MEMORY LOAD
0600 -----------
0601 
0602 ::
0603 
0604     0x20
0605     ADRMSB              ; address in controller
0606     ADRLSB              ; memory to be loaded
0607     NUM                 ; number of bytes (0-128)
0608     { data }
0609 
0610 This command permits the host to load arbitrary values into the ikbd
0611 controller memory. The time between data bytes must be less than 20ms.
0612 
0613 MEMORY READ
0614 -----------
0615 
0616 ::
0617 
0618     0x21
0619     ADRMSB              ; address in controller
0620     ADRLSB              ; memory to be read
0621     Returns:
0622             0xF6        ; status header
0623             0x20        ; memory access
0624             { data }    ; 6 data bytes starting at ADR
0625 
0626 This command permits the host to read from the ikbd controller memory.
0627 
0628 CONTROLLER EXECUTE
0629 ------------------
0630 
0631 ::
0632 
0633     0x22
0634     ADRMSB              ; address of subroutine in
0635     ADRLSB              ; controller memory to be called
0636 
0637 This command allows the host to command the execution of a subroutine in the
0638 ikbd controller memory.
0639 
0640 STATUS INQUIRIES
0641 ----------------
0642 
0643 ::
0644 
0645     Status commands are formed by inclusively ORing 0x80 with the
0646     relevant SET command.
0647 
0648     Example:
0649     0x88 (or 0x89 or 0x8A)  ; request mouse mode
0650     Returns:
0651             0xF6        ; status response header
0652             mode        ; 0x08 is RELATIVE
0653                         ; 0x09 is ABSOLUTE
0654                         ; 0x0A is KEYCODE
0655             param1      ; 0 is RELATIVE
0656                         ; XMSB maximum if ABSOLUTE
0657                         ; DELTA X is KEYCODE
0658             param2      ; 0 is RELATIVE
0659                         ; YMSB maximum if ABSOLUTE
0660                         ; DELTA Y is KEYCODE
0661             param3      ; 0 if RELATIVE
0662                         ; or KEYCODE
0663                         ; YMSB is ABSOLUTE
0664             param4      ; 0 if RELATIVE
0665                         ; or KEYCODE
0666                         ; YLSB is ABSOLUTE
0667             0           ; pad
0668             0
0669 
0670 The STATUS INQUIRY commands request the ikbd to return either the current mode
0671 or the parameters associated with a given command. All status reports are
0672 padded to form 8 byte long return packets. The responses to the status
0673 requests are designed so that the host may store them away (after stripping
0674 off the status report header byte) and later send them back as commands to
0675 ikbd to restore its state. The 0 pad bytes will be treated as NOPs by the
0676 ikbd.
0677 
0678     Valid STATUS INQUIRY commands are::
0679 
0680             0x87    mouse button action
0681             0x88    mouse mode
0682             0x89
0683             0x8A
0684             0x8B    mnouse threshold
0685             0x8C    mouse scale
0686             0x8F    mouse vertical coordinates
0687             0x90    ( returns       0x0F Y=0 at bottom
0688                             0x10 Y=0 at top )
0689             0x92    mouse enable/disable
0690                     ( returns       0x00 enabled)
0691                             0x12 disabled )
0692             0x94    joystick mode
0693             0x95
0694             0x96
0695             0x9A    joystick enable/disable
0696                     ( returns       0x00 enabled
0697                             0x1A disabled )
0698 
0699 It is the (host) programmer's responsibility to have only one unanswered
0700 inquiry in process at a time.
0701 STATUS INQUIRY commands are not valid if the ikbd is in JOYSTICK MONITORING
0702 mode or FIRE BUTTON MONITORING mode.
0703 
0704 
0705 SCAN CODES
0706 ==========
0707 
0708 The key scan codes returned by the ikbd are chosen to simplify the
0709 implementation of GSX.
0710 
0711 GSX Standard Keyboard Mapping
0712 
0713 ======= ============
0714 Hex     Keytop
0715 ======= ============
0716 01      Esc
0717 02      1
0718 03      2
0719 04      3
0720 05      4
0721 06      5
0722 07      6
0723 08      7
0724 09      8
0725 0A      9
0726 0B      0
0727 0C      \-
0728 0D      \=
0729 0E      BS
0730 0F      TAB
0731 10      Q
0732 11      W
0733 12      E
0734 13      R
0735 14      T
0736 15      Y
0737 16      U
0738 17      I
0739 18      O
0740 19      P
0741 1A      [
0742 1B      ]
0743 1C      RET
0744 1D      CTRL
0745 1E      A
0746 1F      S
0747 20      D
0748 21      F
0749 22      G
0750 23      H
0751 24      J
0752 25      K
0753 26      L
0754 27      ;
0755 28      '
0756 29      \`
0757 2A      (LEFT) SHIFT
0758 2B      \\
0759 2C      Z
0760 2D      X
0761 2E      C
0762 2F      V
0763 30      B
0764 31      N
0765 32      M
0766 33      ,
0767 34      .
0768 35      /
0769 36      (RIGHT) SHIFT
0770 37      { NOT USED }
0771 38      ALT
0772 39      SPACE BAR
0773 3A      CAPS LOCK
0774 3B      F1
0775 3C      F2
0776 3D      F3
0777 3E      F4
0778 3F      F5
0779 40      F6
0780 41      F7
0781 42      F8
0782 43      F9
0783 44      F10
0784 45      { NOT USED }
0785 46      { NOT USED }
0786 47      HOME
0787 48      UP ARROW
0788 49      { NOT USED }
0789 4A      KEYPAD -
0790 4B      LEFT ARROW
0791 4C      { NOT USED }
0792 4D      RIGHT ARROW
0793 4E      KEYPAD +
0794 4F      { NOT USED }
0795 50      DOWN ARROW
0796 51      { NOT USED }
0797 52      INSERT
0798 53      DEL
0799 54      { NOT USED }
0800 5F      { NOT USED }
0801 60      ISO KEY
0802 61      UNDO
0803 62      HELP
0804 63      KEYPAD (
0805 64      KEYPAD /
0806 65      KEYPAD *
0807 66      KEYPAD *
0808 67      KEYPAD 7
0809 68      KEYPAD 8
0810 69      KEYPAD 9
0811 6A      KEYPAD 4
0812 6B      KEYPAD 5
0813 6C      KEYPAD 6
0814 6D      KEYPAD 1
0815 6E      KEYPAD 2
0816 6F      KEYPAD 3
0817 70      KEYPAD 0
0818 71      KEYPAD .
0819 72      KEYPAD ENTER
0820 ======= ============