xref: /linux/Documentation/input/devices/atarikbd.rst (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1b08c118cSDmitry Torokhov====================================
2b08c118cSDmitry TorokhovIntelligent Keyboard (ikbd) Protocol
3b08c118cSDmitry Torokhov====================================
4b08c118cSDmitry Torokhov
5b08c118cSDmitry Torokhov
6b08c118cSDmitry TorokhovIntroduction
7b08c118cSDmitry Torokhov============
8b08c118cSDmitry Torokhov
9b08c118cSDmitry TorokhovThe Atari Corp. Intelligent Keyboard (ikbd) is a general purpose keyboard
10b08c118cSDmitry Torokhovcontroller that is flexible enough that it can be used in a variety of
11b08c118cSDmitry Torokhovproducts without modification. The keyboard, with its microcontroller,
12b08c118cSDmitry Torokhovprovides a convenient connection point for a mouse and switch-type joysticks.
13b08c118cSDmitry TorokhovThe ikbd processor also maintains a time-of-day clock with one second
14b08c118cSDmitry Torokhovresolution.
15b08c118cSDmitry TorokhovThe ikbd has been designed to be general enough that it can be used with a
16b08c118cSDmitry Torokhovvariety of new computer products. Product variations in a number of
17b08c118cSDmitry Torokhovkeyswitches, mouse resolution, etc. can be accommodated.
18b08c118cSDmitry TorokhovThe ikbd communicates with the main processor over a high speed bi-directional
19b08c118cSDmitry Torokhovserial interface. It can function in a variety of modes to facilitate
20b08c118cSDmitry Torokhovdifferent applications of the keyboard,  joysticks, or mouse. Limited use of
21b08c118cSDmitry Torokhovthe controller is possible in applications in which only a unidirectional
22b08c118cSDmitry Torokhovcommunications medium is available by carefully designing the default modes.
23b08c118cSDmitry Torokhov
24b08c118cSDmitry TorokhovKeyboard
25b08c118cSDmitry Torokhov========
26b08c118cSDmitry Torokhov
27b08c118cSDmitry TorokhovThe keyboard always returns key make/break scan codes. The ikbd generates
28b08c118cSDmitry Torokhovkeyboard scan codes for each key press and release. The key scan make (key
29b08c118cSDmitry Torokhovclosure) codes start at 1, and are defined in Appendix A. For example, the
30b08c118cSDmitry TorokhovISO key position in the scan code table should exist even if no keyswitch
31b08c118cSDmitry Torokhovexists in that position on a particular keyboard. The break code for each key
32b08c118cSDmitry Torokhovis obtained by ORing 0x80 with the make code.
33b08c118cSDmitry Torokhov
34b08c118cSDmitry TorokhovThe special codes 0xF6 through 0xFF are reserved for use as follows:
35b08c118cSDmitry Torokhov
36b08c118cSDmitry Torokhov=================== ====================================================
37b08c118cSDmitry Torokhov    Code            Command
38b08c118cSDmitry Torokhov=================== ====================================================
39b08c118cSDmitry Torokhov    0xF6            status report
40b08c118cSDmitry Torokhov    0xF7            absolute mouse position record
41b08c118cSDmitry Torokhov    0xF8-0xFB       relative mouse position records (lsbs determined by
42b08c118cSDmitry Torokhov                    mouse button states)
43b08c118cSDmitry Torokhov    0xFC            time-of-day
44b08c118cSDmitry Torokhov    0xFD            joystick report (both sticks)
45b08c118cSDmitry Torokhov    0xFE            joystick 0 event
46b08c118cSDmitry Torokhov    0xFF            joystick 1 event
47b08c118cSDmitry Torokhov=================== ====================================================
48b08c118cSDmitry Torokhov
49b08c118cSDmitry TorokhovThe two shift keys return different scan codes in this mode. The ENTER key
50b08c118cSDmitry Torokhovand the RETurn key are also distinct.
51b08c118cSDmitry Torokhov
52b08c118cSDmitry TorokhovMouse
53b08c118cSDmitry Torokhov=====
54b08c118cSDmitry Torokhov
55b08c118cSDmitry TorokhovThe mouse port should be capable of supporting a mouse with resolution of
56b08c118cSDmitry Torokhovapproximately 200 counts (phase changes or 'clicks') per inch of travel. The
57b08c118cSDmitry Torokhovmouse should be scanned at a rate that will permit accurate tracking at
58b08c118cSDmitry Torokhovvelocities up to 10 inches per second.
59b08c118cSDmitry TorokhovThe ikbd can report mouse motion in three distinctly different ways. It can
60b08c118cSDmitry Torokhovreport relative motion, absolute motion in a coordinate system maintained
61b08c118cSDmitry Torokhovwithin the ikbd, or by converting mouse motion into keyboard cursor control
62b08c118cSDmitry Torokhovkey equivalents.
63b08c118cSDmitry TorokhovThe mouse buttons can be treated as part of the mouse or as additional
64b08c118cSDmitry Torokhovkeyboard keys.
65b08c118cSDmitry Torokhov
66b08c118cSDmitry TorokhovRelative Position Reporting
67b08c118cSDmitry Torokhov---------------------------
68b08c118cSDmitry Torokhov
69b08c118cSDmitry TorokhovIn relative position mode, the ikbd will return relative mouse position
70b08c118cSDmitry Torokhovrecords whenever a mouse event occurs. A mouse event consists of a mouse
71b08c118cSDmitry Torokhovbutton being pressed or released, or motion in either axis exceeding a
72b08c118cSDmitry Torokhovsettable threshold of motion. Regardless of the threshold, all bits of
73b08c118cSDmitry Torokhovresolution are returned to the host computer.
74b08c118cSDmitry TorokhovNote that the ikbd may return mouse relative position reports with
75b08c118cSDmitry Torokhovsignificantly more than the threshold delta x or y. This may happen since no
76b08c118cSDmitry Torokhovrelative mouse motion events will be generated: (a) while the keyboard has
77b08c118cSDmitry Torokhovbeen 'paused' ( the event will be stored until keyboard communications is
78b08c118cSDmitry Torokhovresumed) (b) while any event is being transmitted.
79b08c118cSDmitry Torokhov
80b08c118cSDmitry TorokhovThe relative mouse position record is a three byte record of the form
81b08c118cSDmitry Torokhov(regardless of keyboard mode)::
82b08c118cSDmitry Torokhov
83b08c118cSDmitry Torokhov    %111110xy           ; mouse position record flag
84b08c118cSDmitry Torokhov                        ; where y is the right button state
85b08c118cSDmitry Torokhov                        ; and x is the left button state
86b08c118cSDmitry Torokhov    X                   ; delta x as twos complement integer
87b08c118cSDmitry Torokhov    Y                   ; delta y as twos complement integer
88b08c118cSDmitry Torokhov
89b08c118cSDmitry TorokhovNote that the value of the button state bits should be valid even if the
90b08c118cSDmitry TorokhovMOUSE BUTTON ACTION has set the buttons to act like part of the keyboard.
91b08c118cSDmitry TorokhovIf the accumulated motion before the report packet is generated exceeds the
92b08c118cSDmitry Torokhov+127...-128 range, the motion is broken into multiple packets.
93b08c118cSDmitry TorokhovNote that the sign of the delta y reported is a function of the Y origin
94b08c118cSDmitry Torokhovselected.
95b08c118cSDmitry Torokhov
96b08c118cSDmitry TorokhovAbsolute Position reporting
97b08c118cSDmitry Torokhov---------------------------
98b08c118cSDmitry Torokhov
99b08c118cSDmitry TorokhovThe ikbd can also maintain absolute mouse position. Commands exist for
100b08c118cSDmitry Torokhovresetting the mouse position, setting X/Y scaling, and interrogating the
101b08c118cSDmitry Torokhovcurrent mouse position.
102b08c118cSDmitry Torokhov
103b08c118cSDmitry TorokhovMouse Cursor Key Mode
104b08c118cSDmitry Torokhov---------------------
105b08c118cSDmitry Torokhov
106b08c118cSDmitry TorokhovThe ikbd can translate mouse motion into the equivalent cursor keystrokes.
107b08c118cSDmitry TorokhovThe number of mouse clicks per keystroke is independently programmable in
108b08c118cSDmitry Torokhoveach axis. The ikbd internally maintains mouse motion information to the
109b08c118cSDmitry Torokhovhighest resolution available, and merely generates a pair of cursor key events
110b08c118cSDmitry Torokhovfor each multiple of the scale factor.
111b08c118cSDmitry TorokhovMouse motion produces the cursor key make code immediately followed by the
112b08c118cSDmitry Torokhovbreak code for the appropriate cursor key. The mouse buttons produce scan
113b08c118cSDmitry Torokhovcodes above those normally assigned for the largest envisioned keyboard (i.e.
114b08c118cSDmitry TorokhovLEFT=0x74 & RIGHT=0x75).
115b08c118cSDmitry Torokhov
116b08c118cSDmitry TorokhovJoystick
117b08c118cSDmitry Torokhov========
118b08c118cSDmitry Torokhov
119b08c118cSDmitry TorokhovJoystick Event Reporting
120b08c118cSDmitry Torokhov------------------------
121b08c118cSDmitry Torokhov
122b08c118cSDmitry TorokhovIn this mode, the ikbd generates a record whenever the joystick position is
123b08c118cSDmitry Torokhovchanged (i.e. for each opening or closing of a joystick switch or trigger).
124b08c118cSDmitry Torokhov
125b08c118cSDmitry TorokhovThe joystick event record is two bytes of the form::
126b08c118cSDmitry Torokhov
127b08c118cSDmitry Torokhov    %1111111x           ; Joystick event marker
128b08c118cSDmitry Torokhov                        ; where x is Joystick 0 or 1
129b08c118cSDmitry Torokhov    %x000yyyy           ; where yyyy is the stick position
130b08c118cSDmitry Torokhov                        ; and x is the trigger
131b08c118cSDmitry Torokhov
132b08c118cSDmitry TorokhovJoystick Interrogation
133b08c118cSDmitry Torokhov----------------------
134b08c118cSDmitry Torokhov
135b08c118cSDmitry TorokhovThe current state of the joystick ports may be interrogated at any time in
136b08c118cSDmitry Torokhovthis mode by sending an 'Interrogate Joystick' command to the ikbd.
137b08c118cSDmitry Torokhov
138b08c118cSDmitry TorokhovThe ikbd response to joystick interrogation is a three byte report of the form::
139b08c118cSDmitry Torokhov
140b08c118cSDmitry Torokhov    0xFD                ; joystick report header
141b08c118cSDmitry Torokhov    %x000yyyy           ; Joystick 0
142b08c118cSDmitry Torokhov    %x000yyyy           ; Joystick 1
143b08c118cSDmitry Torokhov                        ; where x is the trigger
144b08c118cSDmitry Torokhov                        ; and yyy is the stick position
145b08c118cSDmitry Torokhov
146b08c118cSDmitry TorokhovJoystick Monitoring
147b08c118cSDmitry Torokhov-------------------
148b08c118cSDmitry Torokhov
149b08c118cSDmitry TorokhovA mode is available that devotes nearly all of the keyboard communications
150b08c118cSDmitry Torokhovtime to reporting the state of the joystick ports at a user specifiable rate.
151b08c118cSDmitry TorokhovIt remains in this mode until reset or commanded into another mode. The PAUSE
152b08c118cSDmitry Torokhovcommand in this mode not only stop the output but also temporarily stops
153b08c118cSDmitry Torokhovscanning the joysticks (samples are not queued).
154b08c118cSDmitry Torokhov
155b08c118cSDmitry TorokhovFire Button Monitoring
156b08c118cSDmitry Torokhov----------------------
157b08c118cSDmitry Torokhov
158b08c118cSDmitry TorokhovA mode is provided to permit monitoring a single input bit at a high rate. In
159b08c118cSDmitry Torokhovthis mode the ikbd monitors the state of the Joystick 1 fire button at the
160b08c118cSDmitry Torokhovmaximum rate permitted by the serial communication channel. The data is packed
161b08c118cSDmitry Torokhov8 bits per byte for transmission to the host. The ikbd remains in this mode
162b08c118cSDmitry Torokhovuntil reset or commanded into another mode. The PAUSE command in this mode not
163b08c118cSDmitry Torokhovonly stops the output but also temporarily stops scanning the button (samples
164b08c118cSDmitry Torokhovare not queued).
165b08c118cSDmitry Torokhov
166b08c118cSDmitry TorokhovJoystick Key Code Mode
167b08c118cSDmitry Torokhov----------------------
168b08c118cSDmitry Torokhov
169b08c118cSDmitry TorokhovThe ikbd may be commanded to translate the use of either joystick into the
170b08c118cSDmitry Torokhovequivalent cursor control keystroke(s). The ikbd provides a single breakpoint
171b08c118cSDmitry Torokhovvelocity joystick cursor.
172b08c118cSDmitry TorokhovJoystick events produce the make code, immediately followed by the break code
173b08c118cSDmitry Torokhovfor the appropriate cursor motion keys. The trigger or fire buttons of the
174b08c118cSDmitry Torokhovjoysticks produce pseudo key scan codes above those used by the largest key
175b08c118cSDmitry Torokhovmatrix envisioned (i.e. JOYSTICK0=0x74, JOYSTICK1=0x75).
176b08c118cSDmitry Torokhov
177b08c118cSDmitry TorokhovTime-of-Day Clock
178b08c118cSDmitry Torokhov=================
179b08c118cSDmitry Torokhov
180b08c118cSDmitry TorokhovThe ikbd also maintains a time-of-day clock for the system. Commands are
181b08c118cSDmitry Torokhovavailable to set and interrogate the timer-of-day clock. Time-keeping is
182b08c118cSDmitry Torokhovmaintained down to a resolution of one second.
183b08c118cSDmitry Torokhov
184b08c118cSDmitry TorokhovStatus Inquiries
185b08c118cSDmitry Torokhov================
186b08c118cSDmitry Torokhov
187b08c118cSDmitry TorokhovThe current state of ikbd modes and parameters may be found by sending status
188b08c118cSDmitry Torokhovinquiry commands that correspond to the ikbd set commands.
189b08c118cSDmitry Torokhov
190b08c118cSDmitry TorokhovPower-Up Mode
191b08c118cSDmitry Torokhov=============
192b08c118cSDmitry Torokhov
193b08c118cSDmitry TorokhovThe keyboard controller will perform a simple self-test on power-up to detect
194b08c118cSDmitry Torokhovmajor controller faults (ROM checksum and RAM test) and such things as stuck
195b08c118cSDmitry Torokhovkeys. Any keys down at power-up are presumed to be stuck, and their BREAK
196b08c118cSDmitry Torokhov(sic) code is returned (which without the preceding MAKE code is a flag for a
197b08c118cSDmitry Torokhovkeyboard error). If the controller self-test completes without error, the code
198b08c118cSDmitry Torokhov0xF0 is returned. (This code will be used to indicate the version/release of
199b08c118cSDmitry Torokhovthe ikbd controller. The first release of the ikbd is version 0xF0, should
200b08c118cSDmitry Torokhovthere be a second release it will be 0xF1, and so on.)
201b08c118cSDmitry TorokhovThe ikbd defaults to a mouse position reporting with threshold of 1 unit in
202b08c118cSDmitry Torokhoveither axis and the Y=0 origin at the top of the screen, and joystick event
203b08c118cSDmitry Torokhovreporting mode for joystick 1, with both buttons being logically assigned to
204b08c118cSDmitry Torokhovthe mouse. After any joystick command, the ikbd assumes that joysticks are
205b08c118cSDmitry Torokhovconnected to both Joystick0 and Joystick1. Any mouse command (except MOUSE
206b08c118cSDmitry TorokhovDISABLE) then causes port 0 to again be scanned as if it were a mouse, and
207b08c118cSDmitry Torokhovboth buttons are logically connected to it. If a mouse disable command is
208b08c118cSDmitry Torokhovreceived while port 0 is presumed to be a mouse, the button is logically
209b08c118cSDmitry Torokhovassigned to Joystick1 (until the mouse is reenabled by another mouse command).
210b08c118cSDmitry Torokhov
211b08c118cSDmitry Torokhovikbd Command Set
212b08c118cSDmitry Torokhov================
213b08c118cSDmitry Torokhov
214b08c118cSDmitry TorokhovThis section contains a list of commands that can be sent to the ikbd. Command
215b08c118cSDmitry Torokhovcodes (such as 0x00) which are not specified should perform no operation
216b08c118cSDmitry Torokhov(NOPs).
217b08c118cSDmitry Torokhov
218b08c118cSDmitry TorokhovRESET
219b08c118cSDmitry Torokhov-----
220b08c118cSDmitry Torokhov
221b08c118cSDmitry Torokhov::
222b08c118cSDmitry Torokhov
223b08c118cSDmitry Torokhov    0x80
224b08c118cSDmitry Torokhov    0x01
225b08c118cSDmitry Torokhov
226b08c118cSDmitry TorokhovN.B. The RESET command is the only two byte command understood by the ikbd.
227b08c118cSDmitry TorokhovAny byte following an 0x80 command byte other than 0x01 is ignored (and causes
228b08c118cSDmitry Torokhovthe 0x80 to be ignored).
229b08c118cSDmitry TorokhovA reset may also be caused by sending a break lasting at least 200mS to the
230b08c118cSDmitry Torokhovikbd.
231b08c118cSDmitry TorokhovExecuting the RESET command returns the keyboard to its default (power-up)
232b08c118cSDmitry Torokhovmode and parameter settings. It does not affect the time-of-day clock.
233b08c118cSDmitry TorokhovThe RESET command or function causes the ikbd to perform a simple self-test.
234b08c118cSDmitry TorokhovIf the test is successful, the ikbd will send the code of 0xF0 within 300mS
235b08c118cSDmitry Torokhovof receipt of the RESET command (or the end of the break, or power-up). The
236b08c118cSDmitry Torokhovikbd will then scan the key matrix for any stuck (closed) keys. Any keys found
237b08c118cSDmitry Torokhovclosed will cause the break scan code to be generated (the break code arriving
238b08c118cSDmitry Torokhovwithout being preceded by the make code is a flag for a key matrix error).
239b08c118cSDmitry Torokhov
240b08c118cSDmitry TorokhovSET MOUSE BUTTON ACTION
241b08c118cSDmitry Torokhov-----------------------
242b08c118cSDmitry Torokhov
243b08c118cSDmitry Torokhov::
244b08c118cSDmitry Torokhov
245b08c118cSDmitry Torokhov    0x07
246b08c118cSDmitry Torokhov    %00000mss           ; mouse button action
247b08c118cSDmitry Torokhov                        ;       (m is presumed = 1 when in MOUSE KEYCODE mode)
248b08c118cSDmitry Torokhov                        ; mss=0xy, mouse button press or release causes mouse
249b08c118cSDmitry Torokhov                        ;  position report
250b08c118cSDmitry Torokhov                        ;  where y=1, mouse key press causes absolute report
251b08c118cSDmitry Torokhov                        ;  and x=1, mouse key release causes absolute report
252b08c118cSDmitry Torokhov                        ; mss=100, mouse buttons act like keys
253b08c118cSDmitry Torokhov
254b08c118cSDmitry TorokhovThis command sets how the ikbd should treat the buttons on the mouse. The
255b08c118cSDmitry Torokhovdefault mouse button action mode is %00000000, the buttons are treated as part
256b08c118cSDmitry Torokhovof the mouse logically.
257b08c118cSDmitry TorokhovWhen buttons act like keys, LEFT=0x74 & RIGHT=0x75.
258b08c118cSDmitry Torokhov
259b08c118cSDmitry TorokhovSET RELATIVE MOUSE POSITION REPORTING
260b08c118cSDmitry Torokhov-------------------------------------
261b08c118cSDmitry Torokhov
262b08c118cSDmitry Torokhov::
263b08c118cSDmitry Torokhov
264b08c118cSDmitry Torokhov    0x08
265b08c118cSDmitry Torokhov
266b08c118cSDmitry TorokhovSet relative mouse position reporting. (DEFAULT) Mouse position packets are
267b08c118cSDmitry Torokhovgenerated asynchronously by the ikbd whenever motion exceeds the setable
268b08c118cSDmitry Torokhovthreshold in either axis (see SET MOUSE THRESHOLD). Depending upon the mouse
269b08c118cSDmitry Torokhovkey mode, mouse position reports may also be generated when either mouse
270b08c118cSDmitry Torokhovbutton is pressed or released. Otherwise the mouse buttons behave as if they
271b08c118cSDmitry Torokhovwere keyboard keys.
272b08c118cSDmitry Torokhov
273b08c118cSDmitry TorokhovSET ABSOLUTE MOUSE POSITIONING
274b08c118cSDmitry Torokhov------------------------------
275b08c118cSDmitry Torokhov
276b08c118cSDmitry Torokhov::
277b08c118cSDmitry Torokhov
278b08c118cSDmitry Torokhov    0x09
279b08c118cSDmitry Torokhov    XMSB                ; X maximum (in scaled mouse clicks)
280b08c118cSDmitry Torokhov    XLSB
281b08c118cSDmitry Torokhov    YMSB                ; Y maximum (in scaled mouse clicks)
282b08c118cSDmitry Torokhov    YLSB
283b08c118cSDmitry Torokhov
284b08c118cSDmitry TorokhovSet absolute mouse position maintenance. Resets the ikbd maintained X and Y
285b08c118cSDmitry Torokhovcoordinates.
286b08c118cSDmitry TorokhovIn this mode, the value of the internally maintained coordinates does NOT wrap
287b08c118cSDmitry Torokhovbetween 0 and large positive numbers. Excess motion below 0 is ignored. The
288b08c118cSDmitry Torokhovcommand sets the maximum positive value that can be attained in the scaled
289b08c118cSDmitry Torokhovcoordinate system. Motion beyond that value is also ignored.
290b08c118cSDmitry Torokhov
291*27ff6839SRandy DunlapSET MOUSE KEYCODE MODE
292b08c118cSDmitry Torokhov----------------------
293b08c118cSDmitry Torokhov
294b08c118cSDmitry Torokhov::
295b08c118cSDmitry Torokhov
296b08c118cSDmitry Torokhov    0x0A
297b08c118cSDmitry Torokhov    deltax              ; distance in X clicks to return (LEFT) or (RIGHT)
298b08c118cSDmitry Torokhov    deltay              ; distance in Y clicks to return (UP) or (DOWN)
299b08c118cSDmitry Torokhov
300b08c118cSDmitry TorokhovSet mouse monitoring routines to return cursor motion keycodes instead of
301b08c118cSDmitry Torokhoveither RELATIVE or ABSOLUTE motion records. The ikbd returns the appropriate
302b08c118cSDmitry Torokhovcursor keycode after mouse travel exceeding the user specified deltas in
303b08c118cSDmitry Torokhoveither axis. When the keyboard is in key scan code mode, mouse motion will
304b08c118cSDmitry Torokhovcause the make code immediately followed by the break code. Note that this
305b08c118cSDmitry Torokhovcommand is not affected by the mouse motion origin.
306b08c118cSDmitry Torokhov
307b08c118cSDmitry TorokhovSET MOUSE THRESHOLD
308b08c118cSDmitry Torokhov-------------------
309b08c118cSDmitry Torokhov
310b08c118cSDmitry Torokhov::
311b08c118cSDmitry Torokhov
312b08c118cSDmitry Torokhov    0x0B
313b08c118cSDmitry Torokhov    X                   ; x threshold in mouse ticks (positive integers)
314b08c118cSDmitry Torokhov    Y                   ; y threshold in mouse ticks (positive integers)
315b08c118cSDmitry Torokhov
316b08c118cSDmitry TorokhovThis command sets the threshold before a mouse event is generated. Note that
317b08c118cSDmitry Torokhovit does NOT affect the resolution of the data returned to the host. This
318b08c118cSDmitry Torokhovcommand is valid only in RELATIVE MOUSE POSITIONING mode. The thresholds
319b08c118cSDmitry Torokhovdefault to 1 at RESET (or power-up).
320b08c118cSDmitry Torokhov
321b08c118cSDmitry TorokhovSET MOUSE SCALE
322b08c118cSDmitry Torokhov---------------
323b08c118cSDmitry Torokhov
324b08c118cSDmitry Torokhov::
325b08c118cSDmitry Torokhov
326b08c118cSDmitry Torokhov    0x0C
327b08c118cSDmitry Torokhov    X                   ; horizontal mouse ticks per internal X
328b08c118cSDmitry Torokhov    Y                   ; vertical mouse ticks per internal Y
329b08c118cSDmitry Torokhov
330b08c118cSDmitry TorokhovThis command sets the scale factor for the ABSOLUTE MOUSE POSITIONING mode.
331b08c118cSDmitry TorokhovIn this mode, the specified number of mouse phase changes ('clicks') must
332b08c118cSDmitry Torokhovoccur before the internally maintained coordinate is changed by one
333b08c118cSDmitry Torokhov(independently scaled for each axis). Remember that the mouse position
334b08c118cSDmitry Torokhovinformation is available only by interrogating the ikbd in the ABSOLUTE MOUSE
335b08c118cSDmitry TorokhovPOSITIONING mode unless the ikbd has been commanded to report on button press
336*27ff6839SRandy Dunlapor release (see SET MOUSE BUTTON ACTION).
337b08c118cSDmitry Torokhov
338b08c118cSDmitry TorokhovINTERROGATE MOUSE POSITION
339b08c118cSDmitry Torokhov--------------------------
340b08c118cSDmitry Torokhov
341b08c118cSDmitry Torokhov::
342b08c118cSDmitry Torokhov
343b08c118cSDmitry Torokhov    0x0D
344b08c118cSDmitry Torokhov    Returns:
345b08c118cSDmitry Torokhov            0xF7       ; absolute mouse position header
346b08c118cSDmitry Torokhov    BUTTONS
347b08c118cSDmitry Torokhov            0000dcba   ; where a is right button down since last interrogation
348b08c118cSDmitry Torokhov                       ; b is right button up since last
349b08c118cSDmitry Torokhov                       ; c is left button down since last
350b08c118cSDmitry Torokhov                       ; d is left button up since last
351b08c118cSDmitry Torokhov            XMSB       ; X coordinate
352b08c118cSDmitry Torokhov            XLSB
353b08c118cSDmitry Torokhov            YMSB       ; Y coordinate
354b08c118cSDmitry Torokhov            YLSB
355b08c118cSDmitry Torokhov
356b08c118cSDmitry TorokhovThe INTERROGATE MOUSE POSITION command is valid when in the ABSOLUTE MOUSE
357b08c118cSDmitry TorokhovPOSITIONING mode, regardless of the setting of the MOUSE BUTTON ACTION.
358b08c118cSDmitry Torokhov
359b08c118cSDmitry TorokhovLOAD MOUSE POSITION
360b08c118cSDmitry Torokhov-------------------
361b08c118cSDmitry Torokhov
362b08c118cSDmitry Torokhov::
363b08c118cSDmitry Torokhov
364b08c118cSDmitry Torokhov    0x0E
365b08c118cSDmitry Torokhov    0x00                ; filler
366b08c118cSDmitry Torokhov    XMSB                ; X coordinate
367b08c118cSDmitry Torokhov    XLSB                ; (in scaled coordinate system)
368b08c118cSDmitry Torokhov    YMSB                ; Y coordinate
369b08c118cSDmitry Torokhov    YLSB
370b08c118cSDmitry Torokhov
371b08c118cSDmitry TorokhovThis command allows the user to preset the internally maintained absolute
372b08c118cSDmitry Torokhovmouse position.
373b08c118cSDmitry Torokhov
374b08c118cSDmitry TorokhovSET Y=0 AT BOTTOM
375b08c118cSDmitry Torokhov-----------------
376b08c118cSDmitry Torokhov
377b08c118cSDmitry Torokhov::
378b08c118cSDmitry Torokhov
379b08c118cSDmitry Torokhov    0x0F
380b08c118cSDmitry Torokhov
381b08c118cSDmitry TorokhovThis command makes the origin of the Y axis to be at the bottom of the
382b08c118cSDmitry Torokhovlogical coordinate system internal to the ikbd for all relative or absolute
383b08c118cSDmitry Torokhovmouse motion. This causes mouse motion toward the user to be negative in sign
384b08c118cSDmitry Torokhovand away from the user to be positive.
385b08c118cSDmitry Torokhov
386b08c118cSDmitry TorokhovSET Y=0 AT TOP
387b08c118cSDmitry Torokhov--------------
388b08c118cSDmitry Torokhov
389b08c118cSDmitry Torokhov::
390b08c118cSDmitry Torokhov
391b08c118cSDmitry Torokhov    0x10
392b08c118cSDmitry Torokhov
393b08c118cSDmitry TorokhovMakes the origin of the Y axis to be at the top of the logical coordinate
394b08c118cSDmitry Torokhovsystem within the ikbd for all relative or absolute mouse motion. (DEFAULT)
395b08c118cSDmitry TorokhovThis causes mouse motion toward the user to be positive in sign and away from
396b08c118cSDmitry Torokhovthe user to be negative.
397b08c118cSDmitry Torokhov
398b08c118cSDmitry TorokhovRESUME
399b08c118cSDmitry Torokhov------
400b08c118cSDmitry Torokhov
401b08c118cSDmitry Torokhov::
402b08c118cSDmitry Torokhov
403b08c118cSDmitry Torokhov    0x11
404b08c118cSDmitry Torokhov
405b08c118cSDmitry TorokhovResume sending data to the host. Since any command received by the ikbd after
406b08c118cSDmitry Torokhovits output has been paused also causes an implicit RESUME this command can be
407b08c118cSDmitry Torokhovthought of as a NO OPERATION command. If this command is received by the ikbd
408b08c118cSDmitry Torokhovand it is not PAUSED, it is simply ignored.
409b08c118cSDmitry Torokhov
410b08c118cSDmitry TorokhovDISABLE MOUSE
411b08c118cSDmitry Torokhov-------------
412b08c118cSDmitry Torokhov
413b08c118cSDmitry Torokhov::
414b08c118cSDmitry Torokhov
415b08c118cSDmitry Torokhov    0x12
416b08c118cSDmitry Torokhov
417b08c118cSDmitry TorokhovAll mouse event reporting is disabled (and scanning may be internally
418b08c118cSDmitry Torokhovdisabled). Any valid mouse mode command resumes mouse motion monitoring. (The
419b08c118cSDmitry Torokhovvalid mouse mode commands are SET RELATIVE MOUSE POSITION REPORTING, SET
420b08c118cSDmitry TorokhovABSOLUTE MOUSE POSITIONING, and SET MOUSE KEYCODE MODE. )
421b08c118cSDmitry TorokhovN.B. If the mouse buttons have been commanded to act like keyboard keys, this
422b08c118cSDmitry Torokhovcommand DOES affect their actions.
423b08c118cSDmitry Torokhov
424b08c118cSDmitry TorokhovPAUSE OUTPUT
425b08c118cSDmitry Torokhov------------
426b08c118cSDmitry Torokhov
427b08c118cSDmitry Torokhov::
428b08c118cSDmitry Torokhov
429b08c118cSDmitry Torokhov    0x13
430b08c118cSDmitry Torokhov
431b08c118cSDmitry TorokhovStop sending data to the host until another valid command is received. Key
432b08c118cSDmitry Torokhovmatrix activity is still monitored and scan codes or ASCII characters enqueued
433b08c118cSDmitry Torokhov(up to the maximum supported by the microcontroller) to be sent when the host
434b08c118cSDmitry Torokhovallows the output to be resumed. If in the JOYSTICK EVENT REPORTING mode,
435b08c118cSDmitry Torokhovjoystick events are also queued.
436b08c118cSDmitry TorokhovMouse motion should be accumulated while the output is paused. If the ikbd is
437b08c118cSDmitry Torokhovin RELATIVE MOUSE POSITIONING REPORTING mode, motion is accumulated beyond the
438b08c118cSDmitry Torokhovnormal threshold limits to produce the minimum number of packets necessary for
439b08c118cSDmitry Torokhovtransmission when output is resumed. Pressing or releasing either mouse button
440b08c118cSDmitry Torokhovcauses any accumulated motion to be immediately queued as packets, if the
441b08c118cSDmitry Torokhovmouse is in RELATIVE MOUSE POSITION REPORTING mode.
442b08c118cSDmitry TorokhovBecause of the limitations of the microcontroller memory this command should
443b08c118cSDmitry Torokhovbe used sparingly, and the output should not be shut of for more than <tbd>
444b08c118cSDmitry Torokhovmilliseconds at a time.
445b08c118cSDmitry TorokhovThe output is stopped only at the end of the current 'even'. If the PAUSE
446b08c118cSDmitry TorokhovOUTPUT command is received in the middle of a multiple byte report, the packet
447b08c118cSDmitry Torokhovwill still be transmitted to conclusion and then the PAUSE will take effect.
448b08c118cSDmitry TorokhovWhen the ikbd is in either the JOYSTICK MONITORING mode or the FIRE BUTTON
449b08c118cSDmitry TorokhovMONITORING mode, the PAUSE OUTPUT command also temporarily stops the
450b08c118cSDmitry Torokhovmonitoring process (i.e. the samples are not enqueued for transmission).
451b08c118cSDmitry Torokhov
452b08c118cSDmitry TorokhovSET JOYSTICK EVENT REPORTING
453b08c118cSDmitry Torokhov----------------------------
454b08c118cSDmitry Torokhov
455b08c118cSDmitry Torokhov::
456b08c118cSDmitry Torokhov
457b08c118cSDmitry Torokhov    0x14
458b08c118cSDmitry Torokhov
459b08c118cSDmitry TorokhovEnter JOYSTICK EVENT REPORTING mode (DEFAULT). Each opening or closure of a
460b08c118cSDmitry Torokhovjoystick switch or trigger causes a joystick event record to be generated.
461b08c118cSDmitry Torokhov
462b08c118cSDmitry TorokhovSET JOYSTICK INTERROGATION MODE
463b08c118cSDmitry Torokhov-------------------------------
464b08c118cSDmitry Torokhov
465b08c118cSDmitry Torokhov::
466b08c118cSDmitry Torokhov
467b08c118cSDmitry Torokhov    0x15
468b08c118cSDmitry Torokhov
469b08c118cSDmitry TorokhovDisables JOYSTICK EVENT REPORTING. Host must send individual JOYSTICK
470b08c118cSDmitry TorokhovINTERROGATE commands to sense joystick state.
471b08c118cSDmitry Torokhov
472b08c118cSDmitry TorokhovJOYSTICK INTERROGATE
473b08c118cSDmitry Torokhov--------------------
474b08c118cSDmitry Torokhov
475b08c118cSDmitry Torokhov::
476b08c118cSDmitry Torokhov
477b08c118cSDmitry Torokhov    0x16
478b08c118cSDmitry Torokhov
479b08c118cSDmitry TorokhovReturn a record indicating the current state of the joysticks. This command
480b08c118cSDmitry Torokhovis valid in either the JOYSTICK EVENT REPORTING mode or the JOYSTICK
481b08c118cSDmitry TorokhovINTERROGATION MODE.
482b08c118cSDmitry Torokhov
483b08c118cSDmitry TorokhovSET JOYSTICK MONITORING
484b08c118cSDmitry Torokhov-----------------------
485b08c118cSDmitry Torokhov
486b08c118cSDmitry Torokhov::
487b08c118cSDmitry Torokhov
488b08c118cSDmitry Torokhov    0x17
489b08c118cSDmitry Torokhov    rate                ; time between samples in hundredths of a second
490b08c118cSDmitry Torokhov    Returns: (in packets of two as long as in mode)
491b08c118cSDmitry Torokhov            %000000xy   ; where y is JOYSTICK1 Fire button
492b08c118cSDmitry Torokhov                        ; and x is JOYSTICK0 Fire button
493b08c118cSDmitry Torokhov            %nnnnmmmm   ; where m is JOYSTICK1 state
494b08c118cSDmitry Torokhov                        ; and n is JOYSTICK0 state
495b08c118cSDmitry Torokhov
496b08c118cSDmitry TorokhovSets the ikbd to do nothing but monitor the serial command line, maintain the
497b08c118cSDmitry Torokhovtime-of-day clock, and monitor the joystick. The rate sets the interval
498b08c118cSDmitry Torokhovbetween joystick samples.
499b08c118cSDmitry TorokhovN.B. The user should not set the rate higher than the serial communications
500b08c118cSDmitry Torokhovchannel will allow the 2 bytes packets to be transmitted.
501b08c118cSDmitry Torokhov
502b08c118cSDmitry TorokhovSET FIRE BUTTON MONITORING
503b08c118cSDmitry Torokhov--------------------------
504b08c118cSDmitry Torokhov
505b08c118cSDmitry Torokhov::
506b08c118cSDmitry Torokhov
507b08c118cSDmitry Torokhov    0x18
508b08c118cSDmitry Torokhov    Returns: (as long as in mode)
509b08c118cSDmitry Torokhov            %bbbbbbbb   ; state of the JOYSTICK1 fire button packed
510b08c118cSDmitry Torokhov                        ; 8 bits per byte, the first sample if the MSB
511b08c118cSDmitry Torokhov
512b08c118cSDmitry TorokhovSet the ikbd to do nothing but monitor the serial command line, maintain the
513b08c118cSDmitry Torokhovtime-of-day clock, and monitor the fire button on Joystick 1. The fire button
514b08c118cSDmitry Torokhovis scanned at a rate that causes 8 samples to be made in the time it takes for
515b08c118cSDmitry Torokhovthe previous byte to be sent to the host (i.e. scan rate = 8/10 * baud rate).
516b08c118cSDmitry TorokhovThe sample interval should be as constant as possible.
517b08c118cSDmitry Torokhov
518b08c118cSDmitry TorokhovSET JOYSTICK KEYCODE MODE
519b08c118cSDmitry Torokhov-------------------------
520b08c118cSDmitry Torokhov
521b08c118cSDmitry Torokhov::
522b08c118cSDmitry Torokhov
523b08c118cSDmitry Torokhov    0x19
524b08c118cSDmitry Torokhov    RX                  ; length of time (in tenths of seconds) until
525b08c118cSDmitry Torokhov                        ; horizontal velocity breakpoint is reached
526b08c118cSDmitry Torokhov    RY                  ; length of time (in tenths of seconds) until
527b08c118cSDmitry Torokhov                        ; vertical velocity breakpoint is reached
528b08c118cSDmitry Torokhov    TX                  ; length (in tenths of seconds) of joystick closure
529b08c118cSDmitry Torokhov                        ; until horizontal cursor key is generated before RX
530b08c118cSDmitry Torokhov                        ; has elapsed
531b08c118cSDmitry Torokhov    TY                  ; length (in tenths of seconds) of joystick closure
532b08c118cSDmitry Torokhov                        ; until vertical cursor key is generated before RY
533b08c118cSDmitry Torokhov                        ; has elapsed
534b08c118cSDmitry Torokhov    VX                  ; length (in tenths of seconds) of joystick closure
535b08c118cSDmitry Torokhov                        ; until horizontal cursor keystrokes are generated
536b08c118cSDmitry Torokhov                        ; after RX has elapsed
537b08c118cSDmitry Torokhov    VY                  ; length (in tenths of seconds) of joystick closure
538b08c118cSDmitry Torokhov                        ; until vertical cursor keystrokes are generated
539b08c118cSDmitry Torokhov                        ; after RY has elapsed
540b08c118cSDmitry Torokhov
541b08c118cSDmitry TorokhovIn this mode, joystick 0 is scanned in a way that simulates cursor keystrokes.
542b08c118cSDmitry TorokhovOn initial closure, a keystroke pair (make/break) is generated. Then up to Rn
543b08c118cSDmitry Torokhovtenths of seconds later, keystroke pairs are generated every Tn tenths of
544b08c118cSDmitry Torokhovseconds. After the Rn breakpoint is reached, keystroke pairs are generated
545b08c118cSDmitry Torokhovevery Vn tenths of seconds. This provides a velocity (auto-repeat) breakpoint
546b08c118cSDmitry Torokhovfeature.
547b08c118cSDmitry TorokhovNote that by setting RX and/or Ry to zero, the velocity feature can be
548b08c118cSDmitry Torokhovdisabled. The values of TX and TY then become meaningless, and the generation
549b08c118cSDmitry Torokhovof cursor 'keystrokes' is set by VX and VY.
550b08c118cSDmitry Torokhov
551b08c118cSDmitry TorokhovDISABLE JOYSTICKS
552b08c118cSDmitry Torokhov-----------------
553b08c118cSDmitry Torokhov
554b08c118cSDmitry Torokhov::
555b08c118cSDmitry Torokhov
556b08c118cSDmitry Torokhov    0x1A
557b08c118cSDmitry Torokhov
558b08c118cSDmitry TorokhovDisable the generation of any joystick events (and scanning may be internally
559b08c118cSDmitry Torokhovdisabled). Any valid joystick mode command resumes joystick monitoring. (The
560b08c118cSDmitry Torokhovjoystick mode commands are SET JOYSTICK EVENT REPORTING, SET JOYSTICK
561b08c118cSDmitry TorokhovINTERROGATION MODE, SET JOYSTICK MONITORING, SET FIRE BUTTON MONITORING, and
562b08c118cSDmitry TorokhovSET JOYSTICK KEYCODE MODE.)
563b08c118cSDmitry Torokhov
564b08c118cSDmitry TorokhovTIME-OF-DAY CLOCK SET
565b08c118cSDmitry Torokhov---------------------
566b08c118cSDmitry Torokhov
567b08c118cSDmitry Torokhov::
568b08c118cSDmitry Torokhov
569b08c118cSDmitry Torokhov    0x1B
570b08c118cSDmitry Torokhov    YY                  ; year (2 least significant digits)
571b08c118cSDmitry Torokhov    MM                  ; month
572b08c118cSDmitry Torokhov    DD                  ; day
573b08c118cSDmitry Torokhov    hh                  ; hour
574b08c118cSDmitry Torokhov    mm                  ; minute
575b08c118cSDmitry Torokhov    ss                  ; second
576b08c118cSDmitry Torokhov
577b08c118cSDmitry TorokhovAll time-of-day data should be sent to the ikbd in packed BCD format.
578b08c118cSDmitry TorokhovAny digit that is not a valid BCD digit should be treated as a 'don't care'
579b08c118cSDmitry Torokhovand not alter that particular field of the date or time. This permits setting
580b08c118cSDmitry Torokhovonly some subfields of the time-of-day clock.
581b08c118cSDmitry Torokhov
582b08c118cSDmitry TorokhovINTERROGATE TIME-OF-DAT CLOCK
583b08c118cSDmitry Torokhov-----------------------------
584b08c118cSDmitry Torokhov
585b08c118cSDmitry Torokhov::
586b08c118cSDmitry Torokhov
587b08c118cSDmitry Torokhov    0x1C
588b08c118cSDmitry Torokhov    Returns:
589b08c118cSDmitry Torokhov            0xFC        ; time-of-day event header
590b08c118cSDmitry Torokhov            YY          ; year (2 least significant digits)
591b08c118cSDmitry Torokhov            MM          ; month
592b08c118cSDmitry Torokhov            DD          ; day
593b08c118cSDmitry Torokhov            hh          ; hour
594b08c118cSDmitry Torokhov            mm          ; minute
595b08c118cSDmitry Torokhov            ss          ; second
596b08c118cSDmitry Torokhov
597b08c118cSDmitry Torokhov    All time-of-day is sent in packed BCD format.
598b08c118cSDmitry Torokhov
599b08c118cSDmitry TorokhovMEMORY LOAD
600b08c118cSDmitry Torokhov-----------
601b08c118cSDmitry Torokhov
602b08c118cSDmitry Torokhov::
603b08c118cSDmitry Torokhov
604b08c118cSDmitry Torokhov    0x20
605b08c118cSDmitry Torokhov    ADRMSB              ; address in controller
606b08c118cSDmitry Torokhov    ADRLSB              ; memory to be loaded
607b08c118cSDmitry Torokhov    NUM                 ; number of bytes (0-128)
608b08c118cSDmitry Torokhov    { data }
609b08c118cSDmitry Torokhov
610b08c118cSDmitry TorokhovThis command permits the host to load arbitrary values into the ikbd
611b08c118cSDmitry Torokhovcontroller memory. The time between data bytes must be less than 20ms.
612b08c118cSDmitry Torokhov
613b08c118cSDmitry TorokhovMEMORY READ
614b08c118cSDmitry Torokhov-----------
615b08c118cSDmitry Torokhov
616b08c118cSDmitry Torokhov::
617b08c118cSDmitry Torokhov
618b08c118cSDmitry Torokhov    0x21
619b08c118cSDmitry Torokhov    ADRMSB              ; address in controller
620b08c118cSDmitry Torokhov    ADRLSB              ; memory to be read
621b08c118cSDmitry Torokhov    Returns:
622b08c118cSDmitry Torokhov            0xF6        ; status header
623b08c118cSDmitry Torokhov            0x20        ; memory access
624b08c118cSDmitry Torokhov            { data }    ; 6 data bytes starting at ADR
625b08c118cSDmitry Torokhov
626b08c118cSDmitry TorokhovThis command permits the host to read from the ikbd controller memory.
627b08c118cSDmitry Torokhov
628b08c118cSDmitry TorokhovCONTROLLER EXECUTE
629b08c118cSDmitry Torokhov------------------
630b08c118cSDmitry Torokhov
631b08c118cSDmitry Torokhov::
632b08c118cSDmitry Torokhov
633b08c118cSDmitry Torokhov    0x22
634b08c118cSDmitry Torokhov    ADRMSB              ; address of subroutine in
635b08c118cSDmitry Torokhov    ADRLSB              ; controller memory to be called
636b08c118cSDmitry Torokhov
637b08c118cSDmitry TorokhovThis command allows the host to command the execution of a subroutine in the
638b08c118cSDmitry Torokhovikbd controller memory.
639b08c118cSDmitry Torokhov
640b08c118cSDmitry TorokhovSTATUS INQUIRIES
641b08c118cSDmitry Torokhov----------------
642b08c118cSDmitry Torokhov
643b08c118cSDmitry Torokhov::
644b08c118cSDmitry Torokhov
645b08c118cSDmitry Torokhov    Status commands are formed by inclusively ORing 0x80 with the
646b08c118cSDmitry Torokhov    relevant SET command.
647b08c118cSDmitry Torokhov
648b08c118cSDmitry Torokhov    Example:
649b08c118cSDmitry Torokhov    0x88 (or 0x89 or 0x8A)  ; request mouse mode
650b08c118cSDmitry Torokhov    Returns:
651b08c118cSDmitry Torokhov            0xF6        ; status response header
652b08c118cSDmitry Torokhov            mode        ; 0x08 is RELATIVE
653b08c118cSDmitry Torokhov                        ; 0x09 is ABSOLUTE
654b08c118cSDmitry Torokhov                        ; 0x0A is KEYCODE
655b08c118cSDmitry Torokhov            param1      ; 0 is RELATIVE
656b08c118cSDmitry Torokhov                        ; XMSB maximum if ABSOLUTE
657b08c118cSDmitry Torokhov                        ; DELTA X is KEYCODE
658b08c118cSDmitry Torokhov            param2      ; 0 is RELATIVE
659b08c118cSDmitry Torokhov                        ; YMSB maximum if ABSOLUTE
660b08c118cSDmitry Torokhov                        ; DELTA Y is KEYCODE
661b08c118cSDmitry Torokhov            param3      ; 0 if RELATIVE
662b08c118cSDmitry Torokhov                        ; or KEYCODE
663b08c118cSDmitry Torokhov                        ; YMSB is ABSOLUTE
664b08c118cSDmitry Torokhov            param4      ; 0 if RELATIVE
665b08c118cSDmitry Torokhov                        ; or KEYCODE
666b08c118cSDmitry Torokhov                        ; YLSB is ABSOLUTE
667b08c118cSDmitry Torokhov            0           ; pad
668b08c118cSDmitry Torokhov            0
669b08c118cSDmitry Torokhov
670b08c118cSDmitry TorokhovThe STATUS INQUIRY commands request the ikbd to return either the current mode
671b08c118cSDmitry Torokhovor the parameters associated with a given command. All status reports are
672b08c118cSDmitry Torokhovpadded to form 8 byte long return packets. The responses to the status
673b08c118cSDmitry Torokhovrequests are designed so that the host may store them away (after stripping
674b08c118cSDmitry Torokhovoff the status report header byte) and later send them back as commands to
675b08c118cSDmitry Torokhovikbd to restore its state. The 0 pad bytes will be treated as NOPs by the
676b08c118cSDmitry Torokhovikbd.
677b08c118cSDmitry Torokhov
678b08c118cSDmitry Torokhov    Valid STATUS INQUIRY commands are::
679b08c118cSDmitry Torokhov
680b08c118cSDmitry Torokhov            0x87    mouse button action
681b08c118cSDmitry Torokhov            0x88    mouse mode
682b08c118cSDmitry Torokhov            0x89
683b08c118cSDmitry Torokhov            0x8A
684b08c118cSDmitry Torokhov            0x8B    mnouse threshold
685b08c118cSDmitry Torokhov            0x8C    mouse scale
686b08c118cSDmitry Torokhov            0x8F    mouse vertical coordinates
687b08c118cSDmitry Torokhov            0x90    ( returns       0x0F Y=0 at bottom
688b08c118cSDmitry Torokhov                            0x10 Y=0 at top )
689b08c118cSDmitry Torokhov            0x92    mouse enable/disable
690b08c118cSDmitry Torokhov                    ( returns       0x00 enabled)
691b08c118cSDmitry Torokhov                            0x12 disabled )
692b08c118cSDmitry Torokhov            0x94    joystick mode
693b08c118cSDmitry Torokhov            0x95
694b08c118cSDmitry Torokhov            0x96
695b08c118cSDmitry Torokhov            0x9A    joystick enable/disable
696b08c118cSDmitry Torokhov                    ( returns       0x00 enabled
697b08c118cSDmitry Torokhov                            0x1A disabled )
698b08c118cSDmitry Torokhov
699b08c118cSDmitry TorokhovIt is the (host) programmer's responsibility to have only one unanswered
700b08c118cSDmitry Torokhovinquiry in process at a time.
701b08c118cSDmitry TorokhovSTATUS INQUIRY commands are not valid if the ikbd is in JOYSTICK MONITORING
702b08c118cSDmitry Torokhovmode or FIRE BUTTON MONITORING mode.
703b08c118cSDmitry Torokhov
704b08c118cSDmitry Torokhov
705b08c118cSDmitry TorokhovSCAN CODES
706b08c118cSDmitry Torokhov==========
707b08c118cSDmitry Torokhov
708b08c118cSDmitry TorokhovThe key scan codes returned by the ikbd are chosen to simplify the
709b08c118cSDmitry Torokhovimplementation of GSX.
710b08c118cSDmitry Torokhov
711b08c118cSDmitry TorokhovGSX Standard Keyboard Mapping
712b08c118cSDmitry Torokhov
713b08c118cSDmitry Torokhov======= ============
714b08c118cSDmitry TorokhovHex	Keytop
715b08c118cSDmitry Torokhov======= ============
716b08c118cSDmitry Torokhov01	Esc
717b08c118cSDmitry Torokhov02	1
718b08c118cSDmitry Torokhov03	2
719b08c118cSDmitry Torokhov04	3
720b08c118cSDmitry Torokhov05	4
721b08c118cSDmitry Torokhov06	5
722b08c118cSDmitry Torokhov07	6
723b08c118cSDmitry Torokhov08	7
724b08c118cSDmitry Torokhov09	8
725b08c118cSDmitry Torokhov0A	9
726b08c118cSDmitry Torokhov0B	0
727b08c118cSDmitry Torokhov0C	\-
728b08c118cSDmitry Torokhov0D	\=
729b08c118cSDmitry Torokhov0E	BS
730b08c118cSDmitry Torokhov0F	TAB
731b08c118cSDmitry Torokhov10	Q
732b08c118cSDmitry Torokhov11	W
733b08c118cSDmitry Torokhov12	E
734b08c118cSDmitry Torokhov13	R
735b08c118cSDmitry Torokhov14	T
736b08c118cSDmitry Torokhov15	Y
737b08c118cSDmitry Torokhov16	U
738b08c118cSDmitry Torokhov17	I
739b08c118cSDmitry Torokhov18	O
740b08c118cSDmitry Torokhov19	P
741b08c118cSDmitry Torokhov1A	[
742b08c118cSDmitry Torokhov1B	]
743b08c118cSDmitry Torokhov1C	RET
744b08c118cSDmitry Torokhov1D	CTRL
745b08c118cSDmitry Torokhov1E	A
746b08c118cSDmitry Torokhov1F	S
747b08c118cSDmitry Torokhov20	D
748b08c118cSDmitry Torokhov21	F
749b08c118cSDmitry Torokhov22	G
750b08c118cSDmitry Torokhov23	H
751b08c118cSDmitry Torokhov24	J
752b08c118cSDmitry Torokhov25	K
753b08c118cSDmitry Torokhov26	L
754b08c118cSDmitry Torokhov27	;
755b08c118cSDmitry Torokhov28	'
756b08c118cSDmitry Torokhov29	\`
757b08c118cSDmitry Torokhov2A	(LEFT) SHIFT
758b08c118cSDmitry Torokhov2B	\\
759b08c118cSDmitry Torokhov2C	Z
760b08c118cSDmitry Torokhov2D	X
761b08c118cSDmitry Torokhov2E	C
762b08c118cSDmitry Torokhov2F	V
763b08c118cSDmitry Torokhov30	B
764b08c118cSDmitry Torokhov31	N
765b08c118cSDmitry Torokhov32	M
766b08c118cSDmitry Torokhov33	,
767b08c118cSDmitry Torokhov34	.
768b08c118cSDmitry Torokhov35	/
769b08c118cSDmitry Torokhov36	(RIGHT) SHIFT
770b08c118cSDmitry Torokhov37	{ NOT USED }
771b08c118cSDmitry Torokhov38	ALT
772b08c118cSDmitry Torokhov39	SPACE BAR
773b08c118cSDmitry Torokhov3A	CAPS LOCK
774b08c118cSDmitry Torokhov3B	F1
775b08c118cSDmitry Torokhov3C	F2
776b08c118cSDmitry Torokhov3D	F3
777b08c118cSDmitry Torokhov3E	F4
778b08c118cSDmitry Torokhov3F	F5
779b08c118cSDmitry Torokhov40	F6
780b08c118cSDmitry Torokhov41	F7
781b08c118cSDmitry Torokhov42	F8
782b08c118cSDmitry Torokhov43	F9
783b08c118cSDmitry Torokhov44	F10
784b08c118cSDmitry Torokhov45	{ NOT USED }
785b08c118cSDmitry Torokhov46	{ NOT USED }
786b08c118cSDmitry Torokhov47	HOME
787b08c118cSDmitry Torokhov48	UP ARROW
788b08c118cSDmitry Torokhov49	{ NOT USED }
789b08c118cSDmitry Torokhov4A	KEYPAD -
790b08c118cSDmitry Torokhov4B	LEFT ARROW
791b08c118cSDmitry Torokhov4C	{ NOT USED }
792b08c118cSDmitry Torokhov4D	RIGHT ARROW
793b08c118cSDmitry Torokhov4E	KEYPAD +
794b08c118cSDmitry Torokhov4F	{ NOT USED }
795b08c118cSDmitry Torokhov50	DOWN ARROW
796b08c118cSDmitry Torokhov51	{ NOT USED }
797b08c118cSDmitry Torokhov52	INSERT
798b08c118cSDmitry Torokhov53	DEL
799b08c118cSDmitry Torokhov54	{ NOT USED }
800b08c118cSDmitry Torokhov5F	{ NOT USED }
801b08c118cSDmitry Torokhov60	ISO KEY
802b08c118cSDmitry Torokhov61	UNDO
803b08c118cSDmitry Torokhov62	HELP
804b08c118cSDmitry Torokhov63	KEYPAD (
805b08c118cSDmitry Torokhov64	KEYPAD /
806b08c118cSDmitry Torokhov65	KEYPAD *
807b08c118cSDmitry Torokhov66	KEYPAD *
808b08c118cSDmitry Torokhov67	KEYPAD 7
809b08c118cSDmitry Torokhov68	KEYPAD 8
810b08c118cSDmitry Torokhov69	KEYPAD 9
811b08c118cSDmitry Torokhov6A	KEYPAD 4
812b08c118cSDmitry Torokhov6B	KEYPAD 5
813b08c118cSDmitry Torokhov6C	KEYPAD 6
814b08c118cSDmitry Torokhov6D	KEYPAD 1
815b08c118cSDmitry Torokhov6E	KEYPAD 2
816b08c118cSDmitry Torokhov6F	KEYPAD 3
817b08c118cSDmitry Torokhov70	KEYPAD 0
818b08c118cSDmitry Torokhov71	KEYPAD .
819b08c118cSDmitry Torokhov72	KEYPAD ENTER
820b08c118cSDmitry Torokhov======= ============
821