Keyboard Protocol: Difference between revisions

From Atari Wiki
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
Tag: Manual revert
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  +
{{Languages|Protocole Clavier}}
<pre>
 
  +
Intelligent Keyboard (IKBD) Protocol
CLAVIER INTELLIGENT
 
   
   
  +
== Introduction ==
1. Introduction
 
2. Documents de r‚f‚rence
 
3. Clavier
 
4. Souris
 
4.1. Positionnement relatif
 
4.2. Positionnement absolu
 
4.3. Mode d‚placement curseur
 
   
  +
The Atari Corp. Intelligent Keyboard (IKBD) is a general purpose keyboard controller that is flexible enough that it can be used in a variety of products without modification. The keyboard, with its microcontroller, provides a convenient connection point for a mouse and switch-type joysticks. The IKBD processor also maintains a time-of-day clock with one second resolution. The IKBD has been designed to be general enough that it can be used with a variety of new computer products. Product variations in a number of keyswitches, mouse resolution, etc. can be accommodated. The IKBD communicates with the main processor over a high speed bi-directional serial interface. It can function in a variety of modes to facilitate different applications of the keyboard, joysticks, or mouse. Limited use of the controller is possible in applications in which only a unidirectional communications medium is available by carefully designing the default modes.
5. Manettes de jeu
 
5.1. Compte-rendu d'‚v‚nement manette de jeu
 
5.2. Interrogation de manette de jeu
 
5.3. Surveillance manette de jeu
 
5.4. Surveillance bouton de feu
 
5.5. Mode clavier des manettes de jeu
 
   
  +
== Keyboard ==
6. Horloge calendrier
 
7. Demandes d'‚tat
 
8. Mise sous tension
 
9. Jeu des commandes clavier
 
9.1. Reset
 
9.2. Mode de prise en compte des boutons de souris
 
9.3. Fixe le mode de positionnement relatif de la souris
 
9.4. Fixe le mode de positionnement absolu de la souris
 
9.5. Fixe la souris en mode clavier
 
9.6. Fixe le seuil de d‚placement souris
 
9.7. Fixe l'‚chelle de la souris
 
9.8. Mode demande de la position absolue de la souris
 
9.9. D‚finit la position de la souris
 
9.10. Fixe l'origine verticale en bas
 
9.11. Fixe l'origine verticale en haut
 
9.12. Reprise
 
9.13. D‚sactivation de la souris
 
9.14. Pause
 
9.15. Fixe le mode ‚v‚nement manette de jeu
 
9.16. Fixe le mode demande manette de jeu
 
9.17. Demande d'‚tat manette de jeu
 
9.18. Surveillance manette de jeu
 
9.19. Surveillance du bouton de feu
 
9.20. Fixe la manette de jeu en mode clavier
 
9.21. D‚sactivation des manettes de jeu
 
9.22. Mise … jour de l'horloge-calendrier
 
9.23. Demande de la date et de l'heure
 
9.24. Chargement de donn‚es en m‚moire
 
9.25. Lecture de donn‚es en m‚moire
 
9.26. Ex‚cution de routine contr“leur
 
9.27. Demandes d'‚tat
 
   
  +
The keyboard always returns key make/break scan codes. The IKBD generates keyboard scan codes for each key press and release. The key scan make (key closure) codes start at 1, and are defined in Appendix A. For example, the ISO key position in the scan code table should exist even if no keyswitch exists in that position on a particular keyboard. The break code for each key is obtained by ORing 0x80 with the make code.
10. Appendice A : Codes de scrutation clavier
 
   
  +
The special codes 0xF6 through 0xFF are reserved for use as follows:
  +
{|
  +
|0xF6 || status report
  +
|-
  +
|0xF7 || absolute mouse position record
  +
|-
  +
|0xF8-0xFB ||relative mouse position records(lsbs determind by mouse button states)
  +
|-
  +
|0xFC || time-of-day
  +
|-
  +
|0xFD || joystick report (both sticks)
  +
|-
  +
|0xFE || joystick 0 event
  +
|-
  +
|0xFF || joystick 1 event
  +
|}
   
  +
The two shift keys return different scan codes in this mode. The ENTER key and the RETURN key are also distinct.
 
PROTOCOLE DU CLAVIER INTELLIGENT
 
(Mise … jour : 26/02/85)
 
   
  +
== Mouse ==
   
  +
The mouse port should be capable of supporting a mouse with resolution of approximately 200 counts (phase changes or 'clicks') per inch of travel. The mouse should be scanned at a rate that will permit accurate tracking at velocities up to 10 inches per second. The IKBD can report mouse motion in three distinctly different ways. It can report relative motion, absolute motion in a coordinate system maintained within the IKBD, or by converting mouse motion into keyboard cursor control key equivalents. The mouse buttons can be treated as part of the mouse or as additional keyboard keys.
   
  +
=== Relative Position Reporting ===
   
  +
In relative position mode, the IKBD will return relative mouse position records whenever a mouse event occurs. A mouse event consists of a mouse button being pressed or released, or motion in either axis exceeding a settable threshold of motion. Regardless of the threshold, all bits of resolution are returned to the host computer. Note that the IKBD may return mouse relative position reports with
  +
significantly more than the threshold delta x or y. This may happen since no relative mouse motion events will be generated: (a) while the keyboard has been 'paused' ( the event will be stored until keyboard communications is resumed) (b) while any event is being transmitted.
   
  +
The relative mouse position record is a three byte record of the form (regardless of keyboard mode):
1. Introduction
 
  +
<pre>
  +
%111110xy ; mouse position record flag
  +
; where y is the right button state
  +
; and x is the left button state
  +
X ; delta x as twos complement integer
  +
Y ; delta y as twos complement integer
  +
</pre>
  +
Note that the value of the button state bits should be valid even if the MOUSE BUTTON ACTION has set the buttons to act like part of the keyboard. If the accumulated motion before the report packet is generated exceeds the +127...-128 range, the motion is broken into multiple packets. Note that the sign of the delta y reported is a function of the Y origin selected.
   
  +
=== Absolute Position reporting ===
Le clavier intelligent (IKBD) d'Atari Corp. est un contr“leur
 
clavier d'usage commun suffisamment flexible pour ˆtre utilis‚
 
avec un grand nombre de produits sans modifications. Le clavier,
 
avec son contr“leur, fournit des points de connexion convenables
 
pour une souris et des manettes de jeu. Le processeur clavier
 
comporte ‚galement une horloge avec gestion de la date d'une
 
pr‚cision d'une seconde.
 
   
  +
The IKBD can also maintain absolute mouse position. Commands exist for reseting the mouse position, setting X/Y scaling, and interrogating the current mouse position.
Le clavier intelligent a ‚t‚ con‡u comme suffisamment g‚n‚ral
 
pour pouvoir servir dans un grand nombre de nouveaux produits
 
informatiques. Des ajustements quant au nombre de touches du
 
clavier, la r‚solution de la souris, etc. peuvent ˆtre effectu‚s.
 
   
  +
=== Mouse Cursor Key Mode ===
Le clavier intelligent communique avec le processeur maŒtre
 
par une liaison s‚rie bi-directionnelle … haute vitesse. Il peut
 
fonctionner dans plusieurs modes afin de rendre possibles diverses
 
utilisations du clavier, des manettes de jeu ou de la souris. Un
 
usage restreint du contr“leur est ‚galement autoris‚ pour des
 
applications dans lesquelles un mode de communication
 
unidirectionnel est utile, ceci par une gestion soigneuse des
 
modes par d‚faut.
 
   
  +
The IKBD can translate mouse motion into the equivalent cursor keystrokes. The number of mouse clicks per keystroke is independently programmable in each axis. The IKBD internally maintains mouse motion information to the highest resolution available, and merely generates a pair of cursor key events for each multiple of the scale factor. Mouse motion produces the cursor key make code immediately followed by the break code for the appropriate cursor key. The mouse buttons produce scan codes above those normally assigned for the largest envisioned keyboard (i.e. LEFT=0x74 & RIGHT=0x75).
   
  +
== Joystick ==
2. Documents de r‚f‚rence
 
 
Atari Corp. RBP/GHU/SD Keyboard Schematic (14/09/84)
 
Atari Corp. RBP/GHU/SD Keyboard Layout (non pagin‚, non dat‚)
 
   
  +
=== Joystick Event Reporting ===
   
  +
In this mode, the IKBD generates a record whenever the joystick position is changed (i.e. for each opening or closing of a joystick switch or trigger).
3. Clavier
 
   
  +
The joystick event record is two bytes of the form:
Le clavier retourne toujours les codes d'appui et de
 
  +
<pre>
relƒchement de touche, chaque fois qu'une touche est press‚e ou
 
  +
%1111111x ; Joystick event marker
relƒch‚e. Les codes d'appui de touche d‚butent … 1 et sont d‚finis
 
  +
; where x is Joystick 0 or 1
dans l'appendice A en fin de chapitre. A titre d'exemple, la
 
  +
%x000yyyy ; where yyyy is the stick position
position de la touche ISO dans la table des codes de touches
 
  +
; and x is the trigger
press‚es existera mˆme si aucune touche ne correspond … cette
 
  +
</pre>
position sur un clavier particulier. Le code de relƒchement de
 
  +
5.2 Joystick Interrogation
touche peut ˆtre obtenu en effectuant un OU logique entre 0x80 et
 
le code d'appui de la touche (bit 7 positionn‚ … 1).
 
   
  +
The current state of the joystick ports may be interrogated at any time in this mode by sending an 'Interrogate Joystick' command to the IKBD.
Les codes sp‚cifiques 0xF6 … 0xFF sont r‚serv‚s pour les
 
fonctions suivantes :
 
   
  +
The IKBD response to joystick interrogation is a three byte report of the form
OxF6 compte-rendu d'‚tat
 
  +
<pre>
0xF7 position absolue de la souris
 
0xF8-0xFB position relative de la souris
+
0xFD ; joystick report header
(bit 0 … 1 si bouton droit appuy‚
+
%x000yyyy ; Joystick 0
bit 1 … 1 si bouton gauche appuy‚)
+
%x000yyyy ; Joystick 1
0xFC heure et date
+
; where x is the trigger
0xFD descripteur d'‚tat manettes de jeu
+
; and yyy is the stick position
  +
</pre>
0xFE ‚v‚nement manette de jeu 0
 
  +
=== Joystick Monitoring ===
0xFF ‚v‚nement manette de jeu 1
 
   
  +
A mode is available that devotes nearly all of the keyboard communications time to reporting the state of the joystick ports at a user specifiable rate. It remains in this mode until reset or commanded into another mode. The PAUSE command in this mode not only stop the output but also temporarily stops
Les deux touches 'Shift' retournent des codes d'appui
 
  +
scanning the joysticks (samples are not queued).
diff‚rents. Il en va de mˆme pour les touches 'Enter' et 'Return'.
 
   
  +
=== Fire Button Monitoring ===
   
  +
A mode is provided to permit monitoring a single input bit at a high rate. In this mode the IKBD monitors the state of the Joystick 1 fire button at the maximum rate permitted by the serial communication channel. The data is packed 8 bits per byte for transmission to the host. The IKBD remains in this mode until reset or commanded into another mode. The PAUSE command in this mode not only stops the output but also temporarily stops scanning the button (samples are not queued).
4. Souris
 
   
  +
=== Joystick Key Code Mode ===
Le port souris doit ˆtre capable de contr“ler une souris avec
 
une r‚solution d'environ 200 comptes (d‚placements ou cliquages)
 
par pouce (NDT: soit 80 positions par centimŠtres environ). La
 
souris doit ˆtre scrut‚e suffisament souvent pour autoriser le
 
suivi de d‚placements … une vitesse allant jusqu'… 10 pouces par
 
seconde (NDT: soit environ 25 cm/s).
 
   
  +
The IKBD may be commanded to translate the use of either joystick into the equivalent cursor control keystroke(s). The IKBD provides a single breakpoint velocity joystick cursor.
Le clavier intelligent peut rendre compte des actions sur la
 
  +
Joystick events produce the make code, immediately followed by the break code for the appropriate cursor motion keys. The trigger or fire buttons of the joysticks produce pseudo key scan codes above those used by the largest key matrix envisioned (i.e. JOYSTICK0=0x74, JOYSTICK1=0x75).
souris selon trois modes distincts. Il peut rendre compte de la
 
position relative (… la pr‚c‚dente), de la position absolue de la
 
souris dans un systŠme de coordonn‚es convenu, ou convertir les
 
d‚placements de la souris en codes clavier curseur ‚quivalents.
 
   
  +
== Time-of-Day Clock ==
Les boutons de la souris peuvent ˆtre trait‚s comme partie
 
int‚grante de la souris ou comme des touches de clavier
 
suppl‚mentaires.
 
   
  +
The IKBD also maintains a time-of-day clock for the system. Commands are available to set and interrogate the timer-of-day clock. Time-keeping is maintained down to a resolution of one second.
4.1. Positionnement relatif
 
   
  +
== Status Inquiries ==
En mode positionnement relatif, le clavier retournera un
 
descripteur de position de la souris lorsqu'un ‚v‚nement souris se
 
produira. Constitue un ‚v‚nement souris tout appui ou tout
 
relƒchement de bouton, ou tout d‚placement d‚passant dans l'un des
 
axes de coordonn‚es un seuil donn‚. En l'absence de seuil, tout
 
bit de r‚solution provoque un envoi vers le processeur maŒtre.
 
   
  +
The current state of IKBD modes and parameters may be found by sending status inquiry commands that correspond to the IKBD set commands.
On notera que le clavier intelligent peut retourner une
 
position relative de la souris avec un incr‚ment horizontal ou
 
vertical significativement plus ‚lev‚ que le seuil. Cela arrivera
 
lorsqu'aucun compte-rendu de positionnement relatif de la souris
 
n'aura ‚t‚ renvoy‚ : a) parce que le clavier a ‚t‚ inhib‚ (les
 
‚v‚nements seront stock‚s jusqu'… ce que la communication avec le
 
clavier reprenne) b) parce qu'un ‚v‚nement est en train d'ˆtre
 
transmis.
 
   
  +
== Power-Up Mode ==
Le descripteur de positionnement relatif de la souris est un
 
bloc constitu‚ de trois octets (peu importe le mode clavier):
 
   
  +
The keyboard controller will perform a simple self-test on power-up to detect major controller faults (ROM checksum and RAM test) and such things as stuck keys. Any keys down at power-up are presumed to be stuck, and their BREAK (sic) code is returned (which without the preceding MAKE code is a flag for a keyboard error). If the controller self-test completes without error, the code
%1111 10xx drapeau de positionnement relatif
 
  +
0xF0 is returned. (This code will be used to indicate the version/release of the IKBD controller. The first release of the IKBD is version 0xF0, should there be a second release it will be 0xF1, and so on.)
||
 
  +
The IKBD defaults to a mouse position reporting with threshold of 1 unit in either axis and the Y=0 origin at the top of the screen, and joystick event reporting mode for joystick 1, with both buttons being logically assigned to the mouse. After any joystick command, the IKBD assumes that joysticks are connected to both Joystick0 and Joystick1. Any mouse command (except MOUSE DISABLE) then causes port 0 to again be scanned as if it were a mouse, and both buttons are logically connected to it. If a mouse disable command is received while port 0 is presumed to be a mouse, the button is logically assigned to Joystick1 ( until the mouse is re enabled by another mouse command).
| ---------- ‚tat du bouton droit
 
----------- ‚tat du bouton gauche
 
deltaX d‚calage horizontal sign‚
 
deltaY d‚calage vertical sign‚
 
   
  +
== IKBD Command Set ==
On notera que la valeur des bits d'‚tat des boutons doit ˆtre
 
valide mˆme si le MODE D'ACTIVATION SOURIS a ‚t‚ positionn‚ pour
 
que les boutons soient consid‚r‚s comme partie int‚grante du
 
clavier.
 
   
  +
This section contains a list of commands that can be sent to the IKBD. Command codes (such as 0x00) which are not specified should perform no operation (NOPs).
Si le d‚calage cumul‚ des d‚placements horizontaux ou
 
verticaux de la souris d‚borde le domaine +127 … -128, le compte-
 
rendu de positionnement relatif est effectu‚ sur plusieurs blocs
 
descriptifs successifs.
 
   
  +
=== RESET ===
On notera que le signe du d‚calage vertical deltaY est
 
fonction de l'origine verticale choisie.
 
   
  +
0x80
4.2. Positionnement absolu
 
  +
0x01
   
  +
N.B. The RESET command is the only two byte command understood by the IKBD. Any byte following an 0x80 command byte other than 0x01 is ignored (and causes the 0x80 to be ignored).
Le clavier intelligent a la possibilit‚ de rendre compte de
 
  +
A reset may also be caused by sending a break lasting at least 200mS to the IKBD.
la position de la souris en coordonn‚es absolues. Des commandes
 
  +
Executing the RESET command returns the keyboard to its default (power-up) mode and parameter settings. It does not affect the time-of-day clock. The RESET command or function causes the IKBD to perform a simple self-test. If the test is successful, the IKBD will send the code of 0xF0 within 300mS of receipt of the RESET command (or the end of the break, or power-up). The IKBD will then scan the key matrix for any stuck (closed) keys. Any keys found closed will cause the break scan code to be generated (the break code arriving without being preceded by the make code is a flag for a key matrix error).
existent pour r‚initialiser la position de la souris, d‚finir les
 
‚chelles horizontale et verticale, et demander la position
 
courante de la souris.
 
   
  +
=== SET MOUSE BUTTON ACTION ===
4.3. Mode d‚placement curseur
 
  +
<pre>
  +
0x07
  +
%00000mss ; mouse button action
  +
; (m is presumed = 1 when in MOUSE KEYCODE mode)
  +
; mss=0xy, mouse button press or release causes mouse
  +
; position report
  +
; where y=1, mouse key press causes absolute report
  +
; and x=1, mouse key release causes absolute report
  +
; mss=100, mouse buttons act like keys
  +
</pre>
  +
This command sets how the IKBD should treat the buttons on the mouse. The default mouse button action mode is %00000000, the buttons are treated as part of the mouse logically. When buttons act like keys, LEFT=0x74 & RIGHT=0x75.
   
  +
=== SET RELATIVE MOUSE POSITION REPORTING ===
Le clavier intelligent peut convertir les actions sur la
 
souris en ‚quivalences clavier. Le nombre d'appuis de touche
 
correspondant … une action peut ˆtre sp‚cifi‚ diff‚remment pour
 
chaque axe. Le clavier intelligent fournit des informations sur
 
les actions souris selon la plus haute r‚solution valable et
 
g‚nŠre simplement une paire d'‚v‚nements appui de touche pour
 
chaque multiple du facteur d'‚chelle.
 
   
  +
0x08
Ce mode de fonctionnement provoque l'envoi du code de
 
relƒchement de touche imm‚diatement aprŠs le code d'appui de
 
touche. Les appuis de bouton de la souris provoquent ‚galement
 
l'envoi de codes d'appui et de relƒchement de touche correspondant
 
… ceux qui leur sont normalement assign‚s dans la table des codes
 
clavier (soit 0x74 pour le bouton droit et 0x75 pour le gauche).
 
   
  +
Set relative mouse position reporting. (DEFAULT) Mouse position packets are generated asynchronously by the IKBD whenever motion exceeds the setable threshold in either axis (see SET MOUSE THRESHOLD). Depending upon the mouse key mode, mouse position reports may also be generated when either mouse button is pressed or released. Otherwise the mouse buttons behave as if they were keyboard keys.
   
  +
=== SET ABSOLUTE MOUSE POSITIONING ===
5. Manettes de jeu
 
  +
<pre>
  +
0x09
  +
XMSB ; X maximum (in scaled mouse clicks)
  +
XLSB
  +
YMSB ; Y maximum (in scaled mouse clicks)
  +
YLSB
  +
</pre>
  +
Set absolute mouse position maintenance. Resets the IKBD maintained X and Y coordinates.
  +
In this mode, the value of the internally maintained coordinates does NOT wrap between 0 and large positive numbers. Excess motion below 0 is ignored. The command sets the maximum positive value that can be attained in the scaled coordinate system. Motion beyond that value is also ignored.
   
  +
=== SET MOUSE KEYCODE MOSE ===
5.1. Compte-rendu d'‚v‚nement manette de jeu
 
  +
<pre>
  +
0x0A
  +
deltax ; distance in X clicks to return (LEFT) or (RIGHT)
  +
deltay ; distance in Y clicks to return (UP) or (DOWN)
  +
</pre>
  +
Set mouse monitoring routines to return cursor motion keycodes instead of either RELATIVE or ABSOLUTE motion records. The IKBD returns the appropriate cursor keycode after mouse travel exceeding the user specified deltas in either axis. When the keyboard is in key scan code mode, mouse motion will cause the make code immediately followed by the break code. Note that this command is not affected by the mouse motion origin.
   
  +
=== SET MOUSE THRESHOLD ===
Dans ce mode, le clavier intelligent g‚nŠre un bloc
 
  +
<pre>
descripteur chaque fois que la position de la manette de jeu a
 
  +
0x0B
chang‚e (c'est-…-dire pour chaque ouverture ou fermeture d'un
 
  +
X ; x threshold in mouse ticks (positive integers)
interrupteur ou contact de la manette de jeu).
 
  +
Y ; y threshold in mouse ticks (positive integers)
Le bloc descripteur d'un ‚v‚nement manette de jeu est
 
  +
</pre>
constitu‚ de deux octets:
 
  +
This command sets the threshold before a mouse event is generated. Note that it does NOT affect the resolution of the data returned to the host. This command is valid only in RELATIVE MOUSE POSITIONING mode. The thresholds default to 1 at RESET (or power-up).
   
  +
=== SET MOUSE SCALE ===
%1111 111x d‚signe un ‚v‚nement manette de jeu
 
  +
<pre>
|
 
  +
0x0C
--------- manette de jeu 0 ou 1
 
  +
X ; horizontal mouse ticks per internel X
%x000 yyyy
 
| ||||
+
Y ; vertical mouse ticks per internel Y
  +
</pre>
| ------------ position de la manette
 
  +
This command sets the scale factor for the ABSOLUTE MOUSE POSITIONING mode. In this mode, the specified number of mouse phase changes ('clicks') must occur before the internally maintained coordinate is changed by one (independently scaled for each axis). Remember that the mouse position
----------------- ‚tat du bouton de feu
 
  +
information is available only by interrogating the IKBD in the ABSOLUTE MOUSE POSITIONING mode unless the IKBD has been commanded to report on button press or release (see SET MOSE BUTTON ACTION).
   
  +
=== INTERROGATE MOUSE POSITION ===
5.2. Interrogation de manette de jeu
 
  +
<pre>
  +
0x0D
  +
Returns:
  +
0xF7 ; absolute mouse position header
  +
BUTTONS
  +
0000dcba ; where a is right button down since last interrogation
  +
; b is right button up since last
  +
; c is left button down since last
  +
; d is left button up since last
  +
XMSB ; X coordinate
  +
XLSB
  +
YMSB ; Y coordinate
  +
YLSB
  +
</pre>
  +
The INTERROGATE MOUSE POSITION command is valid when in the ABSOLUTE MOUSE
  +
POSITIONING mode, regardless of the setting of the MOUSE BUTTON ACTION.
   
  +
=== LOAD MOUSE POSITION ===
L'‚tat courant des ports manette de jeu peut ˆtre interrog‚ …
 
  +
<pre>
n'importe quel moment dans ce mode en envoyant une commande
 
  +
0x0E
d'"interrogation manette de jeu" vers le circuit clavier.
 
  +
0x00 ; filler
  +
XMSB ; X coordinate
  +
XLSB ; (in scaled coordinate system)
  +
YMSB ; Y coordinate
  +
YLSB
  +
</pre>
  +
This command allows the user to preset the internally maintained absolute mouse position.
   
  +
=== SET Y=0 AT BOTTOM ===
La r‚ponse du clavier intelligent … cette interrogation prend
 
la forme d'un bloc de trois octets ayant le sens suivant :
 
   
  +
0x0F
0xFD en-tˆte de r‚ponse manette de jeu
 
%x000 yyyy manette de jeu 0
 
%x000 yyyy manette de jeu 1
 
   
  +
This command makes the origin of the Y axis to be at the bottom of the logical coordinate system internel to the IKBD for all relative or absolute mouse motion. This causes mouse motion toward the user to be negative in sign and away from the user to be positive.
o— x correspond … l'‚tat du bouton de feu et yyyy … la
 
position de la manette.
 
   
  +
=== SET Y=0 AT TOP ===
5.3. Surveillance manette de jeu
 
   
  +
0x10
Ce mode permet de consacrer presque toute l'activit‚ du
 
circuit clavier au compte-rendu des ‚tats successifs des manettes
 
de jeu selon une cadence d‚finie par l'utilisateur. Le clavier
 
reste dans ce mode jusqu'… une commande de reset ou une commande
 
le placant dans un autre mode. Dans ce mode, la commande PAUSE ne
 
stoppe pas seulement les communications entre le clavier et le
 
processeur mais ‚galement la scrutation des manettes de jeu (les
 
informations ne sont pas empil‚es).
 
   
  +
Makes the origin of the Y axis to be at the top of the logical coordinate system within the IKBD for all relative or absolute mouse motion. (DEFAULT) This causes mouse motion toward the user to be positive in sign and away from the user to be negative.
5.4. Surveillance Bouton de feu
 
   
  +
=== RESUME ===
Ce mode permet de d‚dier le circuit clavier au seul contr“le
 
du bouton de feu de la manette de jeu. Dans ce mode, l'‚tat du
 
bouton de feu est test‚ … la fr‚quence maximale autoris‚e par la
 
vitesse de transmission s‚rie. Les donn‚es sont compact‚es sur
 
huit bits pour envoi au processeur maŒtre. Le circuit clavier
 
reste dans ce mode jusqu'… une commande de reset ou une commande
 
de changement de mode. Dans ce mode la commande PAUSE ne stoppe
 
pas seulement l'envoi des informations du clavier vers le
 
processeur mais arrˆte aussi temporairement la scrutation du
 
bouton de mise … feu (les informations ne sont pas empil‚es).
 
   
  +
0x11
5.5. Mode Clavier des manettes de jeu
 
   
  +
Resume sending data to the host. Since any command received by the IKBD after its output has been paused also causes an implicit RESUME this command can be thought of as a NO OPERATION command. If this command is received by the IKBD and it is not PAUSED, it is simply ignored.
Le circuit clavier peut ˆtre command‚ pour que les actions
 
sur les manettes de jeu soient converties en ‚quivalents clavier
 
(touches curseur).
 
 
Les ‚v‚nements manette de jeu produisent un code d'appui de
 
touche imm‚diatement suivi d'un code de relƒchement, de la mˆme
 
fa‡on que pour les ‚v‚nements souris. Les boutons de feu des
 
manettes de jeu ont ‚galement leur ‚quivalents clavier, codes
 
juste sup‚rieurs … ceux de la matrice clavier (soit 0x74 pour la
 
manette 0 et 0x75 pour la manette 1).
 
   
  +
=== DISABLE MOUSE ===
   
  +
0x12
6. Horloge calendrier
 
   
  +
All mouse event reporting is disabled (and scanning may be internally disabled). Any valid mouse mode command resumes mouse motion monitoring. (The valid mouse mode commands are SET RELATIVE MOUSE POSITION REPORTING, SET ABSOLUTE MOUSE POSITIONING, and SET MOUSE KEYCODE MODE. ) N.B. If the mouse buttons have been commanded to act like keyboard keys, this command DOES affect their actions.
Le clavier intelligent contr“le ‚galement une horloge
 
calendrier pour le systŠme. Des commandes sont disponibles pour
 
remettre … jour et interroger cette horloge calendrier. La mise …
 
jour est garantie pour une pr‚cision de une seconde.
 
   
  +
=== PAUSE OUTPUT ===
   
  +
0x13
7. Demandes d'‚tat
 
   
  +
Stop sending data to the host until another valid command is received. Key matrix activity is still monitored and scan codes or ASCII characters enqueued (up to the maximum supported by the microcontroller) to be sent when the host allows the output to be resumed. If in the JOYSTICK EVENT REPORTING mode, joystick events are also queued.
L'‚tat courant du clavier, les modes actifs et les paramŠtres
 
  +
Mouse motion should be accumulated while the output is paused. If the IKBD is in RELATIVE MOUSE POSITIONING REPORTING mode, motion is accumulated beyond the normal threshold limits to produce the minimum number of packets necessary for transmission when output is resumed. Pressing or releasing either mouse button causes any accumulated motion to be immediately queued as packets, if the mouse is in RELATIVE MOUSE POSITION REPORTING mode. Because of the limitations of the microcontroller memory this command should be used sparingly, and the output should not be shut of for more than <tbd> milliseconds at a time.
peuvent ˆtre obtenus par des commandes de demande d'‚tat
 
  +
The output is stopped only at the end of the current 'even'. If the PAUSE OUTPUT command is received in the middle of a multiple byte report, the packet will still be transmitted to conclusion and then the PAUSE will take effect. When the IKBD is in either the JOYSTICK MONITORING mode or the FIRE BUTTON MONITORING mode, the PAUSE OUTPUT command also temporarily stops the monitoring process (i.e. the samples are not enqueued for transmission).
correspondant … des commandes du clavier intelligent.
 
   
  +
=== SET JOYSTICK EVENT REPORTING ===
   
  +
0x14
8. Mise sous tension
 
   
  +
Enter JOYSTICK EVENT REPORTING mode (DEFAULT). Each opening or closure of a joystick switch or trigger causes a joystick event record to be generated.
Le contr“leur clavier effectue un auto-test simple … la mise
 
sous tension afin de d‚tecter des erreurs majeures (somme de
 
contr“le des m‚moires mortes et test des m‚moires vives) et divers
 
problŠmes comme des touches coinc‚es. Toute touche appuy‚e lors de
 
la mise sous tension est consid‚r‚e comme coinc‚e et son code de
 
relƒchement est renvoy‚ (ce qui, en l'absence de code d'appui le
 
pr‚c‚dant, est consid‚r‚ comme une erreur clavier). Si l'auto-
 
test du contr“leur s'est d‚roul‚ sans erreur, le code 0xF0 est
 
renvoy‚. (La premiŠre version du clavier intelligent ‚tait la
 
version 0xF0, les suivantes auront les num‚ros 0xF1, etc.)
 
   
  +
=== SET JOYSTICK INTERROGATION MODE ===
Les options par d‚faut du clavier sont les suivantes :
 
1) Compte-rendu du positionnement de la souris en mode relatif
 
avec un incr‚ment d'une unit‚ pour chaque axe.
 
2) Origine verticale Y=0 correspondant au haut de l'‚cran.
 
3) Mode compte-rendu d'‚v‚nement pour les manettes de jeu.
 
4) Deux boutons pris en compte pour la souris.
 
   
  +
0x15
AprŠs toute commande manette de jeu, le circuit clavier
 
considŠre que les manettes de jeu sont connect‚es aux ports 0 et 1
 
des manettes de jeu. Toute commande souris (sauf la DESACTIVATION
 
DE SOURIS) entraŒne la scrutation du port 0 comme ‚tant le port
 
reli‚ … la souris et les deux boutons d‚pendant de celle-ci. Si
 
une commande de d‚sactivation de la souris est re‡ue alors que le
 
port 0 est logiquement li‚ … une souris, le bouton est alors
 
assign‚ … la manette 1.
 
   
  +
Disables JOYSTICK EVENT REPORTING. Host must send individual JOYSTICK INTERROGATE commands to sense joystick state.
9. Jeu des commandes clavier
 
   
  +
=== JOYSTICK INTERROGATE ===
Cette partie comprend la liste des commandes qui peuvent ˆtre
 
envoy‚es au clavier intelligent. Les codes de commande (comme
 
0x00) qui ne sont pas d‚velopp‚s ici ne provoquent aucune
 
op‚ration (ils peuvent ˆtre assimil‚s … des NOP).
 
   
  +
0x16
9.1. RESET
 
   
  +
Return a record indicating the current state of the joysticks. This command is valid in either the JOYSTICK EVENT REPORTING mode or the JOYSTICK INTERROGATION MODE.
Ox80
 
0x01
 
   
  +
=== SET JOYSTICK MONITORING ===
REMARQUE: La commande RESET est la seule commande clavier qui
 
  +
<pre>
comprenne deux octets en dehors des paramŠtres. Tout octet suivant
 
  +
0x17
0x80, autre que 0x01, sera ignor‚ (et provoquera la non prise en
 
  +
rate ; time between samples in hundreths of a second
compte de la commande 0x80).
 
  +
Returns: (in packets of two as long as in mode)
  +
%000000xy ; where y is JOYSTICK1 Fire button
  +
; and x is JOYSTICK0 Fire button
  +
%nnnnmmmm ; where m is JOYSTICK1 state
  +
; and n is JOYSTICK0 state
  +
</pre>
  +
Sets the IKBD to do nothing but monitor the serial command lne, maintain the time-of-day clock, and monitor the joystick. The rate sets the interval between joystick samples. N.B. The user should not set the rate higher than the serial communications channel will allow the 2 bytes packets to be transmitted.
   
  +
=== SET FIRE BUTTON MONITORING ===
Un reset du circuit clavier peut ‚galement ˆtre provoqu‚ en
 
  +
<pre>
envoyant un break durant au moins 200ms vers le circuit clavier.
 
  +
0x18
  +
Returns: (as long as in mode)
  +
%bbbbbbbb ; state of the JOYSTICK1 fire button packed
  +
; 8 bits per byte, the first sample if the MSB
  +
</pre>
  +
Set the IKBD to do nothing but monitor the serial command line, maintain the time-of-day clock, and monitor the fire button on Joystick 1. The fire button is scanned at a rate that causes 8 samples to be made in the time it takes for the previous byte to be sent to the host (i.e. scan rate = 8/10 * baud rate).
  +
The sample interval should be as constant as possible.
   
  +
=== SET JOYSTICK KEYCODE MODE ===
L'envoi d'une commande reset amŠne la remise des paramŠtres
 
  +
<pre>
clavier … leurs valeurs par d‚faut (voir 8. Mise sous tension). Il
 
  +
0x19
n'affecte pas l'horloge calendrier.
 
  +
RX ; length of time (in tenths of seconds) until
  +
; horizontal velocity breakpoint is reached
  +
RY ; length of time (in tenths of seconds) until
  +
; vertical velocity breakpoint is reached
  +
TX ; length (in tenths of seconds) of joystick closure
  +
; until horizontal cursor key is generated before RX
  +
; has elapsed
  +
TY ; length (in tenths of seconds) of joystick closure
  +
; until vertical cursor key is generated before RY
  +
; has elapsed
  +
VX ; length (in tenths of seconds) of joystick closure
  +
; until horizontal cursor keystokes are generated
  +
; after RX has elapsed
  +
VY ; length (in tenths of seconds) of joystick closure
  +
; until vertical cursor keystokes are generated
  +
; after RY has elapsed
  +
</pre>
  +
In this mode, joystick 0 is scanned in a way that simulates cursor keystrokes. On initial closure, a keystroke pair (make/break) is generated. Then up to Rn tenths of seconds later, keystroke pairs are generated every Tn tenths of seconds. After the Rn breakpoint is reached, keystroke pairs are generated every Vn tenths of seconds. This provides a velocity (auto-repeat) breakpoint
  +
feature.
  +
Note that by setting RX and/or Ry to zero, the velocity feature can be disabled. The values of TX and TY then become meaningless, and the generation of cursor 'keystrokes' is set by VX and VY.
   
  +
=== DISABLE JOYSTICKS ===
Une commande de RESET provoque l'auto-test du circuit
 
clavier. Si ce test est positif, le clavier envoie le code 0xF0
 
dans un d‚lai de 300ms aprŠs la r‚ception de la commande RESET (ou
 
… la fin du break s'il s'agit d'un reset mat‚riel). Le clavier
 
teste ensuite la matrice clavier pour d‚celer d'‚ventuelles
 
touches coinc‚es. Toute touche consid‚r‚e comme coinc‚e provoque
 
l'envoi du code break (relƒchement) correspondant … cette touche
 
(un code de relƒchement survenant sans avoir ‚t‚ pr‚c‚d‚ par un
 
code d'appui de touche doit ˆtre consid‚r‚ comme une erreur au
 
niveau de la matrice clavier).
 
 
Notes du traducteur : De par son architecture mat‚rielle, l'unit‚
 
centrale du ST est reli‚e au clavier intelligent via le processeur
 
multifonctions MC68901 et un ACIA MC6850. C'est ce dernier circuit
 
qui assure les communications s‚rie entre le MC68000 et le 6801
 
responsable du clavier. Il en d‚coule que toute commande vers le
 
circuit clavier suppose que l'ACIA est actif et correctement
 
programm‚.
 
A titre d'information, voici l'ensemble des commandes de
 
reset de circuit ACIA et clavier envoy‚es lors du boot du systŠme
 
par le systŠme d'exploitation :
 
move.b #$3,$FFFC00 * reset ACIA MC6850
 
move.b #$96,$FFFC00 * division horloge/16, 8 bits
 
* sans parit‚, 1 bit stop,etc.
 
move.l #_commande,-(sp) * ptr commande reset et modes
 
move.w #3,-(a7) * 4 octets … envoyer
 
bsr _Ikbdws * fonction $19 du trap 14
 
_commande dc.b $80,$01,$12,$1A * reset, d‚sactive souris et
 
* manettes de jeu
 
9.2. FIXE LE MODE DE PRISE EN COMPTE DES BOUTONS DE SOURIS
 
   
0x07
+
0x1A
%0000 0mss mode de prise en compte
 
||| (m est suppos‚ … 1 en mode code CLAVIER
 
||| de la souris)
 
------------ 0wx l'appui ou le relƒchement de
 
|| bouton provoque un compte-rendu
 
|| de position souris (wx n'est
 
|| significatif que si la souris
 
|| est en positionnement absolu)
 
| --- 1 -> la pression du bouton pro-
 
| voque un compte-rendu de
 
| la position absolue
 
---- 1 -> le relƒchement du bouton
 
provoque un compte-rendu de
 
la position absolue
 
100 : les boutons de la souris sont
 
consid‚r‚s comme des touches.
 
   
  +
Disable the generation of any joystick events (and scanning may be internally disabled). Any valid joystick mode command resumes joystick monitoring. (The joystick mode commands are SET JOYSTICK EVENT REPORTING, SET JOYSTICK INTERROGATION MODE, SET JOYSTICK MONITORING, SET FIRE BUTTON MONITORING, and SET JOYSTICK KEYCODE MODE.)
   
  +
=== TIME-OF-DAY CLOCK SET ===
Cette commande d‚finit la fa‡on d'agir des boutons de la
 
  +
<pre>
souris, plus pr‚cis‚ment la fa‡on dont ils seront pris en compte.
 
  +
0x1B
Le mode de traitement par d‚faut des boutons de la souris est
 
  +
YY ; year (2 least significant digits)
%00000000, c'est-…-dire que les boutons sont consid‚r‚s comme
 
  +
MM ; month
partie int‚grante de la souris.
 
  +
DD ; day
  +
hh ; hour
  +
mm ; minute
  +
ss ; second
  +
</pre>
  +
All time-of-day data should be sent to the IKBD in packed BCD format. Any digit that is not a valid BCD digit should be treated as a 'don't care' and not alter that particular field of the date or time. This permits setting only some subfields of the time-of-day clock.
   
  +
=== INTERROGATE TIME-OF-DAT CLOCK ===
9.3. FIXE LE MODE DE POSITIONNEMENT RELATIF DE LA SOURIS
 
  +
<pre>
  +
0x1C
  +
Returns:
  +
0xFC ; time-of-day event header
  +
YY ; year (2 least significant digits)
  +
MM ; month
  +
DD ; day
  +
hh ; hour
  +
mm ; minute
  +
ss ; second
  +
</pre>
  +
All time-of-day is sent in packed BCD format.
   
  +
=== MEMORY LOAD ===
0x08
 
  +
<pre>
  +
0x20
  +
ADRMSB ; address in controller
  +
ADRLSB ; memory to be loaded
  +
NUM ; number of bytes (0-128)
  +
{ data }
  +
</pre>
  +
This command permits the host to load arbitrary values into the IKBD controller memory. The time between data bytes must be less than 20ms.
   
  +
=== MEMORY READ ===
  +
<pre>
  +
0x21
  +
ADRMSB ; address in controller
  +
ADRLSB ; memory to be read
  +
Returns:
  +
0xF6 ; status header
  +
0x20 ; memory access
  +
{ data } ; 6 data bytes starting at ADR
  +
</pre>
  +
This command permits the host to read from the IKBD controller memory.
   
  +
=== CONTROLLER EXECUTE ===
Place la souris en mode relatif (mode PAR DEFAUT), c'est …
 
  +
<pre>
dire que chaque d‚placement de la souris provoque l'envoi d'un
 
  +
0x22
descripteur comprenant les d‚calages horizontaux et verticaux
 
  +
ADRMSB ; address of subroutine in
relatifs … la pr‚c‚dente position. Les blocs descripteurs de
 
  +
ADRLSB ; controller memory to be called
positionnement sont g‚n‚r‚s de fa‡on asynchrone par le clavier
 
  +
</pre>
intelligent lorsqu'un d‚placement selon l'un des axes d‚passe le
 
  +
This command allows the host to command the execution of a subroutine in the IKBD controller memory.
seuil minimal fix‚ (voir 9.6. SEUIL DECALAGE SOURIS). Selon le
 
mode fix‚ par la commande pr‚c‚dente, des descripteurs de position
 
peuvent ‚galement ˆtre envoy‚s lorsqu'un des boutons de la souris
 
est press‚ ou relƒch‚. Dans les autres cas, les boutons de la
 
souris sont consid‚r‚s comme des touches clavier.
 
   
  +
=== STATUS INQUIRIES ===
  +
  +
Status commands are formed by inclusively ORing 0x80 with the relevant SET command.
  +
<pre>
  +
Example:
  +
0x88 (or 0x89 or 0x8A) ; request mouse mode
  +
Returns:
  +
0xF6 ; status response header
  +
mode ; 0x08 is RELATIVE
  +
; 0x09 is ABSOLUTE
  +
; 0x0A is KEYCODE
  +
param1 ; 0 is RELATIVE
  +
; XMSB maximum if ABSOLUTE
  +
; DELTA X is KEYCODE
  +
param2 ; 0 is RELATIVE
  +
; YMSB maximum if ABSOLUTE
  +
; DELTA Y is KEYCODE
  +
param3 ; 0 if RELATIVE
  +
; or KEYCODE
  +
; YMSB is ABSOLUTE
  +
param4 ; 0 if RELATIVE
  +
; or KEYCODE
  +
; YLSB is ABSOLUTE
  +
0 ; pad
  +
0
  +
</pre>
  +
The STATUS INQUIRY commands request the ikbd to return either the current mode or the parameters associated with a given command. All status reports are padded to form 8 byte long return packets. The responses to the status requests are designed so that the host may store them away (after stripping off the status report header byte) and later send them back as commands to IKBD to restore its state. The 0 pad bytes will be treated as NOPs by the IKBD.
   
  +
Valid STATUS INQUIRY commands are:
  +
<pre>
  +
0x87 mouse button action
  +
0x88 mouse mode
  +
0x89
  +
0x8A
  +
0x8B mnouse threshold
  +
0x8C mouse scale
  +
0x8F mouse vertical coordinates
  +
0x90 ( returns 0x0F Y=0 at bottom
  +
0x10 Y=0 at top )
  +
0x92 mouse enable/disable
  +
( returns 0x00 enabled)
  +
0x12 disabled )
  +
0x94 joystick mode
  +
0x95
  +
0x96
  +
0x9A joystick enable/disable
  +
( returns 0x00 enabled
  +
0x1A disabled )
  +
</pre>
  +
It is the (host) programmer's responsibility to have only one unanswered inquiry in process at a time.
  +
STATUS INQUIRY commands are not valid if the IKBD is in JOYSTICK MONITORING mode or FIRE BUTTON MONITORING mode.
   
   
  +
== SCAN CODES ==
   
  +
The key scan codes return by the IKBD are chosen to simplify the implementation of GSX.
   
  +
GSX Standard Keyboard Mapping.
 
  +
<pre>
 
  +
Hex Keytop
 
  +
01 Esc
 
  +
02 1
 
  +
03 2
9.4. FIXE LE MODE DE POSITIONNEMENT ABSOLU DE LA SOURIS
 
  +
04 3
 
  +
05 4
0x09
 
  +
06 5
Xsup position horizontale maximale (en unit‚s de
 
  +
07 6
Xinf d‚placement) cod‚e sur deux octets
 
  +
08 7
Ysup position verticale maximale (en unit‚s de
 
  +
09 8
Yinf d‚placement) cod‚e sur deux octets
 
  +
0A 9
 
  +
0B 0
 
  +
0C -
Les d‚placements de souris seront d‚crits en positionnement
 
  +
0D ==
absolu. Les coordonn‚es horizontale et verticale sont conserv‚es
 
  +
0E BS
au reset.
 
  +
0F TAB
 
  +
10 Q
Dans ce mode, les valeurs des coordonn‚es conserv‚es ne
 
  +
11 W
doivent pas sortir de l'intervalle 0 - grand nombre positif d‚fini
 
  +
12 E
par la commande. Un d‚placement jusqu'… une coordonn‚e n‚gative
 
  +
13 R
sera ignor‚. La commande fixe la valeur positive maximale qui peut
 
  +
14 T
ˆtre atteinte. Toute valeur sup‚rieure est ignor‚e.
 
  +
15 Y
 
  +
16 U
9.5. FIXE LA SOURIS EN MODE CLAVIER
 
  +
17 I
 
  +
18 O
0x0A
 
  +
19 P
Xdelta distance en unit‚s horizontales provoquant
 
  +
1A [
l'envoi du code {LEFT} ou du code {RIGHT}
 
  +
1B ]
Ydelta distance en unit‚s verticales provoquant
 
  +
1C RET
l'envoi du code {UP} ou du code {DOWN}
 
  +
1D CTRL
 
  +
1E A
 
  +
1F S
Place la souris en mode clavier … la place du mode position
 
  +
20 D
relative ou position absolue. AprŠs chaque d‚placement de souris
 
  +
21 F
exc‚dant le seuil horizontal ou vertical fix‚ par cette commande,
 
  +
22 G
le circuit clavier envoie l'‚quivalent d'un appui de touche
 
  +
23 H
curseur du clavier, puis le code de relƒchement de touche. A noter
 
  +
24 J
que cette commande n'est pas affect‚e par l'origine des
 
  +
25 K
d‚placements souris.
 
  +
26 L
 
  +
27 ;
9.6. FIXE LE SEUIL DE DEPLACEMENT SOURIS
 
  +
28 '
 
  +
29 `
0x0B
 
  +
2A (LEFT) SHIFT
Xseuil seuil horizontal en unit‚s de d‚placement
 
  +
2B \
Yseuil seuil vertical en unit‚s de d‚placement
 
  +
2C Z
 
  +
2D X
 
  +
2E C
Cette commande fixe le seuil … partir duquel un d‚placement
 
  +
2F V
de la souris sur l'axe horizontal ou vertical provoquera l'envoi
 
  +
30 B
par le circuit clavier d'un descripteur de position souris. On
 
  +
31 N
notera qu'elle n'affecte pas la r‚solution des donn‚es renvoy‚es
 
  +
32 M
au processeur. Cette commande est UNIQUEMENT valide en mode de
 
  +
33 ,
positionnement relatif de la souris. Les seuils horizontaux et
 
  +
34 .
verticaux sont fix‚s … 1 par d‚faut lors du RESET (ou … la mise
 
  +
35 /
sous tension).
 
  +
36 (RIGHT) SHIFT
NDT : Une unit‚ de d‚placement de la souris correspond
 
  +
37 { NOT USED }
environ … 0,2 mm, cela se traduit au bureau GEM par un d‚placement
 
  +
38 ALT
d'un pixel.
 
  +
39 SPACE BAR
 
  +
3A CAPS LOCK
9.7. FIXE L'ECHELLE DE LA SOURIS
 
  +
3B F1
 
  +
3C F2
0x0C
 
  +
3D F3
X‚chelle nombre d'unit‚s de d‚placement par X interne
 
  +
3E F4
Y‚chelle nombre d'unit‚s de d‚placement par Y interne
 
  +
3F F5
 
  +
40 F6
 
  +
41 F7
Cette commande d‚finit le facteur r‚ducteur … appliquer aux
 
  +
42 F8
d‚placements horizontaux et verticaux. Elle est valide UNIQUEMENT
 
  +
43 F9
en mode de positionnement absolu de la souris. Dans ce mode, un
 
  +
44 F10
nombre d‚termin‚ d'unit‚s de d‚placement horizontal ou vertical
 
  +
45 { NOT USED }
doit survenir pour qu'un d‚calage interne de une unit‚ soit
 
  +
46 { NOT USED }
enregistr‚e par le contr“leur clavier.
 
  +
47 HOME
 
  +
48 UP ARROW
Il est important de relever que cette commande ne fonctionne
 
  +
49 { NOT USED }
qu'en mode de positionnement absolu mˆme si l'on a command‚ au
 
  +
4A KEYPAD -
clavier de rendre compte des appuis ou des relƒchements de boutons
 
  +
4B LEFT ARROW
de la souris (voir commande 0x07, Ý9.2.).
 
  +
4C { NOT USED }
 
  +
4D RIGHT ARROW
 
  +
4E KEYPAD +
9.8. DEMANDE DE LA POSITION ABSOLUE DE LA SOURIS
 
  +
4F { NOT USED }
 
  +
50 DOWN ARROW
0x0D
 
  +
51 { NOT USED }
 
  +
52 INSERT
Cette commande renvoie :
 
  +
53 DEL
 
  +
54 { NOT USED }
OxF7 en-tˆte de descripteur de position absolue
 
  +
5F { NOT USED }
0000 xxxx
 
  +
60 ISO KEY
||||
 
  +
61 UNDO
||| ----- bouton droit press‚ depuis derniŠre demande
 
  +
62 HELP
|| ------ bouton droit relƒch‚ depuis derniŠre demande
 
  +
63 KEYPAD (
| ------- bouton gauche press‚ depuis derniŠre demande
 
  +
64 KEYPAD )
-------- bouton gauche relƒch‚ depuis derniŠre demande
 
  +
65 KEYPAD /
Xsup
 
  +
66 KEYPAD *
Xinf coordonn‚e horizontale sur deux octets
 
  +
67 KEYPAD 7
Ysup
 
  +
68 KEYPAD 8
Yinf coordonn‚e verticale sur deux octets
 
  +
69 KEYPAD 9
 
  +
6A KEYPAD 4
 
  +
6B KEYPAD 5
La commande de demande de la position absolue de la souris
 
  +
6C KEYPAD 6
est UNIQUEMENT valide en mode de positionnement absolu de la
 
  +
6D KEYPAD 1
souris, peu importe le mode de traitement des boutons fix‚ par une
 
  +
6E KEYPAD 2
commande 0x07 (voir Ý9.2.).
 
  +
6F KEYPAD 3
 
  +
70 KEYPAD 0
 
  +
71 KEYPAD .
 
  +
72 KEYPAD ENTER
 
 
 
 
 
 
 
9.9. DEFINIT LA POSITION DE LA SOURIS
 
 
0X0E
 
0X00 octet de remplissage
 
Xsup
 
Xinf position horizontale absolue de la souris
 
Ysup
 
Yinf position verticale absolue de la souris
 
 
 
Cette commande permet au programmeur de fixer la position
 
absolue de la souris, horizontale et verticale.
 
 
 
9.10. FIXE L'ORIGINE VERTICALE EN BAS
 
 
0x0F
 
 
 
Cette commande fixe l'origine de l'axe des ordonn‚es en bas
 
du systŠme de coordonn‚es logiques utilis‚ par le circuit clavier,
 
tant en mode de positionnement absolu que relatif. Dans ce mode,
 
le d‚placement de la souris vers l'utilisateur se traduit par un
 
d‚calage n‚gatif et un d‚placement dans le sens oppos‚ par un
 
d‚calage positif.
 
 
9.11. FIXE L'ORIGINE VERTICALE EN HAUT
 
 
0x10
 
 
 
Cette commande fixe l'origine de l'axe des ordonn‚es en haut
 
du systŠme de coordonn‚es logiques utilis‚ par le circuit clavier,
 
tant en mode de positionnement absolu que relatif. Dans ce mode,
 
le d‚placement de la souris vers l'utilisateur se traduit par un
 
d‚calage positif et un d‚placement dans le sens oppos‚ par un
 
d‚calage n‚gatif. Ce mode est le mode PAR DEFAUT au reset ou … la
 
mise sous tension du systŠme.
 
 
9.12. REPRISE
 
 
Reprend l'envoi des donn‚es du circuit clavier vers le
 
processeur. Etant donn‚ que toute commande re‡ue par le circuit
 
clavier alors qu'il se trouve en mode PAUSE constitue un ordre de
 
REPRISE implicite, cette commande peut ˆtre consid‚r‚e comme
 
inutile. Si le clavier n'est pas en mode PAUSE, cette commande est
 
tout bonnement ignor‚e.
 
 
 
 
 
 
 
 
9.13. DESACTIVATION DE LA SOURIS
 
 
0x12
 
 
 
Plus aucun compte-rendu d'‚v‚nement souris n'est envoy‚ par
 
le circuit clavier au processeur (et la scrutation peut ˆtre
 
inactive). Toute commande d'entr‚e dans un mode souris valide
 
provoque la reprise des envois de descripteurs de position souris.
 
(Les commandes d'entr‚e dans un mode valides sont : FIXE LE
 
POSITIONNEMENT RELATIF DE LA SOURIS, FIXE LE POSITIONNEMENT ABSOLU
 
DE LA SOURIS et FIXE LA SOURIS EN MODE CLAVIER).
 
 
N.B.: Si les boutons de la souris ont ‚t‚ d‚finis comme
 
devant ˆtre trait‚s comme des touches clavier, cette commande
 
les AFFECTE ‚galement (c'est-…-dire qu'ils deviennent inactifs).
 
 
9.14. PAUSE
 
 
0x13
 
 
Stoppe l'envoi de donn‚es du clavier vers le processeur
 
jusqu'… ce qu'une autre commande soit envoy‚e au clavier.
 
L'activit‚ du clavier est toujours scrut‚e et les codes de
 
scrutation de mˆme que les codes ASCII sont empil‚s (jusqu'au
 
maximum support‚ par le microcontr“leur, c'est-…-dire 8 octets)
 
afin d'ˆtre envoy‚s au processeur lorsque celui-ci demandera la
 
reprise des envois. Si l'on se trouve en mode EVENEMENT MANETTE DE
 
JEU, les ‚v‚nements manette sont ‚galement empil‚s.
 
 
Les actions sur la souris sont prises en compte tant que l'on
 
se trouve en mode PAUSE. Si le clavier est en mode POSITIONNEMENT
 
RELATIF de la souris, les ‚v‚nements souris sont cumul‚s en
 
fonction des seuils de d‚calage maxima, afin de produire le
 
minimum de blocs descripteurs possibles (les seuils de d‚calage
 
maxima s'‚tendent de -128 … +127 unit‚s de d‚placement). L'appui
 
ou le relƒchement d'un bouton de la souris amŠne tout ‚v‚nement
 
cumul‚ … ˆtre stock‚ dans un bloc descripteur, si l'on se trouve
 
en mode de POSITIONNEMENT RELATIF de la souris.
 
 
Etant donn‚ que le tampon de stockage d'‚v‚nements du circuit
 
clavier n'est que de 8 octets, il est recommand‚ d'user de ce mode
 
avec discernement, les communications entre le clavier et le
 
processeur ne devant pas ˆtre fig‚es plus de quelques
 
millisecondes si l'on ne d‚sire pas perdre d'‚v‚nement.
 
 
Les communications sont stopp‚es seulement aprŠs l'envoi en
 
cours, si un envoi est en cours. Le mode PAUSE ne d‚butera qu'une
 
fois le bloc descripteur compl‚tement envoy‚.
 
 
Lorsque le circuit clavier se trouve en mode SURVEILLANCE DE
 
MANETTE ou SURVEILLANCE DE BOUTON DE FEU, la commande PAUSE stoppe
 
‚galement ce mode de compte-rendu permanent, c'est-…-dire que les
 
‚v‚nements ne sont plus empil‚s pour transmission.
 
9.15. FIXE LE MODE EVENEMENT MANETTE DE JEU
 
 
0x14
 
 
 
Entre en mode compte-rendu d'‚v‚nement manette de jeu. Il
 
s'agit du mode PAR DEFAUT. Chaque ouverture ou fermeture de
 
contact d'une manette de jeu provoque l'envoi d'un descripteur
 
d'‚v‚nement manette de jeu.
 
 
9.16. FIXE LE MODE DEMANDE MANETTE DE JEU
 
 
0x15
 
 
 
D‚sactive le mode EVENEMENT MANETTE DE JEU. Le processeur
 
doit envoyer au circuit une commande de DEMANDE D'ETAT MANETTE DE
 
JEU pour connaŒtre l'‚tat d'une manette.
 
 
9.17. DEMANDE D'ETAT MANETTE DE JEU
 
 
0x16
 
 
 
Renvoie un enregistrement d‚crivant l'‚tat courant des
 
manettes de jeu. Cette commande est valide que l'on se trouve en
 
mode EVENEMENT MANETTE DE JEU ou en mode DEMANDE MANETTE DE JEU.
 
 
9.18. SURVEILLANCE MANETTE DE JEU
 
 
0x17
 
vitesse temps d'‚chantillonnage en centiŠmes de seconde
 
 
Blocs retourn‚s (blocs de 2 octets retourn‚s
 
aussi longtemps que l'on est dans ce mode) :
 
%0000 00xy
 
||
 
| --- Bouton de feu Manette 0
 
---- Bouton de feu Manette 1
 
%nnnn mmmm
 
|||| ||||
 
|||| ------ ‚tat de la Manette 0
 
----------- ‚tat de la Manette 1
 
 
 
Dans ce mode, le clavier intelligent ne fait que trois
 
choses: a) communiquer sur la ligne s‚rie, b) mettre … jour
 
l'horloge-calendrier, c) surveiller les manettes de jeu. Le taux
 
plac‚ en paramŠtre d‚finit la fr‚quence d'‚chantillonnage.
 
 
N.B. : Le programmeur ne peut pas fixer cette fr‚quence … un
 
taux sup‚rieur … ce que permet la vitesse de communication s‚rie
 
pour l'envoi de blocs de deux octets (NDT: la fr‚quence minimale
 
d'un centiŠme de seconde est admise par le circuit clavier!).
 
9.19. SURVEILLANCE DU BOUTON DE FEU
 
 
0x18
 
 
Valeur retourn‚e: (tant que l'on est dans ce mode)
 
%bbbb bbbb ‚tat du bouton de feu de la manette
 
1. (huit informations par octet, le
 
premier ‚chantillonnage ‚tant donn‚
 
dans le bit fort (bit 7))
 
 
 
Dans ce mode, le clavier intelligent ne fait que trois
 
choses: a) communiquer sur la ligne s‚rie, b) mettre … jour
 
l'horloge-calendrier, c) surveiller le bouton de feu de la
 
manette 1. Le bouton de feu est scrut‚ … une fr‚quence telle que 8
 
‚chantillonnages sont effectu‚s pour un octet envoy‚ (c'est-…-dire
 
que la vitesse de scrutation est de 8/10ø de la vitesse de
 
transmission [NDT: soit une vitesse de scrutation de 6340
 
interrogations par secondes]). L'intervalle d'‚chantillonnage
 
reste aussi constant que possible.
 
 
9.20. FIXE LA MANETTE DE JEU EN MODE CLAVIER
 
 
0x19
 
RX temps (en diziŠmes de seconde) n‚cessaire pour
 
produire un d‚calage horizontal
 
RY temps (en diziŠmes de seconde) n‚cessaire pour
 
produire un d‚calage vertical
 
TX temps (en diziŠmes de seconde) de fermeture du
 
contact avant relƒchement produisant un d‚calage
 
horizontal du curseur
 
TY temps (en diziŠmes de seconde) de fermeture du
 
contact avant relƒchement produisant un d‚calage
 
vertical du curseur
 
VX temps (en diziŠmes de seconde) de fermeture du
 
contact aprŠs relƒchement produisant un d‚calage
 
horizontal du curseur
 
VY temps (en diziŠmes de seconde) de fermeture du
 
contact aprŠs relƒchement produisant un d‚calage
 
vertical du curseur
 
 
 
Dans ce mode, la manette de jeu 0 est scrut‚e et trait‚e
 
comme s'il s'agissait des touches curseur. A la fermeture de
 
contact, un code d'appui et de relƒchement de touche curseur est
 
g‚n‚r‚. Puis aprŠs un d‚lai (RX ou RY selon le cas), ces codes
 
sont renvoy‚s selon une fr‚quence d‚finie par TX et TY. AprŠs
 
r‚ouverture de contact, des codes curseur sont g‚n‚r‚s selon une
 
fr‚quence d‚finie par VX et VY. Ceci autorise une gestion de la
 
manette avec auto-r‚p‚tition.
 
 
On notera qu'en pla‡ant RX et/ou RY … 0, il est possible de
 
d‚sactiver cette auto-r‚p‚tition. Les valeurs de TX et TY n'ont
 
plus de sens et la g‚n‚ration de codes s'effectue via VX et VY).
 
9.21. DESACTIVATION DES MANETTES DE JEU
 
 
0x1A
 
 
 
D‚sactive la g‚n‚ration d'‚v‚nements manettes de jeu (la
 
scrutation des manettes peut ˆtre d‚sactiv‚e). Toute entr‚e dans
 
un mode de fonctionnement manettes de jeu provoque la reprise des
 
compte-rendus d'‚v‚nements manette de jeu (les modes de
 
fonctionnement manette sont MODE EVENEMENT MANETTE DE JEU, MODE
 
DEMANDE MANETTE, SURVEILLANCE MANETTE DE JEU, SURVEILLANCE BOUTON
 
DE FEU ET MANETTES EN MODE CLAVIER).
 
 
9.22. MISE A JOUR DE L'HORLOGE-CALENDRIER
 
 
0x1B
 
AA ann‚e (deux derniers chiffres significatifs)
 
MM mois
 
JJ jour
 
hh heure
 
mm minute
 
ss seconde
 
 
 
Toutes les donn‚es concernant la date et l'heure doivent ˆtre
 
envoy‚es vers le clavier au format BCD (binaire cod‚ d‚cimal).
 
 
Tout chiffre qui ne rentre pas dans le format BCD ne sera pas
 
pris en compte et ne provoquera pas de modification du champ
 
correspondant de la date ou de l'heure. Cela permet de ne modifier
 
que quelques-unes des caract‚ristiques de la date ou de l'heure.
 
 
9.23. DEMANDE DE LA DATE ET DE L'HEURE
 
 
0x1C
 
Valeurs retourn‚es :
 
0xFC en-tˆte d'‚v‚nement date et heure
 
AA ann‚e (2 chiffres inf‚rieurs)
 
MM mois
 
JJ jour
 
hh heure
 
mm minute
 
ss seconde
 
 
 
Toutes les donn‚es relatives … la date et l'heure sont
 
retourn‚es au format BCD (binaire cod‚ d‚cimal).
 
 
 
 
 
 
 
 
9.24. CHARGEMENT DE DONNEES EN MEMOIRE
 
 
0x20
 
adr_sup adresse de la m‚moire vive du contr“leur
 
adr_inf o— charger les donn‚es
 
nombre nombre d'octets … charger (0 … 128)
 
{donn‚es}
 
 
 
Cette commande permet au processeur de placer des valeurs
 
arbitraires dans la m‚moire vive du contr“leur. L'intervalle de
 
temps s‚parant l'envoi de chaque donn‚e doit ˆtre d'au minimum 20
 
millisecondes.
 
 
9.25. LECTURE DE DONNEES EN MEMOIRE
 
 
0x21
 
adr_sup adresse de la m‚moire du contr“leur …
 
adr_inf partir de laquelle lire les donn‚es.
 
Valeurs retourn‚es :
 
0xF6 en-tˆte d'‚tat
 
0x20 code d'accŠs m‚moire
 
donn‚e 6 octets de donn‚es lus en
 
donn‚e m‚moire … partir de l'adresse
 
donn‚e envoy‚e en paramŠtre
 
donn‚e
 
donn‚e
 
donn‚e
 
 
 
Cette commande permet au processeur de lire le contenu des
 
m‚moires du contr“leur. Elle permet de lire aussi bien le contenu
 
de la m‚moire morte que de la m‚moire vive.
 
 
9.26. EXECUTION DE ROUTINE CONTROLEUR
 
 
0x22
 
adr_sup adresse de la routine en m‚moire morte du
 
adr_inf contr“leur que l'on d‚sire faire ex‚cuter.
 
 
 
Cette commande permet au processeur d'ordonner l'ex‚cution
 
d'un sous-programme r‚sident dans la m‚moire morte du contr“leur
 
clavier.
 
 
 
 
N.D.T.: Les fonctions 0x20 et 0x22 sont d'un usage p‚rilleux car
 
elles n‚cessitent une bonne connaissance de la topographie m‚moire
 
du 6301, contr“leur clavier. Des informations sur le contenu de
 
cette m‚moire et les registres de travail du 6301 peuvent ˆtre
 
obtenus dans l'ouvrage "Au coeur de l'Atari ST" (cf. bibliographie
 
en annexe).
 
 
9.27. DEMANDES D'ETAT
 
 
Les commandes de demande d'‚tat sont constitu‚es de l'octet
 
de commande de positionnement dans cet ‚tat avec le bit 7 plac‚ …
 
1 (OU logique avec 0x80). Exemple :
 
 
0x88 (ou 0x89 ou 0x8A) demande de mode souris
 
 
Valeurs retourn‚es :
 
0xF6 en-tˆte de r‚ponse d'‚tat
 
mode 0x08 si RELATIF
 
0x09 si ABSOLU
 
0x0A si CLAVIER
 
param1 0 si mode RELATIF
 
Xsup si mode ABSOLU
 
Xdelta si mode CLAVIER
 
param2 0 si mode RELATIF
 
Xinf si mode ABSOLU
 
Ydelta si mode CLAVIER
 
param3 0 si mode RELATIF
 
Ysup si mode ABSOLU
 
0 si mode CLAVIER
 
param4 0 si mode RELATIF
 
Yinf si mode ABSOLU
 
0 si mode CLAVIER
 
0 bourrage
 
0
 
 
 
Les commandes de DEMANDE D'ETAT interrogent le clavier sur le
 
mode courant ou les paramŠtres associ‚s … un mode donn‚. Tous les
 
compte-rendus d'‚tat sont format‚s dans des blocs de 8 octets. Les
 
r‚ponses … des demandes d'‚tat sont fournies de telle sorte
 
qu'elles puissent ˆtre stock‚es (aprŠs r‚ception de l'octet $F6
 
d'en-tˆte de r‚ponse ‚tat) et renvoy‚es par la suite sous forme de
 
commandes de positionnement d'‚tat par le processeur afin de
 
restaurer un ‚tat donn‚. Les octets nuls de remplissage seront
 
alors trait‚s comme des commandes inop‚rantes par le circuit
 
clavier.
 
 
 
 
N.D.T.: Pour traiter les r‚ponses … une demande d'‚tat, il est
 
n‚cessaire de d‚tourner le vecteur r‚ponse d'‚tat, dont on obtient
 
l'emplacement par Kbdvbase (Trap 14, fonction $22), en ajoutant $C
 
… l'adresse de retour de cette fonction (voir bios ‚tendu).
 
En pla‡ant sa propre routine dans ce vecteur, on re‡oit dans
 
A0 l'adresse de d‚part du bloc d'octets r‚ponse de la demande
 
d'‚tat et dans A1 l'adresse de fin plus un de cette r‚ponse.
 
D'une fa‡on g‚n‚rale, toutes les r‚ponses du clavier passent
 
par l'un des vecteurs point‚s indirectement par Kbdvbase et
 
n‚cessitent donc un traitement particulier par des routines
 
utilisateur.
 
 
Les commandes valides de DEMANDE D'ETAT sont les suivantes:
 
 
0x87 mode d'action des boutons de la souris
 
 
0x88 mode de positionnement de la souris
 
0x89 (plus pr‚cis‚ment mode de traitement des
 
0x8A d‚placements de la souris par le circuit clavier)
 
 
0x8B seuil de d‚calage de la souris
 
 
0x8C ‚chelle de d‚calage de la souris (en ABSOLU)
 
 
0x8F demande du type d'origine verticale de la souris
 
 
0x90 (renvoie 0x0F si en bas, 0x10 si en haut)
 
 
0x92 activit‚ de la souris (r‚ponse : 0x00 si active,
 
0x12 si inactive)
 
 
0x94 demande du mode manette de jeu
 
0x95
 
0x99
 
 
0x9A activit‚ des manettes de jeu (r‚ponse : 0x00 si
 
actives, 0x1A si d‚sactiv‚es)
 
 
 
Il est de la responsabilit‚ du programmeur de n'avoir qu'une
 
r‚ponse … une demande en mˆme temps (autrement dit, il faut
 
traiter la r‚ponse … une demande avant d'en faire une seconde, les
 
r‚ponses n'‚tant pas empil‚es).
 
 
Les commandes de DEMANDE D'ETAT ne sont pas prises en compte
 
si le clavier intelligent se trouve en mode SURVEILLANCE MANETTE
 
DE JEU ou en mode SURVEILLANCE BOUTON DE FEU.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10. Appendice A -- Codes de scrutation clavier
 
 
Les codes de scrutation clavier retourn‚ par le clavier ont
 
‚t‚ choisi afin de simplifier la mise en oeuvre du GEM.
 
 
N.D.T.: Le traducteur s'est permis de fournir les codes clavier
 
correspondant … la matrice de clavier fran‡aise en sus des codes
 
correspondant … la matrice de clavier anglaise.
 
 
Valeur hexa. Clavier anglais Clavier fran‡ais
 
00 (inutilis‚e) (inutilis‚e)
 
01 Esc Esc
 
02 1 1
 
03 2 2
 
04 3 3
 
05 4 4
 
06 5 5
 
07 6 6
 
08 7 7
 
09 8 8
 
0A 9 9
 
0B 0 0
 
0C - )
 
0D == -
 
0E Backspace Backspace
 
0F Tab Tab
 
10 Q A
 
11 W Z
 
12 E E
 
13 R R
 
14 T T
 
15 Y Y
 
16 U U
 
17 I I
 
18 O O
 
19 P P
 
1A [ [
 
1B ] ]
 
1C Return Return
 
1D Control Control
 
1E A Q
 
1F S S
 
20 D D
 
21 F F
 
22 G G
 
23 H H
 
24 J J
 
25 K K
 
26 L L
 
27 ; M
 
28 ' —
 
29 ` `
 
2A Shift (gauche) Shift (gauche)
 
2B \ \
 
2C Z W
 
2D X X
 
2E C C
 
2F V V
 
30 B B
 
31 N N
 
32 M ,
 
33 , ;
 
34 . :
 
35 / =
 
36 Shift (droit) Shift (droit)
 
37 (inutilis‚e) (inutilis‚e)
 
38 Alternate Alternate
 
39 Barre d'espacement Barre d'espacement
 
3A CapsLock CapsLock
 
3B F1 F1
 
3C F2 F2
 
3D F3 F3
 
3E F4 F4
 
3F F5 F5
 
40 F6 F6
 
41 F7 F7
 
42 F8 F8
 
43 F9 F9
 
44 F10 F10
 
45 (inutilis‚e) (inutilis‚e)
 
46 (inutilis‚e) (inutilis‚e)
 
47 Home Home
 
48 FlŠche vers le haut FlŠche vers le haut
 
49 (inutilis‚e) (inutilis‚e)
 
4A Pav‚ num‚rique - Pav‚ num‚rique -
 
4B FlŠche vers la gauche FlŠche vers la gauche
 
4C (inutilis‚e) (inutilis‚e)
 
4D FlŠche vers la droite FlŠche vers la droite
 
4E Pav‚ num‚rique + Pav‚ num‚rique +
 
4F (inutilis‚e) (inutilis‚e)
 
50 FlŠche vers le bas FlŠche vers le bas
 
51 (inutilis‚e) (inutilis‚e)
 
52 Insert Insert
 
53 Delete Delete
 
54 (inutilis‚e) (inutilis‚e)
 
55 (inutilis‚e) (inutilis‚e)
 
56 (inutilis‚e) (inutilis‚e)
 
57 (inutilis‚e) (inutilis‚e)
 
58 (inutilis‚e) (inutilis‚e)
 
59 (inutilis‚e) (inutilis‚e)
 
5A (inutilis‚e) (inutilis‚e)
 
5B (inutilis‚e) (inutilis‚e)
 
5C (inutilis‚e) (inutilis‚e)
 
5D (inutilis‚e) (inutilis‚e)
 
5E (inutilis‚e) (inutilis‚e)
 
5F (inutilis‚e) (inutilis‚e)
 
60 touche ISO (inutilis‚e) <
 
61 Undo Undo
 
62 Help Help
 
63 Pav‚ num‚rique ( Pav‚ num‚rique (
 
64 Pav‚ num‚rique ) Pav‚ num‚rique )
 
65 Pav‚ num‚rique / Pav‚ num‚rique /
 
66 Pav‚ num‚rique * Pav‚ num‚rique *
 
67 Pav‚ num‚rique 7 Pav‚ num‚rique 7
 
68 Pav‚ num‚rique 8 Pav‚ num‚rique 8
 
69 Pav‚ num‚rique 9 Pav‚ num‚rique 9
 
6A Pav‚ num‚rique 4 Pav‚ num‚rique 4
 
6B Pav‚ num‚rique 5 Pav‚ num‚rique 5
 
6C Pav‚ num‚rique 6 Pav‚ num‚rique 6
 
6D Pav‚ num‚rique 1 Pav‚ num‚rique 1
 
6E Pav‚ num‚rique 2 Pav‚ num‚rique 2
 
6F Pav‚ num‚rique 3 Pav‚ num‚rique 3
 
70 Pav‚ num‚rique 0 Pav‚ num‚rique 0
 
71 Pav‚ num‚rique . Pav‚ num‚rique .
 
72 Pav‚ num‚rique Enter Pav‚ num‚rique Enter
 
 
 
 
 
N.D.T. : Rappelons que les codes hexad‚cimaux 0x74 et 0x75 sont
 
utilis‚s par le contr“leur clavier pour la simulation des appuis
 
de boutons de feu des manettes de jeu.
 
 
</pre>
 
</pre>
Back to [[Programming]]
+
[[Category:Programming]]

Latest revision as of 22:18, 17 December 2023

Intelligent Keyboard (IKBD) Protocol


Introduction

The Atari Corp. Intelligent Keyboard (IKBD) is a general purpose keyboard controller that is flexible enough that it can be used in a variety of products without modification. The keyboard, with its microcontroller, provides a convenient connection point for a mouse and switch-type joysticks. The IKBD processor also maintains a time-of-day clock with one second resolution. The IKBD has been designed to be general enough that it can be used with a variety of new computer products. Product variations in a number of keyswitches, mouse resolution, etc. can be accommodated. The IKBD communicates with the main processor over a high speed bi-directional serial interface. It can function in a variety of modes to facilitate different applications of the keyboard, joysticks, or mouse. Limited use of the controller is possible in applications in which only a unidirectional communications medium is available by carefully designing the default modes.

Keyboard

The keyboard always returns key make/break scan codes. The IKBD generates keyboard scan codes for each key press and release. The key scan make (key closure) codes start at 1, and are defined in Appendix A. For example, the ISO key position in the scan code table should exist even if no keyswitch exists in that position on a particular keyboard. The break code for each key is obtained by ORing 0x80 with the make code.

The special codes 0xF6 through 0xFF are reserved for use as follows:

0xF6 status report
0xF7 absolute mouse position record
0xF8-0xFB relative mouse position records(lsbs determind by mouse button states)
0xFC time-of-day
0xFD joystick report (both sticks)
0xFE joystick 0 event
0xFF joystick 1 event

The two shift keys return different scan codes in this mode. The ENTER key and the RETURN key are also distinct.

Mouse

The mouse port should be capable of supporting a mouse with resolution of approximately 200 counts (phase changes or 'clicks') per inch of travel. The mouse should be scanned at a rate that will permit accurate tracking at velocities up to 10 inches per second. The IKBD can report mouse motion in three distinctly different ways. It can report relative motion, absolute motion in a coordinate system maintained within the IKBD, or by converting mouse motion into keyboard cursor control key equivalents. The mouse buttons can be treated as part of the mouse or as additional keyboard keys.

Relative Position Reporting

In relative position mode, the IKBD will return relative mouse position records whenever a mouse event occurs. A mouse event consists of a mouse button being pressed or released, or motion in either axis exceeding a settable threshold of motion. Regardless of the threshold, all bits of resolution are returned to the host computer. Note that the IKBD may return mouse relative position reports with significantly more than the threshold delta x or y. This may happen since no relative mouse motion events will be generated: (a) while the keyboard has been 'paused' ( the event will be stored until keyboard communications is resumed) (b) while any event is being transmitted.

The relative mouse position record is a three byte record of the form (regardless of keyboard mode):

    %111110xy  		; mouse position record flag
                        		; where y is the right button state
                        		; and x is the left button state
    X                   	; delta x as twos complement integer
    Y                   	; delta y as twos complement integer

Note that the value of the button state bits should be valid even if the MOUSE BUTTON ACTION has set the buttons to act like part of the keyboard. If the accumulated motion before the report packet is generated exceeds the +127...-128 range, the motion is broken into multiple packets. Note that the sign of the delta y reported is a function of the Y origin selected.

Absolute Position reporting

The IKBD can also maintain absolute mouse position. Commands exist for reseting the mouse position, setting X/Y scaling, and interrogating the current mouse position.

Mouse Cursor Key Mode

The IKBD can translate mouse motion into the equivalent cursor keystrokes. The number of mouse clicks per keystroke is independently programmable in each axis. The IKBD internally maintains mouse motion information to the highest resolution available, and merely generates a pair of cursor key events for each multiple of the scale factor. Mouse motion produces the cursor key make code immediately followed by the break code for the appropriate cursor key. The mouse buttons produce scan codes above those normally assigned for the largest envisioned keyboard (i.e. LEFT=0x74 & RIGHT=0x75).

Joystick

Joystick Event Reporting

In this mode, the IKBD generates a record whenever the joystick position is changed (i.e. for each opening or closing of a joystick switch or trigger).

The joystick event record is two bytes of the form:

    %1111111x           	; Joystick event marker
                        		; where x is Joystick 0 or 1
    %x000yyyy           	; where yyyy is the stick position
                        		; and x is the trigger

5.2 Joystick Interrogation

The current state of the joystick ports may be interrogated at any time in this mode by sending an 'Interrogate Joystick' command to the IKBD.

The IKBD response to joystick interrogation is a three byte report of the form

    0xFD                	; joystick report header
    %x000yyyy           	; Joystick 0
    %x000yyyy           	; Joystick 1
                        		; where x is the trigger
                        		; and yyy is the stick position

Joystick Monitoring

A mode is available that devotes nearly all of the keyboard communications time to reporting the state of the joystick ports at a user specifiable rate. It remains in this mode until reset or commanded into another mode. The PAUSE command in this mode not only stop the output but also temporarily stops scanning the joysticks (samples are not queued).

Fire Button Monitoring

A mode is provided to permit monitoring a single input bit at a high rate. In this mode the IKBD monitors the state of the Joystick 1 fire button at the maximum rate permitted by the serial communication channel. The data is packed 8 bits per byte for transmission to the host. The IKBD remains in this mode until reset or commanded into another mode. The PAUSE command in this mode not only stops the output but also temporarily stops scanning the button (samples are not queued).

Joystick Key Code Mode

The IKBD may be commanded to translate the use of either joystick into the equivalent cursor control keystroke(s). The IKBD provides a single breakpoint velocity joystick cursor. Joystick events produce the make code, immediately followed by the break code for the appropriate cursor motion keys. The trigger or fire buttons of the joysticks produce pseudo key scan codes above those used by the largest key matrix envisioned (i.e. JOYSTICK0=0x74, JOYSTICK1=0x75).

Time-of-Day Clock

The IKBD also maintains a time-of-day clock for the system. Commands are available to set and interrogate the timer-of-day clock. Time-keeping is maintained down to a resolution of one second.

Status Inquiries

The current state of IKBD modes and parameters may be found by sending status inquiry commands that correspond to the IKBD set commands.

Power-Up Mode

The keyboard controller will perform a simple self-test on power-up to detect major controller faults (ROM checksum and RAM test) and such things as stuck keys. Any keys down at power-up are presumed to be stuck, and their BREAK (sic) code is returned (which without the preceding MAKE code is a flag for a keyboard error). If the controller self-test completes without error, the code 0xF0 is returned. (This code will be used to indicate the version/release of the IKBD controller. The first release of the IKBD is version 0xF0, should there be a second release it will be 0xF1, and so on.) The IKBD defaults to a mouse position reporting with threshold of 1 unit in either axis and the Y=0 origin at the top of the screen, and joystick event reporting mode for joystick 1, with both buttons being logically assigned to the mouse. After any joystick command, the IKBD assumes that joysticks are connected to both Joystick0 and Joystick1. Any mouse command (except MOUSE DISABLE) then causes port 0 to again be scanned as if it were a mouse, and both buttons are logically connected to it. If a mouse disable command is received while port 0 is presumed to be a mouse, the button is logically assigned to Joystick1 ( until the mouse is re enabled by another mouse command).

IKBD Command Set

This section contains a list of commands that can be sent to the IKBD. Command codes (such as 0x00) which are not specified should perform no operation (NOPs).

RESET

   0x80
   0x01

N.B. The RESET command is the only two byte command understood by the IKBD. Any byte following an 0x80 command byte other than 0x01 is ignored (and causes the 0x80 to be ignored). A reset may also be caused by sending a break lasting at least 200mS to the IKBD. Executing the RESET command returns the keyboard to its default (power-up) mode and parameter settings. It does not affect the time-of-day clock. The RESET command or function causes the IKBD to perform a simple self-test. If the test is successful, the IKBD will send the code of 0xF0 within 300mS of receipt of the RESET command (or the end of the break, or power-up). The IKBD will then scan the key matrix for any stuck (closed) keys. Any keys found closed will cause the break scan code to be generated (the break code arriving without being preceded by the make code is a flag for a key matrix error).

SET MOUSE BUTTON ACTION

    0x07
    %00000mss           	; mouse button action
                        		;       (m is presumed = 1 when in MOUSE KEYCODE mode)
                        		; mss=0xy, mouse button press or release causes mouse
                        		;  position report
                        		;  where y=1, mouse key press causes absolute report
                        		;  and x=1, mouse key release causes absolute report
                        		; mss=100, mouse buttons act like keys 

This command sets how the IKBD should treat the buttons on the mouse. The default mouse button action mode is %00000000, the buttons are treated as part of the mouse logically. When buttons act like keys, LEFT=0x74 & RIGHT=0x75.

SET RELATIVE MOUSE POSITION REPORTING

   0x08

Set relative mouse position reporting. (DEFAULT) Mouse position packets are generated asynchronously by the IKBD whenever motion exceeds the setable threshold in either axis (see SET MOUSE THRESHOLD). Depending upon the mouse key mode, mouse position reports may also be generated when either mouse button is pressed or released. Otherwise the mouse buttons behave as if they were keyboard keys.

SET ABSOLUTE MOUSE POSITIONING

    0x09
    XMSB                ; X maximum (in scaled mouse clicks)
    XLSB
    YMSB                ; Y maximum (in scaled mouse clicks)
    YLSB

Set absolute mouse position maintenance. Resets the IKBD maintained X and Y coordinates. In this mode, the value of the internally maintained coordinates does NOT wrap between 0 and large positive numbers. Excess motion below 0 is ignored. The command sets the maximum positive value that can be attained in the scaled coordinate system. Motion beyond that value is also ignored.

SET MOUSE KEYCODE MOSE

    0x0A
    deltax              ; distance in X clicks to return (LEFT) or (RIGHT)
    deltay              ; distance in Y clicks to return (UP) or (DOWN)

Set mouse monitoring routines to return cursor motion keycodes instead of either RELATIVE or ABSOLUTE motion records. The IKBD returns the appropriate cursor keycode after mouse travel exceeding the user specified deltas in either axis. When the keyboard is in key scan code mode, mouse motion will cause the make code immediately followed by the break code. Note that this command is not affected by the mouse motion origin.

SET MOUSE THRESHOLD

    0x0B
    X                   ; x threshold in mouse ticks (positive integers)
    Y                   ; y threshold in mouse ticks (positive integers)

This command sets the threshold before a mouse event is generated. Note that it does NOT affect the resolution of the data returned to the host. This command is valid only in RELATIVE MOUSE POSITIONING mode. The thresholds default to 1 at RESET (or power-up).

SET MOUSE SCALE

    0x0C
    X                   ; horizontal mouse ticks per internel X
    Y                   ; vertical mouse ticks per internel Y

This command sets the scale factor for the ABSOLUTE MOUSE POSITIONING mode. In this mode, the specified number of mouse phase changes ('clicks') must occur before the internally maintained coordinate is changed by one (independently scaled for each axis). Remember that the mouse position information is available only by interrogating the IKBD in the ABSOLUTE MOUSE POSITIONING mode unless the IKBD has been commanded to report on button press or release (see SET MOSE BUTTON ACTION).

INTERROGATE MOUSE POSITION

	0x0D
    	Returns:
            			0xF7       	; absolute mouse position header
    	BUTTONS
            			0000dcba   	; where a is right button down since last interrogation
                       			       	; b is right button up since last
                       				; c is left button down since last
                       				; d is left button up since last
            			XMSB       	; X coordinate
            			XLSB
            			YMSB       	; Y coordinate
            			YLSB

The INTERROGATE MOUSE POSITION command is valid when in the ABSOLUTE MOUSE POSITIONING mode, regardless of the setting of the MOUSE BUTTON ACTION.

LOAD MOUSE POSITION

    0x0E
    0x00               	; filler
    XMSB                	; X coordinate
    XLSB                	; (in scaled coordinate system)
    YMSB                	; Y coordinate
    YLSB

This command allows the user to preset the internally maintained absolute mouse position.

SET Y=0 AT BOTTOM

   0x0F

This command makes the origin of the Y axis to be at the bottom of the logical coordinate system internel to the IKBD for all relative or absolute mouse motion. This causes mouse motion toward the user to be negative in sign and away from the user to be positive.

SET Y=0 AT TOP

   0x10

Makes the origin of the Y axis to be at the top of the logical coordinate system within the IKBD for all relative or absolute mouse motion. (DEFAULT) This causes mouse motion toward the user to be positive in sign and away from the user to be negative.

RESUME

   0x11

Resume sending data to the host. Since any command received by the IKBD after its output has been paused also causes an implicit RESUME this command can be thought of as a NO OPERATION command. If this command is received by the IKBD and it is not PAUSED, it is simply ignored.

DISABLE MOUSE

   0x12

All mouse event reporting is disabled (and scanning may be internally disabled). Any valid mouse mode command resumes mouse motion monitoring. (The valid mouse mode commands are SET RELATIVE MOUSE POSITION REPORTING, SET ABSOLUTE MOUSE POSITIONING, and SET MOUSE KEYCODE MODE. ) N.B. If the mouse buttons have been commanded to act like keyboard keys, this command DOES affect their actions.

PAUSE OUTPUT

   0x13

Stop sending data to the host until another valid command is received. Key matrix activity is still monitored and scan codes or ASCII characters enqueued (up to the maximum supported by the microcontroller) to be sent when the host allows the output to be resumed. If in the JOYSTICK EVENT REPORTING mode, joystick events are also queued. Mouse motion should be accumulated while the output is paused. If the IKBD is in RELATIVE MOUSE POSITIONING REPORTING mode, motion is accumulated beyond the normal threshold limits to produce the minimum number of packets necessary for transmission when output is resumed. Pressing or releasing either mouse button causes any accumulated motion to be immediately queued as packets, if the mouse is in RELATIVE MOUSE POSITION REPORTING mode. Because of the limitations of the microcontroller memory this command should be used sparingly, and the output should not be shut of for more than <tbd> milliseconds at a time. The output is stopped only at the end of the current 'even'. If the PAUSE OUTPUT command is received in the middle of a multiple byte report, the packet will still be transmitted to conclusion and then the PAUSE will take effect. When the IKBD is in either the JOYSTICK MONITORING mode or the FIRE BUTTON MONITORING mode, the PAUSE OUTPUT command also temporarily stops the monitoring process (i.e. the samples are not enqueued for transmission).

SET JOYSTICK EVENT REPORTING

   0x14

Enter JOYSTICK EVENT REPORTING mode (DEFAULT). Each opening or closure of a joystick switch or trigger causes a joystick event record to be generated.

SET JOYSTICK INTERROGATION MODE

   0x15

Disables JOYSTICK EVENT REPORTING. Host must send individual JOYSTICK INTERROGATE commands to sense joystick state.

JOYSTICK INTERROGATE

   0x16

Return a record indicating the current state of the joysticks. This command is valid in either the JOYSTICK EVENT REPORTING mode or the JOYSTICK INTERROGATION MODE.

SET JOYSTICK MONITORING

    0x17
    rate                ; time between samples in hundreths of a second
    Returns: (in packets of two as long as in mode)
            %000000xy   ; where y is JOYSTICK1 Fire button
                        ; and x is JOYSTICK0 Fire button
            %nnnnmmmm   ; where m is JOYSTICK1 state
                        ; and n is JOYSTICK0 state

Sets the IKBD to do nothing but monitor the serial command lne, maintain the time-of-day clock, and monitor the joystick. The rate sets the interval between joystick samples. N.B. The user should not set the rate higher than the serial communications channel will allow the 2 bytes packets to be transmitted.

SET FIRE BUTTON MONITORING

    0x18
    Returns: (as long as in mode)
            %bbbbbbbb   ; state of the JOYSTICK1 fire button packed
                        ; 8 bits per byte, the first sample if the MSB

Set the IKBD to do nothing but monitor the serial command line, maintain the time-of-day clock, and monitor the fire button on Joystick 1. The fire button is scanned at a rate that causes 8 samples to be made in the time it takes for the previous byte to be sent to the host (i.e. scan rate = 8/10 * baud rate). The sample interval should be as constant as possible.

SET JOYSTICK KEYCODE MODE

    0x19
    RX                  ; length of time (in tenths of seconds) until
                        ; horizontal velocity breakpoint is reached
    RY                  ; length of time (in tenths of seconds) until
                        ; vertical velocity breakpoint is reached
    TX                  ; length (in tenths of seconds) of joystick closure
                        ; until horizontal cursor key is generated before RX
                        ; has elapsed
    TY                  ; length (in tenths of seconds) of joystick closure
                        ; until vertical cursor key is generated before RY
                        ; has elapsed
    VX                  ; length (in tenths of seconds) of joystick closure
                        ; until horizontal cursor keystokes are generated
                        ; after RX has elapsed
    VY                  ; length (in tenths of seconds) of joystick closure
                        ; until vertical cursor keystokes are generated
                        ; after RY has elapsed

In this mode, joystick 0 is scanned in a way that simulates cursor keystrokes. On initial closure, a keystroke pair (make/break) is generated. Then up to Rn tenths of seconds later, keystroke pairs are generated every Tn tenths of seconds. After the Rn breakpoint is reached, keystroke pairs are generated every Vn tenths of seconds. This provides a velocity (auto-repeat) breakpoint feature. Note that by setting RX and/or Ry to zero, the velocity feature can be disabled. The values of TX and TY then become meaningless, and the generation of cursor 'keystrokes' is set by VX and VY.

DISABLE JOYSTICKS

   0x1A

Disable the generation of any joystick events (and scanning may be internally disabled). Any valid joystick mode command resumes joystick monitoring. (The joystick mode commands are SET JOYSTICK EVENT REPORTING, SET JOYSTICK INTERROGATION MODE, SET JOYSTICK MONITORING, SET FIRE BUTTON MONITORING, and SET JOYSTICK KEYCODE MODE.)

TIME-OF-DAY CLOCK SET

    0x1B
    YY                  ; year (2 least significant digits)
    MM                  ; month
    DD                  ; day
    hh                  ; hour
    mm                  ; minute
    ss                  ; second

All time-of-day data should be sent to the IKBD in packed BCD format. Any digit that is not a valid BCD digit should be treated as a 'don't care' and not alter that particular field of the date or time. This permits setting only some subfields of the time-of-day clock.

INTERROGATE TIME-OF-DAT CLOCK

    0x1C
    Returns:
            0xFC        ; time-of-day event header
            YY          ; year (2 least significant digits)
            MM          ; month
            DD          ; day
            hh          ; hour
            mm          ; minute
            ss          ; second
   All time-of-day is sent in packed BCD format.

MEMORY LOAD

    0x20
    ADRMSB              ; address in controller
    ADRLSB              ; memory to be loaded
    NUM                 ; number of bytes (0-128)
    { data }

This command permits the host to load arbitrary values into the IKBD controller memory. The time between data bytes must be less than 20ms.

MEMORY READ

    0x21
    ADRMSB              ; address in controller
    ADRLSB              ; memory to be read
    Returns:
            0xF6        ; status header
            0x20        ; memory access
            { data }    ; 6 data bytes starting at ADR

This command permits the host to read from the IKBD controller memory.

CONTROLLER EXECUTE

    0x22
    ADRMSB              ; address of subroutine in
    ADRLSB              ; controller memory to be called

This command allows the host to command the execution of a subroutine in the IKBD controller memory.

STATUS INQUIRIES

Status commands are formed by inclusively ORing 0x80 with the relevant SET command.

    Example:
    0x88 (or 0x89 or 0x8A)  ; request mouse mode
    Returns:
            0xF6        ; status response header
            mode        ; 0x08 is RELATIVE
                        ; 0x09 is ABSOLUTE
                        ; 0x0A is KEYCODE
            param1      ; 0 is RELATIVE
                        ; XMSB maximum if ABSOLUTE
                        ; DELTA X is KEYCODE
            param2      ; 0 is RELATIVE
                        ; YMSB maximum if ABSOLUTE
                        ; DELTA Y is KEYCODE
            param3      ; 0 if RELATIVE
                        ; or KEYCODE
                        ; YMSB is ABSOLUTE
            param4      ; 0 if RELATIVE
                        ; or KEYCODE
                        ; YLSB is ABSOLUTE
            0           ; pad
            0

The STATUS INQUIRY commands request the ikbd to return either the current mode or the parameters associated with a given command. All status reports are padded to form 8 byte long return packets. The responses to the status requests are designed so that the host may store them away (after stripping off the status report header byte) and later send them back as commands to IKBD to restore its state. The 0 pad bytes will be treated as NOPs by the IKBD.

Valid STATUS INQUIRY commands are:

            0x87    mouse button action
            0x88    mouse mode
            0x89
            0x8A
            0x8B    mnouse threshold
            0x8C    mouse scale
            0x8F    mouse vertical coordinates
            0x90    ( returns       0x0F Y=0 at bottom
                            0x10 Y=0 at top )
            0x92    mouse enable/disable
                    ( returns       0x00 enabled)
                            0x12 disabled )
            0x94    joystick mode
            0x95
            0x96
            0x9A    joystick enable/disable
                    ( returns       0x00 enabled
                            0x1A disabled )

It is the (host) programmer's responsibility to have only one unanswered inquiry in process at a time. STATUS INQUIRY commands are not valid if the IKBD is in JOYSTICK MONITORING mode or FIRE BUTTON MONITORING mode.


SCAN CODES

The key scan codes return by the IKBD are chosen to simplify the implementation of GSX.

GSX Standard Keyboard Mapping.

Hex	Keytop
01	Esc
02	1
03	2
04	3
05	4
06	5
07	6
08	7
09	8
0A	9
0B	0
0C	-
0D	==
0E	BS
0F	TAB
10	Q
11	W
12	E
13	R
14	T
15	Y
16	U
17	I
18	O
19	P
1A	[
1B	]
1C	RET
1D	CTRL
1E	A
1F	S
20	D
21	F
22	G
23	H
24	J
25	K
26	L
27	;
28	'
29	`
2A	(LEFT) SHIFT
2B	\
2C	Z
2D	X
2E	C
2F	V
30	B
31	N
32	M
33	,
34	.
35	/
36	(RIGHT) SHIFT
37	{ NOT USED }
38	ALT
39	SPACE BAR
3A	CAPS LOCK
3B	F1
3C	F2
3D	F3
3E	F4
3F	F5
40	F6
41	F7
42	F8
43	F9
44	F10
45	{ NOT USED }
46	{ NOT USED }
47	HOME
48	UP ARROW
49	{ NOT USED }
4A	KEYPAD -
4B	LEFT ARROW
4C	{ NOT USED }
4D	RIGHT ARROW
4E	KEYPAD +
4F	{ NOT USED }
50	DOWN ARROW
51	{ NOT USED }
52	INSERT
53	DEL
54	{ NOT USED }
5F	{ NOT USED }
60	ISO KEY
61	UNDO
62	HELP
63	KEYPAD (
64	KEYPAD )
65	KEYPAD /
66	KEYPAD *
67	KEYPAD 7
68	KEYPAD 8
69	KEYPAD 9
6A	KEYPAD 4
6B	KEYPAD 5
6C	KEYPAD 6
6D	KEYPAD 1
6E	KEYPAD 2
6F	KEYPAD 3
70	KEYPAD 0
71	KEYPAD .
72	KEYPAD ENTER