Keyboard Protocol: Difference between revisions

From AtariForumWiki
Jump to navigation Jump to search
>Zorro 2
No edit summary
 
>Zorro 2
No edit summary
Line 1: Line 1:
<pre>
<pre>
                        CLAVIER INTELLIGENT
Intelligent Keyboard (ikbd) Protocol
 
 
    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
 
    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
 
    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
 
    10. Appendice A : Codes de scrutation clavier
 
 
         
                  PROTOCOLE DU CLAVIER INTELLIGENT
                      (Mise … jour : 26/02/85)
 
 
 




1. Introduction
1. Introduction


    Le clavier intelligent (IKBD) d'Atari Corp. est un contr“leur
The Atari Corp. Intelligent Keyboard (ikbd) is a general purpose keyboard
clavier d'usage commun suffisamment flexible pour ˆtre utilis‚
controller that is flexible enough that it can be used in a variety of
avec un grand nombre de produits sans modifications. Le clavier,  
products without modification. The keyboard, with its microcontroller,
avec son contr“leur, fournit des points de connexion convenables
provides a convenient connection point for a mouse and switch-type joysticks.
pour une souris et des manettes de jeu. Le processeur clavier
The ikbd processor also maintains a time-of-day clock with one second
comporte ‚galement une horloge avec gestion de la date d'une
resolution.
pr‚cision d'une seconde.
The ikbd has been designed to be general enough that it can be used with a
ariety 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.


    Le clavier intelligent a ‚t‚ con‡u comme suffisamment g‚n‚ral
3. Keyboard
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.  


    Le clavier intelligent communique avec le processeur maÅ’tre
The keyboard always returns key make/break scan codes. The ikbd generates
par une liaison s‚rie bi-directionnelle … haute vitesse. Il peut
keyboard scan codes for each key press and release. The key scan make (key
fonctionner dans plusieurs modes afin de rendre possibles diverses
closure) codes start at 1, and are defined in Appendix A. For example, the
utilisations du clavier, des manettes de jeu ou de la souris. Un
ISO key position in the scan code table should exist even if no keyswitch
usage restreint du contr“leur est ‚galement autoris‚ pour des
exists in that position on a particular keyboard. The break code for each key
applications dans lesquelles un mode de communication
is obtained by ORing 0x80 with the make code.
unidirectionnel est utile, ceci par une gestion soigneuse des
modes par d‚faut.


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


2. Documents de r‚f‚rence
The two shift keys return different scan codes in this mode. The ENTER key
and the RETurn key are also distinct.
    Atari Corp. RBP/GHU/SD Keyboard Schematic (14/09/84)
    Atari Corp. RBP/GHU/SD Keyboard Layout (non pagin‚, non dat‚)


4. Mouse


3. Clavier
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.


    Le clavier retourne toujours les codes d'appui et de
4.1 Relative Position Reporting
relƒchement de touche, chaque fois qu'une touche est press‚e ou
relƒch‚e. Les codes d'appui de touche d‚butent … 1 et sont d‚finis
dans l'appendice A en fin de chapitre. A titre d'exemple, la
position de la touche ISO dans la table des codes de touches
press‚es existera mˆme si aucune touche ne correspond … cette
position sur un clavier particulier. Le code de relÆ’chement de
touche peut ˆtre obtenu en effectuant un OU logique entre 0x80 et
le code d'appui de la touche (bit 7 positionn‚ … 1).


    Les codes sp‚cifiques 0xF6 … 0xFF sont r‚serv‚s pour les
In relative position mode, the ikbd will return relative mouse position
fonctions suivantes :
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.


          OxF6        compte-rendu d'‚tat
The relative mouse position record is a three byte record of the form
          0xF7        position absolue de la souris
(regardless of keyboard mode):
           0xF8-0xFB    position relative de la souris
    %111110xy           ; mouse position record flag
                      (bit 0 … 1 si bouton droit appuy‚
                        ; where y is the right button state
                         bit 1 … 1 si bouton gauche appuy‚)
                         ; and x is the left button state
          0xFC        heure et date
    X                  ; delta x as twos complement integer
          0xFD        descripteur d'‚tat manettes de jeu
    Y                  ; delta y as twos complement integer
          0xFE        ‚v‚nement manette de jeu 0
          0xFF        ‚v‚nement manette de jeu 1


    Les deux touches 'Shift' retournent des codes d'appui
Note that the value of the button state bits should be valid even if the
diff‚rents. Il en va de mˆme pour les touches 'Enter' et 'Return'.
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.


4.2 Absolute Position reporting


4. Souris
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 port souris doit ˆtre capable de contr“ler une souris avec
4.3 Mouse Cursor Key Mode
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).


    Le clavier intelligent peut rendre compte des actions sur la
The ikbd can translate mouse motion into the equivalent cursor keystrokes.
souris selon trois modes distincts. Il peut rendre compte de la
The number of mouse clicks per keystroke is independently programmable in
position relative (… la pr‚c‚dente), de la position absolue de la
each axis. The ikbd internally maintains mouse motion information to the
souris dans un systŠme de coordonn‚es convenu, ou convertir les
highest resolution available, and merely generates a pair of cursor key events
d‚placements de la souris en codes clavier curseur ‚quivalents.
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).


    Les boutons de la souris peuvent ˆtre trait‚s comme partie
5. Joystick
int‚grante de la souris ou comme des touches de clavier
suppl‚mentaires.


4.1. Positionnement relatif
5.1 Joystick Event Reporting


    En mode positionnement relatif, le clavier retournera un
In this mode, the ikbd generates a record whever the joystick position is
descripteur de position de la souris lorsqu'un ‚v‚nement souris se
changed (i.e. for each opening or closing of a joystick switch or trigger).
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.


    On notera que le clavier intelligent peut retourner une
The joystick event record is two bytes of the form:
position relative de la souris avec un incr‚ment horizontal ou
    %1111111x          ; Joystick event marker
vertical significativement plus ‚lev‚ que le seuil. Cela arrivera
                        ; where x is Joystick 0 or 1
lorsqu'aucun compte-rendu de positionnement relatif de la souris
    %x000yyyy          ; where yyyy is the stick position
n'aura ‚t‚ renvoy‚ : a) parce que le clavier a ‚t‚ inhib‚ (les
                        ; and x is the trigger
‚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.


    Le descripteur de positionnement relatif de la souris est un
5.2 Joystick Interrogation
bloc constitu‚ de trois octets (peu importe le mode clavier):


          %1111 10xx          drapeau de positionnement relatif
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.
                  | ---------- ‚tat du bouton droit
                  ----------- ‚tat du bouton gauche
          deltaX              d‚calage horizontal sign‚
          deltaY              d‚calage vertical sign‚


    On notera que la valeur des bits d'‚tat des boutons doit ˆtre
The ikbd response to joystick interrogation is a three byte report of the form
valide mˆme si le MODE D'ACTIVATION SOURIS a ‚t‚ positionn‚ pour
    0xFD                ; joystick report header
que les boutons soient consid‚r‚s comme partie int‚grante du
    %x000yyyy          ; Joystick 0
clavier.
    %x000yyyy          ; Joystick 1
                        ; where x is the trigger
                        ; and yyy is the stick position


    Si le d‚calage cumul‚ des d‚placements horizontaux ou
5.3 Joystick Monitoring
verticaux de la souris d‚borde le domaine +127 … -128, le compte-
rendu de positionnement relatif est effectu‚ sur plusieurs blocs
descriptifs successifs.


    On notera que le signe du d‚calage vertical deltaY est
A mode is available that devotes nearly all of the keyboard communications
fonction de l'origine verticale choisie.
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).


4.2. Positionnement absolu
5.4 Fire Button Monitoring


    Le clavier intelligent a la possibilit‚ de rendre compte de
A mode is provided to permit monitoring a single input bit at a high rate. In
la position de la souris en coordonn‚es absolues. Des commandes
this mode the ikbd monitors the state of the Joystick 1 fire button at the
existent pour r‚initialiser la position de la souris, d‚finir les
maximum rate permitted by the serial communication channel. The data is packed
‚chelles horizontale et verticale, et demander la position
8 bits per byte for transmission to the host. The ikbd remains in this mode
courante de la souris.
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.3. Mode d‚placement curseur
5.5 Joystick Key Code Mode


    Le clavier intelligent peut convertir les actions sur la
The ikbd may be commanded to translate the use of either joystick into the
souris en ‚quivalences clavier. Le nombre d'appuis de touche
equivalent cursor control keystroke(s). The ikbd provides a single breakpoint
correspondant … une action peut ˆtre sp‚cifi‚ diff‚remment pour
velocity joystick cursor.
chaque axe. Le clavier intelligent fournit des informations sur
Joystick events produce the make code, immediately followed by the break code
les actions souris selon la plus haute r‚solution valable et
for the appropriate cursor motion keys. The trigger or fire buttons of the
g‚nŠre simplement une paire d'‚v‚nements appui de touche pour
joysticks produce pseudo key scan codes above those used by the largest key
chaque multiple du facteur d'‚chelle.
matrix envisioned (i.e. JOYSTICK0=0x74, JOYSTICK1=0x75).


    Ce mode de fonctionnement provoque l'envoi du code de
6. Time-of-Day Clock
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).


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.


5. Manettes de jeu
7. Status Inquiries


5.1. Compte-rendu d'‚v‚nement manette de jeu
The current state of ikbd modes and parameters may be found by sending status
inquiry commands that correspond to the ikbd set commands.


    Dans ce mode, le clavier intelligent g‚nÅ re un bloc
8. Power-Up Mode
descripteur chaque fois que la position de la manette de jeu a
chang‚e (c'est-…-dire pour chaque ouverture ou fermeture d'un
interrupteur ou contact de la manette de jeu).
    Le bloc descripteur d'un ‚v‚nement manette de jeu est
constitu‚ de deux octets:


          %1111 111x          d‚signe un ‚v‚nement manette de jeu
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
                    --------- manette de jeu 0 ou 1
keys. Any keys down at power-up are presumed to be stuck, and their BREAK
          %x000 yyyy
(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
          |    ------------ position de la manette
0xF0 is returned. (This code will be used to indicate the version/rlease of
            ----------------- ‚tat du bouton de feu
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 diable command is
received while port 0 is presumed to be a mouse, the button is logically
assigned to Joystick1 ( until the mouse is reenabled by another mouse command).


5.2. Interrogation de manette de jeu
9. ikbd Command Set


    L'‚tat courant des ports manette de jeu peut ˆtre interrog‚ …
This section contains a list of commands that can be sent to the ikbd. Command
n'importe quel moment dans ce mode en envoyant une commande
codes (such as 0x00) which are not specified should perform no operation
d'"interrogation manette de jeu" vers le circuit clavier.
(NOPs).


    La r‚ponse du clavier intelligent … cette interrogation prend
9.1 RESET
la forme d'un bloc de trois octets ayant le sens suivant :


          0xFD                en-tˆte de r‚ponse manette de jeu
    0x80
          %x000 yyyy          manette de jeu 0
    0x01
          %x000 yyyy          manette de jeu 1


    o— x correspond … l'‚tat du bouton de feu et yyyy … la
N.B. The RESET command is the only two byte command understood by the ikbd.
position de la manette.
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).


5.3. Surveillance manette de jeu
9.2. SET MOUSE BUTTON ACTION


    Ce mode permet de consacrer presque toute l'activit‚ du
    0x07
circuit clavier au compte-rendu des ‚tats successifs des manettes
    %00000mss          ; mouse button action
de jeu selon une cadence d‚finie par l'utilisateur. Le clavier
                        ;      (m is presumed = 1 when in MOUSE KEYCODE mode)
reste dans ce mode jusqu'… une commande de reset ou une commande
                        ; mss=0xy, mouse button press or release causes mouse
le placant dans un autre mode. Dans ce mode, la commande PAUSE ne
                        ;  position report
stoppe pas seulement les communications entre le clavier et le
                        ;  where y=1, mouse key press causes absolute report
processeur mais ‚galement la scrutation des manettes de jeu (les
                        ;  and x=1, mouse key release causes absolute report
informations ne sont pas empil‚es).
                        ; mss=100, mouse buttons act like keys


5.4. Surveillance Bouton de feu
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.


    Ce mode permet de d‚dier le circuit clavier au seul contr“le
9.3 SET RELATIVE MOUSE POSITION REPORTING
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).


5.5. Mode Clavier des manettes de jeu
    0x08


    Le circuit clavier peut ˆtre command‚ pour que les actions
Set relative mouse position reporting. (DEFAULT) Mouse position packets are
sur les manettes de jeu soient converties en ‚quivalents clavier
generated asynchronously by the ikbd whenever motion exceeds the setable
(touches curseur).
threshold in either axis (see SET MOUSE THRESHOLD). Depending upon the mouse
   
key mode, mouse position reports may also be generated when either mouse
    Les ‚v‚nements manette de jeu produisent un code d'appui de
button is pressed or released. Otherwise the mouse buttons behave as if they
touche imm‚diatement suivi d'un code de relƒchement, de la mˆme
were keyboard keys.
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).


9.4 SET ABSOLUTE MOUSE POSITIONING


6. Horloge calendrier
    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.


    Le clavier intelligent contr“le ‚galement une horloge
9.5 SET MOUSE KEYCODE MOSE
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.


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


7. Demandes d'‚tat
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.


    L'‚tat courant du clavier, les modes actifs et les paramÅ tres
9..6 SET MOUSE THRESHOLD
peuvent ˆtre obtenus par des commandes de demande d'‚tat
correspondant … des commandes du clavier intelligent.


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


8. Mise sous tension
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).


    Le contr“leur clavier effectue un auto-test simple … la mise
9.7 SET MOUSE SCALE
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.)


    Les options par d‚faut du clavier sont les suivantes :
    0x0C
1) Compte-rendu du  positionnement de la souris en mode relatif
    X                  ; horizontal mouse ticks per internel X
avec un incr‚ment d'une unit‚ pour chaque axe.
    Y                  ; vertical mouse ticks per internel Y
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.


    AprÅ s toute commande manette de jeu, le circuit clavier
This command sets the scale factor for the ABSOLUTE MOUSE POSITIONING mode.
considŠre que les manettes de jeu sont connect‚es aux ports 0 et 1
In this mode, the specified number of mouse phase changes ('clicks') must
des manettes de jeu. Toute commande souris (sauf la DESACTIVATION
occur before the internally maintained coordinate is changed by one
DE SOURIS) entraŒne la scrutation du port 0 comme ‚tant le port
(independently scaled for each axis). Remember that the mouse position
reli‚ … la souris et les deux boutons d‚pendant de celle-ci. Si
information is available only by interrogating the ikbd in the ABSOLUTE MOUSE
une commande de d‚sactivation de la souris est re‡ue alors que le
POSITIONING mode unless the ikbd has been commanded to report on button press
port 0 est logiquement li‚ … une souris, le bouton est alors
or release (see SET MOSE BUTTON ACTION).
assign‚ … la manette 1.


9. Jeu des commandes clavier
9.8 INTERROGATE MOUSE POSITION


    Cette partie comprend la liste des commandes qui peuvent ˆtre
    0x0D
envoy‚es au clavier intelligent. Les codes de commande (comme
    Returns:
0x00) qui ne sont pas d‚velopp‚s ici ne provoquent aucune
            0xF7      ; absolute mouse position header
op‚ration (ils peuvent ˆtre assimil‚s … des NOP).
    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


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


    Ox80
9.9 LOAD MOUSE POSITION
    0x01


    REMARQUE: La commande RESET est la seule commande clavier qui
    0x0E
comprenne deux octets en dehors des paramÅ tres. Tout octet suivant
    0x00                ; filler
0x80, autre que 0x01, sera ignor‚ (et provoquera la non prise en
    XMSB                ; X coordinate
compte de la commande 0x80).
    XLSB                ; (in scaled coordinate system)
    YMSB                ; Y coordinate
    YLSB


    Un reset du circuit clavier peut ‚galement ˆtre provoqu‚ en
This command allows the user to preset the internally maintained absolute
envoyant un break durant au moins 200ms vers le circuit clavier.
mouse position.


    L'envoi d'une commande reset amÅ ne la remise des paramÅ tres
9.10 SET Y=0 AT BOTTOM
clavier … leurs valeurs par d‚faut (voir 8. Mise sous tension). Il
n'affecte pas l'horloge calendrier.


    Une commande de RESET provoque l'auto-test du circuit
     0x0F
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
This command makes the origin of the Y axis to be at the bottom of the
    %0000 0mss          mode de prise en compte
logical coordinate system internel to the ikbd for all relative or absolute
            |||          (m est suppos‚ … 1 en mode code CLAVIER
mouse motion. This causes mouse motion toward the user to be negative in sign
            |||            de la souris)
and away from the user to be positive.
            ------------ 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.


9.11 SET Y=0 AT TOP


    Cette commande d‚finit la fa‡on d'agir des boutons de la
    0x10
souris, plus pr‚cis‚ment la fa‡on dont ils seront pris en compte.
Le mode de traitement par d‚faut des boutons de la souris est
%00000000, c'est-…-dire que les boutons sont consid‚r‚s comme
partie int‚grante de la souris.


9.3. FIXE LE MODE DE POSITIONNEMENT RELATIF DE LA SOURIS
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.


    0x08
9.12 RESUME


    0x11


    Place la souris en mode relatif (mode PAR DEFAUT), c'est …
Resume sending data to the host. Since any command received by the ikbd after
dire que chaque d‚placement de la souris provoque l'envoi d'un
its output has been paused also causes an implicit RESUME this command can be
descripteur comprenant les d‚calages horizontaux et verticaux
thought of as a NO OPERATION command. If this command is received by the ikbd
relatifs … la pr‚c‚dente position. Les blocs descripteurs de
and it is not PAUSED, it is simply ignored.
positionnement sont g‚n‚r‚s de fa‡on asynchrone par le clavier
intelligent lorsqu'un d‚placement selon l'un des axes d‚passe le
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.


9.13 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.


9.14 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).


0.15 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.


9.16 SET JOYSTICK INTERROGATION MODE


9.4. FIXE LE MODE DE POSITIONNEMENT ABSOLU DE LA SOURIS
    0x15


    0x09
Disables JOYSTICK EVENT REPORTING. Host must send individual JOYSTICK
    Xsup      position horizontale maximale (en unit‚s de
INTERROGATE commands to sense joystick state.
    Xinf      d‚placement) cod‚e sur deux octets
    Ysup      position verticale maximale (en unit‚s de
    Yinf      d‚placement) cod‚e sur deux octets


9.17 JOYSTICK INTERROGATE


    Les d‚placements de souris seront d‚crits en positionnement
    0x16
absolu. Les coordonn‚es horizontale et verticale sont conserv‚es
au reset.


    Dans ce mode, les valeurs des coordonn‚es conserv‚es ne
Return a record indicating the current state of the joysticks. This command
doivent pas sortir de l'intervalle 0 - grand nombre positif d‚fini
is valid in either the JOYSTICK EVENT REPORTING mode or the JOYSTICK
par la commande. Un d‚placement jusqu'… une coordonn‚e n‚gative
INTERROGATION MODE.
sera ignor‚. La commande fixe la valeur positive maximale qui peut
ˆtre atteinte. Toute valeur sup‚rieure est ignor‚e.


9.5. FIXE LA SOURIS EN MODE CLAVIER
9.18 SET JOYSTICK MONITORING


    0x0A
    0x17
    Xdelta        distance en unit‚s horizontales provoquant
    rate                ; time between samples in hundreths of a second
                    l'envoi du code {LEFT} ou du code {RIGHT}
    Returns: (in packets of two as long as in mode)
    Ydelta        distance en unit‚s verticales provoquant
            %000000xy  ; where y is JOYSTICK1 Fire button
                    l'envoi du code {UP} ou du code {DOWN}
                        ; 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.


    Place la souris en mode clavier … la place du mode position
9.19 SET FIRE BUTTON MONITORING
relative ou position absolue. AprŠs chaque d‚placement de souris
exc‚dant le seuil horizontal ou vertical fix‚ par cette commande,
le circuit clavier envoie l'‚quivalent d'un appui de touche
curseur du clavier, puis le code de relÆ’chement de touche. A noter
que cette commande n'est pas affect‚e par l'origine des
d‚placements souris.


9.6. FIXE LE SEUIL DE DEPLACEMENT SOURIS
    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


    0x0B
Set the ikbd to do nothing but monitor the serial command line, maintain the
    Xseuil    seuil horizontal en unit‚s de d‚placement
time-of-day clock, and monitor the fire button on Joystick 1. The fire button
    Yseuil    seuil vertical en unit‚s de d‚placement
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.


9.20 SET JOYSTICK KEYCODE MODE


    Cette commande fixe le seuil … partir duquel un d‚placement
    0x19
de la souris sur l'axe horizontal ou vertical provoquera l'envoi
    RX                  ; length of time (in tenths of seconds) until
par le circuit clavier d'un descripteur de position souris. On
                        ; horizontal velocity breakpoint is reached
notera qu'elle n'affecte pas la r‚solution des donn‚es renvoy‚es
    RY                  ; length of time (in tenths of seconds) until
au processeur. Cette commande est UNIQUEMENT valide en mode de
                        ; vertical velocity breakpoint is reached
positionnement relatif de la souris. Les seuils horizontaux et
    TX                  ; length (in tenths of seconds) of joystick closure
verticaux sont fix‚s … 1 par d‚faut lors du RESET (ou … la mise
                        ; until horizontal cursor key is generated before RX
sous tension).
                        ; has elapsed
    NDT : Une unit‚ de d‚placement de la souris correspond
    TY                  ; length (in tenths of seconds) of joystick closure
environ … 0,2 mm, cela se traduit au bureau GEM par un d‚placement
                        ; until vertical cursor key is generated before RY
d'un pixel.
                        ; 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


9.7. FIXE L'ECHELLE DE LA SOURIS
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.


    0x0C
9.21 DISABLE JOYSTICKS
    X‚chelle      nombre d'unit‚s de d‚placement par X interne
    Y‚chelle      nombre d'unit‚s de d‚placement par Y interne


    0x1A


    Cette commande d‚finit le facteur r‚ducteur … appliquer aux
Disable the generation of any joystick events (and scanning may be internally
d‚placements horizontaux et verticaux. Elle est valide UNIQUEMENT
disabled). Any valid joystick mode command resumes joystick monitoring. (The
en mode de positionnement absolu de la souris. Dans ce mode, un
joystick mode commands are SET JOYSTICK EVENT REPORTING, SET JOYSTICK
nombre d‚termin‚ d'unit‚s de d‚placement horizontal ou vertical
INTERROGATION MODE, SET JOYSTICK MONITORING, SET FIRE BUTTON MONITORING, and
doit survenir pour qu'un d‚calage interne de une unit‚ soit
SET JOYSTICK KEYCODE MODE.)
enregistr‚e par le contr“leur clavier.  


    Il est important de relever que cette commande ne fonctionne
9.22 TIME-OF-DAY CLOCK SET
qu'en mode de positionnement absolu mˆme si l'on a command‚ au
clavier de rendre compte des appuis ou des relÆ’chements de boutons
de la souris (voir commande 0x07, Ý9.2.).


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


9.8. DEMANDE DE LA POSITION ABSOLUE DE LA SOURIS
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.


    0x0D
9.23 INTERROGATE TIME-OF-DAT CLOCK


    Cette commande renvoie :
    0x1C
    Returns:
            0xFC        ; time-of-day event header
            YY          ; year (2 least significant digits)
            MM          ; month
            DD          ; day
            hh          ; hour
            mm          ; minute
            ss          ; second


    OxF7          en-tˆte de descripteur de position absolue
    All time-of-day is sent in packed BCD format.
    0000 xxxx
          ||||
          ||| ----- bouton droit press‚ depuis derniÅ re demande
          || ------ bouton droit relÆ’ch‚ depuis derniÅ re demande
          | ------- bouton gauche press‚ depuis derniÅ re demande
          -------- bouton gauche relÆ’ch‚ depuis derniÅ re demande
    Xsup
    Xinf          coordonn‚e horizontale sur deux octets
    Ysup
    Yinf          coordonn‚e verticale sur deux octets


9.24 MEMORY LOAD


    La commande de demande de la position absolue de la souris
    0x20
est UNIQUEMENT valide en mode de positionnement absolu de la
    ADRMSB              ; address in controller
souris, peu importe le mode de traitement des boutons fix‚ par une
    ADRLSB              ; memory to be loaded
commande 0x07 (voir Ý9.2.).
    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.


9.25 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 comand permits the host to read from the ikbd controller memory.


9.26 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.


9.27 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


9.9. DEFINIT LA POSITION DE LA SOURIS
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
    0X0E
padded to form 8 byte long return packets. The responses to the status
    0X00      octet de remplissage
requests are designed so that the host may store them away (after stripping
    Xsup
off the status report header byte) and later send them back as commands to
    Xinf      position horizontale absolue de la souris
ikbd to restore its state. The 0 pad bytes will be treated as NOPs by the
    Ysup
ikbd.
    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.
 
 
 


    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.




10. SCAN CODES


The key scan codes return by the ikbd are chosen to simplify the
implementaion 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
</pre>


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>
Back to [[Programming]]
Back to [[Programming]]

Revision as of 05:21, 13 September 2006

Intelligent Keyboard (ikbd) Protocol


1. 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
ariety 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.

3. 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.

4. 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.

4.1 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.

4.2 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.

4.3 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).

5. Joystick

5.1 Joystick Event Reporting

In this mode, the ikbd generates a record whever 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

5.3 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).

5.4 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).

5.5 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).

6. 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.

7. 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.

8. 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/rlease 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 diable command is
received while port 0 is presumed to be a mouse, the button is logically
assigned to Joystick1 ( until the mouse is reenabled by another mouse command).

9. 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).

9.1 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).

9.2. 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.

9.3 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.

9.4 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.

9.5 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.

9..6 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).

9.7 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).

9.8 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.

9.9 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.

9.10 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.

9.11 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.

9.12 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.

9.13 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.

9.14 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).

0.15 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.

9.16 SET JOYSTICK INTERROGATION MODE

    0x15

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

9.17 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.

9.18 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.

9.19 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.

9.20 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.

9.21 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.)

9.22 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.

9.23 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.

9.24 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.

9.25 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 comand permits the host to read from the ikbd controller memory.

9.26 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.

9.27 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.


10. SCAN CODES

The key scan codes return by the ikbd are chosen to simplify the
implementaion 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

Back to Programming