atarikbd.rst 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. ====================================
  2. Intelligent Keyboard (ikbd) Protocol
  3. ====================================
  4. Introduction
  5. ============
  6. The Atari Corp. Intelligent Keyboard (ikbd) is a general purpose keyboard
  7. controller that is flexible enough that it can be used in a variety of
  8. products without modification. The keyboard, with its microcontroller,
  9. provides a convenient connection point for a mouse and switch-type joysticks.
  10. The ikbd processor also maintains a time-of-day clock with one second
  11. resolution.
  12. The ikbd has been designed to be general enough that it can be used with a
  13. variety of new computer products. Product variations in a number of
  14. keyswitches, mouse resolution, etc. can be accommodated.
  15. The ikbd communicates with the main processor over a high speed bi-directional
  16. serial interface. It can function in a variety of modes to facilitate
  17. different applications of the keyboard, joysticks, or mouse. Limited use of
  18. the controller is possible in applications in which only a unidirectional
  19. communications medium is available by carefully designing the default modes.
  20. Keyboard
  21. ========
  22. The keyboard always returns key make/break scan codes. The ikbd generates
  23. keyboard scan codes for each key press and release. The key scan make (key
  24. closure) codes start at 1, and are defined in Appendix A. For example, the
  25. ISO key position in the scan code table should exist even if no keyswitch
  26. exists in that position on a particular keyboard. The break code for each key
  27. is obtained by ORing 0x80 with the make code.
  28. The special codes 0xF6 through 0xFF are reserved for use as follows:
  29. =================== ====================================================
  30. Code Command
  31. =================== ====================================================
  32. 0xF6 status report
  33. 0xF7 absolute mouse position record
  34. 0xF8-0xFB relative mouse position records (lsbs determined by
  35. mouse button states)
  36. 0xFC time-of-day
  37. 0xFD joystick report (both sticks)
  38. 0xFE joystick 0 event
  39. 0xFF joystick 1 event
  40. =================== ====================================================
  41. The two shift keys return different scan codes in this mode. The ENTER key
  42. and the RETurn key are also distinct.
  43. Mouse
  44. =====
  45. The mouse port should be capable of supporting a mouse with resolution of
  46. approximately 200 counts (phase changes or 'clicks') per inch of travel. The
  47. mouse should be scanned at a rate that will permit accurate tracking at
  48. velocities up to 10 inches per second.
  49. The ikbd can report mouse motion in three distinctly different ways. It can
  50. report relative motion, absolute motion in a coordinate system maintained
  51. within the ikbd, or by converting mouse motion into keyboard cursor control
  52. key equivalents.
  53. The mouse buttons can be treated as part of the mouse or as additional
  54. keyboard keys.
  55. Relative Position Reporting
  56. ---------------------------
  57. In relative position mode, the ikbd will return relative mouse position
  58. records whenever a mouse event occurs. A mouse event consists of a mouse
  59. button being pressed or released, or motion in either axis exceeding a
  60. settable threshold of motion. Regardless of the threshold, all bits of
  61. resolution are returned to the host computer.
  62. Note that the ikbd may return mouse relative position reports with
  63. significantly more than the threshold delta x or y. This may happen since no
  64. relative mouse motion events will be generated: (a) while the keyboard has
  65. been 'paused' ( the event will be stored until keyboard communications is
  66. resumed) (b) while any event is being transmitted.
  67. The relative mouse position record is a three byte record of the form
  68. (regardless of keyboard mode)::
  69. %111110xy ; mouse position record flag
  70. ; where y is the right button state
  71. ; and x is the left button state
  72. X ; delta x as twos complement integer
  73. Y ; delta y as twos complement integer
  74. Note that the value of the button state bits should be valid even if the
  75. MOUSE BUTTON ACTION has set the buttons to act like part of the keyboard.
  76. If the accumulated motion before the report packet is generated exceeds the
  77. +127...-128 range, the motion is broken into multiple packets.
  78. Note that the sign of the delta y reported is a function of the Y origin
  79. selected.
  80. Absolute Position reporting
  81. ---------------------------
  82. The ikbd can also maintain absolute mouse position. Commands exist for
  83. resetting the mouse position, setting X/Y scaling, and interrogating the
  84. current mouse position.
  85. Mouse Cursor Key Mode
  86. ---------------------
  87. The ikbd can translate mouse motion into the equivalent cursor keystrokes.
  88. The number of mouse clicks per keystroke is independently programmable in
  89. each axis. The ikbd internally maintains mouse motion information to the
  90. highest resolution available, and merely generates a pair of cursor key events
  91. for each multiple of the scale factor.
  92. Mouse motion produces the cursor key make code immediately followed by the
  93. break code for the appropriate cursor key. The mouse buttons produce scan
  94. codes above those normally assigned for the largest envisioned keyboard (i.e.
  95. LEFT=0x74 & RIGHT=0x75).
  96. Joystick
  97. ========
  98. Joystick Event Reporting
  99. ------------------------
  100. In this mode, the ikbd generates a record whenever the joystick position is
  101. changed (i.e. for each opening or closing of a joystick switch or trigger).
  102. The joystick event record is two bytes of the form::
  103. %1111111x ; Joystick event marker
  104. ; where x is Joystick 0 or 1
  105. %x000yyyy ; where yyyy is the stick position
  106. ; and x is the trigger
  107. Joystick Interrogation
  108. ----------------------
  109. The current state of the joystick ports may be interrogated at any time in
  110. this mode by sending an 'Interrogate Joystick' command to the ikbd.
  111. The ikbd response to joystick interrogation is a three byte report of the form::
  112. 0xFD ; joystick report header
  113. %x000yyyy ; Joystick 0
  114. %x000yyyy ; Joystick 1
  115. ; where x is the trigger
  116. ; and yyy is the stick position
  117. Joystick Monitoring
  118. -------------------
  119. A mode is available that devotes nearly all of the keyboard communications
  120. time to reporting the state of the joystick ports at a user specifiable rate.
  121. It remains in this mode until reset or commanded into another mode. The PAUSE
  122. command in this mode not only stop the output but also temporarily stops
  123. scanning the joysticks (samples are not queued).
  124. Fire Button Monitoring
  125. ----------------------
  126. A mode is provided to permit monitoring a single input bit at a high rate. In
  127. this mode the ikbd monitors the state of the Joystick 1 fire button at the
  128. maximum rate permitted by the serial communication channel. The data is packed
  129. 8 bits per byte for transmission to the host. The ikbd remains in this mode
  130. until reset or commanded into another mode. The PAUSE command in this mode not
  131. only stops the output but also temporarily stops scanning the button (samples
  132. are not queued).
  133. Joystick Key Code Mode
  134. ----------------------
  135. The ikbd may be commanded to translate the use of either joystick into the
  136. equivalent cursor control keystroke(s). The ikbd provides a single breakpoint
  137. velocity joystick cursor.
  138. Joystick events produce the make code, immediately followed by the break code
  139. for the appropriate cursor motion keys. The trigger or fire buttons of the
  140. joysticks produce pseudo key scan codes above those used by the largest key
  141. matrix envisioned (i.e. JOYSTICK0=0x74, JOYSTICK1=0x75).
  142. Time-of-Day Clock
  143. =================
  144. The ikbd also maintains a time-of-day clock for the system. Commands are
  145. available to set and interrogate the timer-of-day clock. Time-keeping is
  146. maintained down to a resolution of one second.
  147. Status Inquiries
  148. ================
  149. The current state of ikbd modes and parameters may be found by sending status
  150. inquiry commands that correspond to the ikbd set commands.
  151. Power-Up Mode
  152. =============
  153. The keyboard controller will perform a simple self-test on power-up to detect
  154. major controller faults (ROM checksum and RAM test) and such things as stuck
  155. keys. Any keys down at power-up are presumed to be stuck, and their BREAK
  156. (sic) code is returned (which without the preceding MAKE code is a flag for a
  157. keyboard error). If the controller self-test completes without error, the code
  158. 0xF0 is returned. (This code will be used to indicate the version/release of
  159. the ikbd controller. The first release of the ikbd is version 0xF0, should
  160. there be a second release it will be 0xF1, and so on.)
  161. The ikbd defaults to a mouse position reporting with threshold of 1 unit in
  162. either axis and the Y=0 origin at the top of the screen, and joystick event
  163. reporting mode for joystick 1, with both buttons being logically assigned to
  164. the mouse. After any joystick command, the ikbd assumes that joysticks are
  165. connected to both Joystick0 and Joystick1. Any mouse command (except MOUSE
  166. DISABLE) then causes port 0 to again be scanned as if it were a mouse, and
  167. both buttons are logically connected to it. If a mouse disable command is
  168. received while port 0 is presumed to be a mouse, the button is logically
  169. assigned to Joystick1 (until the mouse is reenabled by another mouse command).
  170. ikbd Command Set
  171. ================
  172. This section contains a list of commands that can be sent to the ikbd. Command
  173. codes (such as 0x00) which are not specified should perform no operation
  174. (NOPs).
  175. RESET
  176. -----
  177. ::
  178. 0x80
  179. 0x01
  180. N.B. The RESET command is the only two byte command understood by the ikbd.
  181. Any byte following an 0x80 command byte other than 0x01 is ignored (and causes
  182. the 0x80 to be ignored).
  183. A reset may also be caused by sending a break lasting at least 200mS to the
  184. ikbd.
  185. Executing the RESET command returns the keyboard to its default (power-up)
  186. mode and parameter settings. It does not affect the time-of-day clock.
  187. The RESET command or function causes the ikbd to perform a simple self-test.
  188. If the test is successful, the ikbd will send the code of 0xF0 within 300mS
  189. of receipt of the RESET command (or the end of the break, or power-up). The
  190. ikbd will then scan the key matrix for any stuck (closed) keys. Any keys found
  191. closed will cause the break scan code to be generated (the break code arriving
  192. without being preceded by the make code is a flag for a key matrix error).
  193. SET MOUSE BUTTON ACTION
  194. -----------------------
  195. ::
  196. 0x07
  197. %00000mss ; mouse button action
  198. ; (m is presumed = 1 when in MOUSE KEYCODE mode)
  199. ; mss=0xy, mouse button press or release causes mouse
  200. ; position report
  201. ; where y=1, mouse key press causes absolute report
  202. ; and x=1, mouse key release causes absolute report
  203. ; mss=100, mouse buttons act like keys
  204. This command sets how the ikbd should treat the buttons on the mouse. The
  205. default mouse button action mode is %00000000, the buttons are treated as part
  206. of the mouse logically.
  207. When buttons act like keys, LEFT=0x74 & RIGHT=0x75.
  208. SET RELATIVE MOUSE POSITION REPORTING
  209. -------------------------------------
  210. ::
  211. 0x08
  212. Set relative mouse position reporting. (DEFAULT) Mouse position packets are
  213. generated asynchronously by the ikbd whenever motion exceeds the setable
  214. threshold in either axis (see SET MOUSE THRESHOLD). Depending upon the mouse
  215. key mode, mouse position reports may also be generated when either mouse
  216. button is pressed or released. Otherwise the mouse buttons behave as if they
  217. were keyboard keys.
  218. SET ABSOLUTE MOUSE POSITIONING
  219. ------------------------------
  220. ::
  221. 0x09
  222. XMSB ; X maximum (in scaled mouse clicks)
  223. XLSB
  224. YMSB ; Y maximum (in scaled mouse clicks)
  225. YLSB
  226. Set absolute mouse position maintenance. Resets the ikbd maintained X and Y
  227. coordinates.
  228. In this mode, the value of the internally maintained coordinates does NOT wrap
  229. between 0 and large positive numbers. Excess motion below 0 is ignored. The
  230. command sets the maximum positive value that can be attained in the scaled
  231. coordinate system. Motion beyond that value is also ignored.
  232. SET MOUSE KEYCODE MOSE
  233. ----------------------
  234. ::
  235. 0x0A
  236. deltax ; distance in X clicks to return (LEFT) or (RIGHT)
  237. deltay ; distance in Y clicks to return (UP) or (DOWN)
  238. Set mouse monitoring routines to return cursor motion keycodes instead of
  239. either RELATIVE or ABSOLUTE motion records. The ikbd returns the appropriate
  240. cursor keycode after mouse travel exceeding the user specified deltas in
  241. either axis. When the keyboard is in key scan code mode, mouse motion will
  242. cause the make code immediately followed by the break code. Note that this
  243. command is not affected by the mouse motion origin.
  244. SET MOUSE THRESHOLD
  245. -------------------
  246. ::
  247. 0x0B
  248. X ; x threshold in mouse ticks (positive integers)
  249. Y ; y threshold in mouse ticks (positive integers)
  250. This command sets the threshold before a mouse event is generated. Note that
  251. it does NOT affect the resolution of the data returned to the host. This
  252. command is valid only in RELATIVE MOUSE POSITIONING mode. The thresholds
  253. default to 1 at RESET (or power-up).
  254. SET MOUSE SCALE
  255. ---------------
  256. ::
  257. 0x0C
  258. X ; horizontal mouse ticks per internal X
  259. Y ; vertical mouse ticks per internal Y
  260. This command sets the scale factor for the ABSOLUTE MOUSE POSITIONING mode.
  261. In this mode, the specified number of mouse phase changes ('clicks') must
  262. occur before the internally maintained coordinate is changed by one
  263. (independently scaled for each axis). Remember that the mouse position
  264. information is available only by interrogating the ikbd in the ABSOLUTE MOUSE
  265. POSITIONING mode unless the ikbd has been commanded to report on button press
  266. or release (see SET MOSE BUTTON ACTION).
  267. INTERROGATE MOUSE POSITION
  268. --------------------------
  269. ::
  270. 0x0D
  271. Returns:
  272. 0xF7 ; absolute mouse position header
  273. BUTTONS
  274. 0000dcba ; where a is right button down since last interrogation
  275. ; b is right button up since last
  276. ; c is left button down since last
  277. ; d is left button up since last
  278. XMSB ; X coordinate
  279. XLSB
  280. YMSB ; Y coordinate
  281. YLSB
  282. The INTERROGATE MOUSE POSITION command is valid when in the ABSOLUTE MOUSE
  283. POSITIONING mode, regardless of the setting of the MOUSE BUTTON ACTION.
  284. LOAD MOUSE POSITION
  285. -------------------
  286. ::
  287. 0x0E
  288. 0x00 ; filler
  289. XMSB ; X coordinate
  290. XLSB ; (in scaled coordinate system)
  291. YMSB ; Y coordinate
  292. YLSB
  293. This command allows the user to preset the internally maintained absolute
  294. mouse position.
  295. SET Y=0 AT BOTTOM
  296. -----------------
  297. ::
  298. 0x0F
  299. This command makes the origin of the Y axis to be at the bottom of the
  300. logical coordinate system internal to the ikbd for all relative or absolute
  301. mouse motion. This causes mouse motion toward the user to be negative in sign
  302. and away from the user to be positive.
  303. SET Y=0 AT TOP
  304. --------------
  305. ::
  306. 0x10
  307. Makes the origin of the Y axis to be at the top of the logical coordinate
  308. system within the ikbd for all relative or absolute mouse motion. (DEFAULT)
  309. This causes mouse motion toward the user to be positive in sign and away from
  310. the user to be negative.
  311. RESUME
  312. ------
  313. ::
  314. 0x11
  315. Resume sending data to the host. Since any command received by the ikbd after
  316. its output has been paused also causes an implicit RESUME this command can be
  317. thought of as a NO OPERATION command. If this command is received by the ikbd
  318. and it is not PAUSED, it is simply ignored.
  319. DISABLE MOUSE
  320. -------------
  321. ::
  322. 0x12
  323. All mouse event reporting is disabled (and scanning may be internally
  324. disabled). Any valid mouse mode command resumes mouse motion monitoring. (The
  325. valid mouse mode commands are SET RELATIVE MOUSE POSITION REPORTING, SET
  326. ABSOLUTE MOUSE POSITIONING, and SET MOUSE KEYCODE MODE. )
  327. N.B. If the mouse buttons have been commanded to act like keyboard keys, this
  328. command DOES affect their actions.
  329. PAUSE OUTPUT
  330. ------------
  331. ::
  332. 0x13
  333. Stop sending data to the host until another valid command is received. Key
  334. matrix activity is still monitored and scan codes or ASCII characters enqueued
  335. (up to the maximum supported by the microcontroller) to be sent when the host
  336. allows the output to be resumed. If in the JOYSTICK EVENT REPORTING mode,
  337. joystick events are also queued.
  338. Mouse motion should be accumulated while the output is paused. If the ikbd is
  339. in RELATIVE MOUSE POSITIONING REPORTING mode, motion is accumulated beyond the
  340. normal threshold limits to produce the minimum number of packets necessary for
  341. transmission when output is resumed. Pressing or releasing either mouse button
  342. causes any accumulated motion to be immediately queued as packets, if the
  343. mouse is in RELATIVE MOUSE POSITION REPORTING mode.
  344. Because of the limitations of the microcontroller memory this command should
  345. be used sparingly, and the output should not be shut of for more than <tbd>
  346. milliseconds at a time.
  347. The output is stopped only at the end of the current 'even'. If the PAUSE
  348. OUTPUT command is received in the middle of a multiple byte report, the packet
  349. will still be transmitted to conclusion and then the PAUSE will take effect.
  350. When the ikbd is in either the JOYSTICK MONITORING mode or the FIRE BUTTON
  351. MONITORING mode, the PAUSE OUTPUT command also temporarily stops the
  352. monitoring process (i.e. the samples are not enqueued for transmission).
  353. SET JOYSTICK EVENT REPORTING
  354. ----------------------------
  355. ::
  356. 0x14
  357. Enter JOYSTICK EVENT REPORTING mode (DEFAULT). Each opening or closure of a
  358. joystick switch or trigger causes a joystick event record to be generated.
  359. SET JOYSTICK INTERROGATION MODE
  360. -------------------------------
  361. ::
  362. 0x15
  363. Disables JOYSTICK EVENT REPORTING. Host must send individual JOYSTICK
  364. INTERROGATE commands to sense joystick state.
  365. JOYSTICK INTERROGATE
  366. --------------------
  367. ::
  368. 0x16
  369. Return a record indicating the current state of the joysticks. This command
  370. is valid in either the JOYSTICK EVENT REPORTING mode or the JOYSTICK
  371. INTERROGATION MODE.
  372. SET JOYSTICK MONITORING
  373. -----------------------
  374. ::
  375. 0x17
  376. rate ; time between samples in hundredths of a second
  377. Returns: (in packets of two as long as in mode)
  378. %000000xy ; where y is JOYSTICK1 Fire button
  379. ; and x is JOYSTICK0 Fire button
  380. %nnnnmmmm ; where m is JOYSTICK1 state
  381. ; and n is JOYSTICK0 state
  382. Sets the ikbd to do nothing but monitor the serial command line, maintain the
  383. time-of-day clock, and monitor the joystick. The rate sets the interval
  384. between joystick samples.
  385. N.B. The user should not set the rate higher than the serial communications
  386. channel will allow the 2 bytes packets to be transmitted.
  387. SET FIRE BUTTON MONITORING
  388. --------------------------
  389. ::
  390. 0x18
  391. Returns: (as long as in mode)
  392. %bbbbbbbb ; state of the JOYSTICK1 fire button packed
  393. ; 8 bits per byte, the first sample if the MSB
  394. Set the ikbd to do nothing but monitor the serial command line, maintain the
  395. time-of-day clock, and monitor the fire button on Joystick 1. The fire button
  396. is scanned at a rate that causes 8 samples to be made in the time it takes for
  397. the previous byte to be sent to the host (i.e. scan rate = 8/10 * baud rate).
  398. The sample interval should be as constant as possible.
  399. SET JOYSTICK KEYCODE MODE
  400. -------------------------
  401. ::
  402. 0x19
  403. RX ; length of time (in tenths of seconds) until
  404. ; horizontal velocity breakpoint is reached
  405. RY ; length of time (in tenths of seconds) until
  406. ; vertical velocity breakpoint is reached
  407. TX ; length (in tenths of seconds) of joystick closure
  408. ; until horizontal cursor key is generated before RX
  409. ; has elapsed
  410. TY ; length (in tenths of seconds) of joystick closure
  411. ; until vertical cursor key is generated before RY
  412. ; has elapsed
  413. VX ; length (in tenths of seconds) of joystick closure
  414. ; until horizontal cursor keystrokes are generated
  415. ; after RX has elapsed
  416. VY ; length (in tenths of seconds) of joystick closure
  417. ; until vertical cursor keystrokes are generated
  418. ; after RY has elapsed
  419. In this mode, joystick 0 is scanned in a way that simulates cursor keystrokes.
  420. On initial closure, a keystroke pair (make/break) is generated. Then up to Rn
  421. tenths of seconds later, keystroke pairs are generated every Tn tenths of
  422. seconds. After the Rn breakpoint is reached, keystroke pairs are generated
  423. every Vn tenths of seconds. This provides a velocity (auto-repeat) breakpoint
  424. feature.
  425. Note that by setting RX and/or Ry to zero, the velocity feature can be
  426. disabled. The values of TX and TY then become meaningless, and the generation
  427. of cursor 'keystrokes' is set by VX and VY.
  428. DISABLE JOYSTICKS
  429. -----------------
  430. ::
  431. 0x1A
  432. Disable the generation of any joystick events (and scanning may be internally
  433. disabled). Any valid joystick mode command resumes joystick monitoring. (The
  434. joystick mode commands are SET JOYSTICK EVENT REPORTING, SET JOYSTICK
  435. INTERROGATION MODE, SET JOYSTICK MONITORING, SET FIRE BUTTON MONITORING, and
  436. SET JOYSTICK KEYCODE MODE.)
  437. TIME-OF-DAY CLOCK SET
  438. ---------------------
  439. ::
  440. 0x1B
  441. YY ; year (2 least significant digits)
  442. MM ; month
  443. DD ; day
  444. hh ; hour
  445. mm ; minute
  446. ss ; second
  447. All time-of-day data should be sent to the ikbd in packed BCD format.
  448. Any digit that is not a valid BCD digit should be treated as a 'don't care'
  449. and not alter that particular field of the date or time. This permits setting
  450. only some subfields of the time-of-day clock.
  451. INTERROGATE TIME-OF-DAT CLOCK
  452. -----------------------------
  453. ::
  454. 0x1C
  455. Returns:
  456. 0xFC ; time-of-day event header
  457. YY ; year (2 least significant digits)
  458. MM ; month
  459. DD ; day
  460. hh ; hour
  461. mm ; minute
  462. ss ; second
  463. All time-of-day is sent in packed BCD format.
  464. MEMORY LOAD
  465. -----------
  466. ::
  467. 0x20
  468. ADRMSB ; address in controller
  469. ADRLSB ; memory to be loaded
  470. NUM ; number of bytes (0-128)
  471. { data }
  472. This command permits the host to load arbitrary values into the ikbd
  473. controller memory. The time between data bytes must be less than 20ms.
  474. MEMORY READ
  475. -----------
  476. ::
  477. 0x21
  478. ADRMSB ; address in controller
  479. ADRLSB ; memory to be read
  480. Returns:
  481. 0xF6 ; status header
  482. 0x20 ; memory access
  483. { data } ; 6 data bytes starting at ADR
  484. This command permits the host to read from the ikbd controller memory.
  485. CONTROLLER EXECUTE
  486. ------------------
  487. ::
  488. 0x22
  489. ADRMSB ; address of subroutine in
  490. ADRLSB ; controller memory to be called
  491. This command allows the host to command the execution of a subroutine in the
  492. ikbd controller memory.
  493. STATUS INQUIRIES
  494. ----------------
  495. ::
  496. Status commands are formed by inclusively ORing 0x80 with the
  497. relevant SET command.
  498. Example:
  499. 0x88 (or 0x89 or 0x8A) ; request mouse mode
  500. Returns:
  501. 0xF6 ; status response header
  502. mode ; 0x08 is RELATIVE
  503. ; 0x09 is ABSOLUTE
  504. ; 0x0A is KEYCODE
  505. param1 ; 0 is RELATIVE
  506. ; XMSB maximum if ABSOLUTE
  507. ; DELTA X is KEYCODE
  508. param2 ; 0 is RELATIVE
  509. ; YMSB maximum if ABSOLUTE
  510. ; DELTA Y is KEYCODE
  511. param3 ; 0 if RELATIVE
  512. ; or KEYCODE
  513. ; YMSB is ABSOLUTE
  514. param4 ; 0 if RELATIVE
  515. ; or KEYCODE
  516. ; YLSB is ABSOLUTE
  517. 0 ; pad
  518. 0
  519. The STATUS INQUIRY commands request the ikbd to return either the current mode
  520. or the parameters associated with a given command. All status reports are
  521. padded to form 8 byte long return packets. The responses to the status
  522. requests are designed so that the host may store them away (after stripping
  523. off the status report header byte) and later send them back as commands to
  524. ikbd to restore its state. The 0 pad bytes will be treated as NOPs by the
  525. ikbd.
  526. Valid STATUS INQUIRY commands are::
  527. 0x87 mouse button action
  528. 0x88 mouse mode
  529. 0x89
  530. 0x8A
  531. 0x8B mnouse threshold
  532. 0x8C mouse scale
  533. 0x8F mouse vertical coordinates
  534. 0x90 ( returns 0x0F Y=0 at bottom
  535. 0x10 Y=0 at top )
  536. 0x92 mouse enable/disable
  537. ( returns 0x00 enabled)
  538. 0x12 disabled )
  539. 0x94 joystick mode
  540. 0x95
  541. 0x96
  542. 0x9A joystick enable/disable
  543. ( returns 0x00 enabled
  544. 0x1A disabled )
  545. It is the (host) programmer's responsibility to have only one unanswered
  546. inquiry in process at a time.
  547. STATUS INQUIRY commands are not valid if the ikbd is in JOYSTICK MONITORING
  548. mode or FIRE BUTTON MONITORING mode.
  549. SCAN CODES
  550. ==========
  551. The key scan codes returned by the ikbd are chosen to simplify the
  552. implementation of GSX.
  553. GSX Standard Keyboard Mapping
  554. ======= ============
  555. Hex Keytop
  556. ======= ============
  557. 01 Esc
  558. 02 1
  559. 03 2
  560. 04 3
  561. 05 4
  562. 06 5
  563. 07 6
  564. 08 7
  565. 09 8
  566. 0A 9
  567. 0B 0
  568. 0C \-
  569. 0D \=
  570. 0E BS
  571. 0F TAB
  572. 10 Q
  573. 11 W
  574. 12 E
  575. 13 R
  576. 14 T
  577. 15 Y
  578. 16 U
  579. 17 I
  580. 18 O
  581. 19 P
  582. 1A [
  583. 1B ]
  584. 1C RET
  585. 1D CTRL
  586. 1E A
  587. 1F S
  588. 20 D
  589. 21 F
  590. 22 G
  591. 23 H
  592. 24 J
  593. 25 K
  594. 26 L
  595. 27 ;
  596. 28 '
  597. 29 \`
  598. 2A (LEFT) SHIFT
  599. 2B \\
  600. 2C Z
  601. 2D X
  602. 2E C
  603. 2F V
  604. 30 B
  605. 31 N
  606. 32 M
  607. 33 ,
  608. 34 .
  609. 35 /
  610. 36 (RIGHT) SHIFT
  611. 37 { NOT USED }
  612. 38 ALT
  613. 39 SPACE BAR
  614. 3A CAPS LOCK
  615. 3B F1
  616. 3C F2
  617. 3D F3
  618. 3E F4
  619. 3F F5
  620. 40 F6
  621. 41 F7
  622. 42 F8
  623. 43 F9
  624. 44 F10
  625. 45 { NOT USED }
  626. 46 { NOT USED }
  627. 47 HOME
  628. 48 UP ARROW
  629. 49 { NOT USED }
  630. 4A KEYPAD -
  631. 4B LEFT ARROW
  632. 4C { NOT USED }
  633. 4D RIGHT ARROW
  634. 4E KEYPAD +
  635. 4F { NOT USED }
  636. 50 DOWN ARROW
  637. 51 { NOT USED }
  638. 52 INSERT
  639. 53 DEL
  640. 54 { NOT USED }
  641. 5F { NOT USED }
  642. 60 ISO KEY
  643. 61 UNDO
  644. 62 HELP
  645. 63 KEYPAD (
  646. 64 KEYPAD /
  647. 65 KEYPAD *
  648. 66 KEYPAD *
  649. 67 KEYPAD 7
  650. 68 KEYPAD 8
  651. 69 KEYPAD 9
  652. 6A KEYPAD 4
  653. 6B KEYPAD 5
  654. 6C KEYPAD 6
  655. 6D KEYPAD 1
  656. 6E KEYPAD 2
  657. 6F KEYPAD 3
  658. 70 KEYPAD 0
  659. 71 KEYPAD .
  660. 72 KEYPAD ENTER
  661. ======= ============