BM6809.TXT

Beschreibung zum CALM Assembler fr M6809

Gewhlte Adressierung
   In allen Befehlen (MOVE, JUMP, ...), die die direkte Adressierung mit dem
Speicher verwenden, wird automatisch die relative Adressierung vom CALM
Assembler gewhlt. Dies erzeugt automatisch einen adressenunabhngigen
Maschinencode. Die absolute Adressierung muss mit einem entsprechenden
Prfix (z.B. 16^) gefordert werden.

Automatische Optimisierung des Befehlscodes
   Die Codeoptimisierungsmglichkeiten sind sehr zahlreich. Einerseits
betreffen sie die relative Adressierung (die ja automatisch gewhlt
wird):

    JUMP    R8^Adresse      [ 2 Bytes ]
    JUMP    R16^Adresse     [ 3 Bytes ]
    JUMP,b  R8^Adresse      [ 2 Bytes ]
    JUMP,b  R16^Adresse     [ 4 Bytes ]
    MOVE    R8^Adresse,A    [ 3 Bytes ]
    MOVE    R16^Adresse,A   [ 4 Bytes ]

Andererseits sind verschiedene Abstnde bei der indirekten Adressierung
mglich:

    MOVE    {IX}+A5^Abstand [ 2 Bytes ]
    MOVE    {IX}+A8^Abstand [ 3 Bytes ]
    MOVE    {IX}+16^Abstand [ 4 Bytes ]

   In beiden Fllen kann der CALM Assembler den krzesten Befehlscode
generieren, wenn die Adresse (der Abstand) bekannt ist und innerhalb der
festgelegten Grenzen liegt. Die Prfixe sind nicht notwendig, knnen
aber dem CALM Assembler helfen, den kompaktesten Code zu erzeugen.

Bemerkungen
   Indirekte Adressierungen mit dem Register P (Motorola: DP) mssen
explizit   {P}*256+Wert   oder   [P]+Wert   geschrieben werden.
   Die Schreibweise folgender Befehle unterscheidet sich nicht:

    MOVE    #Adresse,IX
    MOVE    #Wert,IX

Die resultierende Operation ist jedoch verschieden. Da der CALM Assembler
dauernd die relative Adressierung annimmt, muss man im zweiten Fall
die Adressenangabe I^ (immediate, unmittelbar) verwenden:

    MOVE    #I^Wert,IX

Diese Zweideutigkeit ergibt sich nur beim Operationscode MOVE (bei Motorola
heissen die entsprechenden Operationscodes LEA und LD).

   Das Modul M6809 kann mit dem Befehl   .PROCSET Wahl   auf verschiedene
Betriebsarten eingestellt werden. Voreingestellt ist: .PROCSET DEFREL,ABS_ONLY.

   DEFREL   alles wird relatif adressiert, falls keine Adressenangabe (Vorgabe).
   DEFABS   bis auf JUMP,cc wird alles absolut adressiert. I^ ist nicht mehr
            notwendig.
   ABS_ONLY Adresse = 16^Adresse (nur mit DEFABS, Vorgabe).
   ABS_OR_P0 falls Adresse in 0..255 und vorher definiert ist, dann wird
            [P]+Adresse (Assembler nimmt an, dass P=0 ist) erzeugt,
            sonst 16^Adresse (nur mit DEFABS).

Unterschiede zum Herstellerassembler
   Die unterschiedlichen Bezeichnungen der Operationscodes sind in den
Befehlslisten angegeben.
   Schreibweise        CALM                   Motorola
   der                 #Wert                  #Wert
   Adressierung:       Adresse                Adresse
                       {Register}             ,Register
                       {Register}+Abstand     Abstand,Register
                       {Ri+1+}                ,Ri+
                       {-1-Ri}                ,-Ri
                       {Ri+2+}                ,Ri++
                       {-2-Ri}                ,--Ri
                       {Ri}+{Rj}              Rj,Ri
                       {{Ri}}                 [,Ri]
                       {Adresse}              [Adresse]
                       R^Adresse              Adresse,PCR
                       A|B|IX                 A,B,IX

   Pseudobefehle:      .ASCII                 FCC
                       .BLK.8                 RMB
                       .END                   END
                       .LOC                   ORG
                       .8, .16                FCB, FDB

Description du M6809 pour l'assembleur CALM

Adressage choisi
   Pour toutes les instructions (MOVE, JUMP, ...) qui utilisent l'adressage
direct avec la mmoire, l'assembleur CALM choisit automatiquement
l'adressage relatif. Ceci gnre automatiquement un code machine
indpendant de l'adresse. Il faut forcer l'adressage absolu par un
prfixe correspondant (p.ex. 16^).

Optimisation automatique des codes machine
   Les possibilits d'optimisation sont trs nombreuses. Premirement,
il y a l'adressage relatif (qui est choisi automatiquement):

    JUMP    R8^adresse      [ 2 octets ]
    JUMP    R16^adresse     [ 3 octets ]
    JUMP,b  R8^adresse      [ 2 octets ]
    JUMP,b  R16^adresse     [ 4 octets ]
    MOVE    R8^adresse,A    [ 3 octets ]
    MOVE    R16^adresse,A   [ 4 octets ]

Deuximement, diffrents dplacements sont possibles avec l'adressage
indirect:

    MOVE    {IX}+A5^dpl    [ 2 octets ]
    MOVE    {IX}+A8^dpl    [ 3 octets ]
    MOVE    {IX}+16^dpl    [ 4 octets ]

   L'assembleur peut gnrer dans les deux cas le code machine le plus
court si l'adresse (le dplacement) est connue et est  l'intrieur
des limites fixes. Les prfixes ne sont pas ncessaire, mais peuvent
aider  l'assembleur CALM de gnrer le code le plus compact.

Remarques
   L'adressage indirect avec le registre P (Motorola: DP) doit tre crit
explicitement   {P}*256+valeur   ou   [P]+valeur.
   La notation des instructions suivantes ne se diffrencie pas:

    MOVE    #adresse,IX
    MOVE    #valeur,IX

L'opration rsultante est pourtant diffrente. Puisque l'assembleur
choisit toujours l'adressage relatif, il faut utiliser dans le deuxime cas
l'indicateur d'adresses I^ (immediate, immdiat):

    MOVE    #I^valeur,IX

Cette ambigut existe seulement avec le code opratoire MOVE (Motorola
appellent les codes opratoires correspondants LEA et LD).

   On peut slectionner dans le module M6809 par   .PROCSET choix   diffrents
modes. Par dfaut il y a: .PROCSET DEFREL,ABS_ONLY.

   DEFREL   l'adressage relatif est toujours choisi s'il n'y a pas d'indicateur
            d'adresses (par dfaut).
   DEFABS   utilise toujours l'adressage absolu (sauf pour JUMP,cc). I^ n'est
            plus ncessaire.
   ABS_ONLY adresse = 16^adresse (seulement avec DEFABS, par dfaut).
   ABS_OR_P0 si adresse se trouve dans la gamme 0..255 et est definie
            auparavant, alors [P]+adresse est gnr (l'assembleur suppose que
            P est 0), sinon 16^adresse (seulement avec DEFABS).

Diffrences par rapport  l'assembleur du fabricant
   Les diffrents noms des codes opratoires sont indiqus dans la
carte de rfrence.
   notation de         CALM                   Motorola
   l'adressage:        #valeur                #valeur
                       adresse                adresse
                       {registre}             ,registre
                       {registre}+dpl        dpl,registre
                       {Ri+1+}                ,Ri+
                       {-1-Ri}                ,-Ri
                       {Ri+2+}                ,Ri++
                       {-2-Ri}                ,--Ri
                       {Ri}+{Rj}              Rj,Ri
                       {{Ri}}                 [,Ri]
                       {adresse}              [adresse]
                       R^adresse              adresse,PCR
                       A|B|IX                 A,B,IX

   pseudo-             .ASCII                 FCC
   instructions:       .BLK.8                 RMB
                       .END                   END
                       .LOC                   ORG
                       .8, .16                FCB, FDB

CALM assembler description for the M6809

Chosen addressing mode
   The CALM Assembler chooses for all instructions (MOVE, JUMP, ...), which
use the direct addressing with the memory, the relative addressing mode.
Therefore, an address independent machine code is generated automatically.
The absolute addressing mode must be forced by a corresponding prefix
(i.e. 16^).

Automatic optimisation of the instruction codes
   There exists many code optimisation possibilities. On the one side, they
concern the relative addressing (which is chosen automatically):

    JUMP    R8^address      [ 2 bytes ]
    JUMP    R16^address     [ 3 bytes ]
    JUMP,b  R8^address      [ 2 bytes ]
    JUMP,b  R16^address     [ 4 bytes ]
    MOVE    R8^address,A    [ 3 bytes ]
    MOVE    R16^address,A   [ 4 bytes ]

On the other side, differents offsets are possible with the indirect
addressing:

    MOVE    {IX}+A5^offset  [ 2 bytes ]
    MOVE    {IX}+A8^offset  [ 3 bytes ]
    MOVE    {IX}+16^offset  [ 4 bytes ]

   In both cases, the CALM assembler can generate the shortest instruction
code, when the address (the offset) is known and is within the fixed limits.
The prefixes are not necessary, but can help the CALM assembler to generate
the compactest code.

Remarks
   The indirect addressing mode with the register P (Motorola: DP) must
be written explicitly   {P}*256+value   or   [P]+value   .
   The notation of the following two instructions does not differ:

    MOVE    #address,IX
    MOVE    #value,IX

However, the resulting operation is different. As the CALM Assembler takes
always the relative addressing, you must use in the second case the address
specifier I^ (immediate):

    MOVE    #I^value,IX

This ambiguity exists only with the operation code MOVE (Motorola names these
operation codes LEA and LD respectively).

   The module M6809 may be switched with   .PROCSET choice   to different
modes. Default: .PROCSET DEFREL,ABS_ONLY.

   DEFREL   relative addressing is always used if there is no address
            specifier (default).
   DEFABS   absolute addressing is always used (except JUMP,cc). I^ is no
            longer necessary.
   ABS_ONLY address = 16^address (with DEFABS only, default).
   ABS_OR_P0 if address is in the range 0..255 and defined before, then
            [P]+address is generated (assembler assumes that P is zero)
            else 16^address (with DEFABS only).

Differences to the producer assembler
   The different notations of the operation codes are given in the CALM
reference card.
   notation of the     CALM                   Motorola
   addressing          #value                 #value
   mode:               address                address
                       {register}             ,register
                       {register}+offset      offset,register
                       {Ri+1+}                ,Ri+
                       {-1-Ri}                ,-Ri
                       {Ri+2+}                ,Ri++
                       {-2-Ri}                ,--Ri
                       {Ri}+{Rj}              Rj,Ri
                       {{Ri}}                 [,Ri]
                       {address}              [address]
                       R^address              address,PCR
                       A|B|IX                 A,B,IX

   pseudo-             .ASCII                 FCC
   instructions:       .BLK.8                 RMB
                       .END                   END
                       .LOC                   ORG
                       .8, .16                FCB, FDB
