BM68000.TXT

Beschreibung zum CALM Assembler fr 68000/68008/68010

Gewhlte Adressierung
   Bei Sprungbefehlen (JUMP, CALL) wird immer die relative Adressierung
gewhlt. Die absolute Adressierung kann nur mit den entsprechenden
Adressenangaben (A16^, 32^) erreicht werden.
   Bei allen anderen Befehlen wird dagegen immer die absolute Adressierung
gewhlt, wenn der Quelle- oder/und der Zieloperand der Speicher ist.

Automatische Optimisierung des Befehlscodes
   Beim Sprungbefehlen sind folgende Codeoptimisierungen mglich:

    JUMP    R8^Adresse  [ 2 Bytes ]
    JUMP    R16^Adresse [ 4 Bytes ]

Der CALM Assembler whlt die relative 8 Bit Adressierung, wenn die
Adresse bekannt und innerhalb der Grenzen einer relativen 8 Bit Adressierung
liegt. Auch bei der absoluten Adressierung sind zwei Mglichkeiten
gegeben (die immer die Adressenangaben erfordern):

    JUMP    A16^Adresse [ 4 Bytes ]
    JUMP    32^Adresse  [ 6 Bytes ]
    JUMP    U^Adresse   [ 4 oder 6 Bytes, Assembler whlt ]

Die Adresse mit der Adressenangabe A16^ entspricht den beiden Bereichen:
16'0000..16'7FFF und -16'0001..-16'8000. D.h. der zweite Adressbereich
ist negativ. Dies entspricht bei einer Ausdruckberechnung mit 32 Bit
Auflsung dem Bereich: 16'FFFF8000..16'FFFFFFFF. Nur so ist gewhr-
leistet, dass sich der zweite Bereich bei allen 68000-Versionen (68000,
68008, 68010 und 68020) an gleicher Stelle befindet!
   Bei allen anderen Befehlen wird die absolute Adressierung verwendet.
Folgende Optimisierungen sind mglich (Adressenangaben sind nicht
erforderlich):

    MOVE.32 A16^Adresse,D0 [ 4 Bytes ]
    MOVE.32 32^Adresse,D0  [ 6 Bytes ]

Wnscht man die relative Adressierung, so sind die entsprechenden
Adressenangaben erforderlich:

    MOVE.32 R16^Adresse,D0 [ 4 Bytes ]

   Weitere Codeoptimisierungen sind mglich:

    MOVE.32 #A8^Wert,Di [ 2 Bytes ]
    MOVE.32 #Wert,Di    [ 6 Bytes ]

Der erste Fall wird automatisch kodiert, wenn der CALM Assembler den Wert
im ersten Durchlauf kennt und der Wert innerhalb -128..+127 liegt.
   Auch bei folgenden Befehlen optimisiert der CALM Assembler automatisch:

    ADD.s   #Wert,data- [ 2 (4) Bytes weniger wenn .8/.16 (.32) ]
    SUB.s   #Wert,data- [ 2 (4) Bytes weniger wenn .8/.16 (.32) ]

wenn sich der Wert in den Grenzen 1..8 befindet.

Bemerkungen
   Die indirekte Adressierung mit zwei Registern und einem Abstandswert
hat zwei Mglichkeiten:

    MOVE.8  {A0}+A16^{D0}+Abstand,D1
    MOVE.8  {A0}+32^{D0}+Abstand,D1

Fehlt die Adressenangabe vor dem zweiten Register, whlt der CALM
Assembler den zweiten Fall. Fehlt der Abstandswert (+Abstand) setzt der
CALM Assembler automatisch Null ein.
   Fr eine CALM Schreibweise existieren zahlreiche, funktionell 100%
identische Befehlscodes. Der CALM Assembler whlt einen davon. Die
anderen knnen nicht generiert werden.
   Das Modul M68000.PRO erkennt mit .PROCSET M68010 auch die zustzlichen
Befehle des M68010.
   .PROCSET MACINSTR/NOMACINSTR (Vorgabe)/FPU/NOFPU (Vorgabe): siehe
TM68000.ASM!
   .PROCVAL FPU_ID Wert: ndert die FPU-Nummer (Vorgabe: 1), Bereich: 0..7.

Unterschiede zum Herstellerassembler
   Die unterschiedlichen Bezeichnungen der Operationscodes sind in den
Befehlslisten angegeben.
   Schreibweise    CALM                         Motorola
   der             #Wert                        #Wert
   Adressierung:   Adresse                      Adresse
                   {Register}                   (Register)
                   {Ai+}                        (Ai)+
                   {-Ai}                        -(Ai)
                   {Ai}+Abstand                 Abstand(Ai)
                   {Ai}+A16^{Ri}+Abstand        Abstand(Ai,Ri)
                   {Ai}+A16^{Ri}+Abstand        Abstand(Ai,Ri.W)
                   {Ai}+32^{Ri}+Abstand         Abstand(Ai,Ri.L)
                   R^Adresse                    Adresse(PC)
                   {Ri}+R^Adresse               Adresse(PC,Ri)
                   Ausdruck:Bit_Adresse         Bit_Adresse,Ausdruck

   Pseudobefehle:  .ASCII                       DC.B
                   .BLK.8, .BLK.16, .BLK.32     DS.B, DS.W, DS.L
                   .END                         END
                   .FILL.8, .FILL.16, .FILL.32  DCB.B, DCB.W, DCB.L
                   .INS                         INCLUDE
                   .LIST                        LIST/NOLIST
                   .LOC                         ORG
                   .TITLE                       TTL
                   .8, .16, .32                 DC.B, DC.W, DC.L

Description du 68000/68008/68010 pour l'assembleur CALM

Adressage choisi
   Pour les instructions de sauts (JUMP, CALL), l'adressage relatif est
toujours choisi. L'adressage absolu ne peut tre gnrer qu'avec
les indicateurs d'adresses (A16^, 32^).
   Pour toutes les autres instructions, l'adressage absolu est choisi par
dfaut si l'oprande de source ou/et de destination est la mmoire.

Optimisation automatique du code machine
   Pour les instructions de saut, les optimisations de code possibles sont:

    JUMP    R8^adresse  [ 2 octets ]
    JUMP    R16^adresse [ 4 octets ]

L'assembleur CALM choisit l'adressage relatif 8 bits si l'adresse est connue
et est  l'intrieur des limites d'un adressage relatif 8 bits. Pour
l'adressage absolu, il y a deux possibilits (qui ncessitent toujours
les indicateurs d'adresses):

    JUMP    A16^adresse [ 4 octets ]
    JUMP    32^adresse  [ 6 octets ]
    JUMP    U^adresse   [ 4 ou 6 octets, l'assembleur choisit ]

L'adresse avec l'indicateur de donnes A16^ correspond aux deux zones:
16'0000..16'7FFF et -16'0001..-16'8000. C..d. la deuxime zone d'adresse
est ngative. Ceci correspond avec une rsolution de 32 bits aux
adresses: 16'FFFF8000..16'FFFFFFFF. Ainsi est assur que la deuxime zone
se trouve pour toutes les versions de la famille 68000 (68000, 68008, 68010
et 68020)  la mme place!
   Pour toutes les autres instructions, l'adressage absolu est utilis.
Les optimisations possibles sont (les indicateurs d'adresses ne sont pas
ncessaire):

    MOVE.32 A16^adresse,D0 [ 4 octets ]
    MOVE.32 32^adresse,D0  [ 6 octets ]

Si l'on veut utiliser l'adressage relatif, il faut ajouter les indicateurs
d'adresses correspondants:

    MOVE.32 R16^adresse,D0 [ 4 octets ]

   D'autres optimisations de code possibles sont:

    MOVE.32 #A8^valeur,Di [ 2 octets ]
    MOVE.32 #valeur,Di    [ 6 octets ]

Le premier cas est cod automatiquement si l'assembleur CALM connat la
valeur  la premire passe et la valeur se trouve dans la gamme -128..+127.
   L'assembleur CALM optimise aussi les instructions suivantes:

    ADD.s   #valeur,data- [ 2 (4) octets moins si .8/.16 (.32) ]
    SUB.s   #valeur,data- [ 2 (4) octets moins si .8/.16 (.32) ]

si la valeur se trouve dans les limites 1..8.

Remarques
   L'adressage indirect avec deux registre et une valeur de dplacement
connat deux possibilits:

    MOVE.8 {A0}+A16^{D0}+dpl,D1
    MOVE.8 {A0}+32^{D0}+dpl,D1

Si l'indicateur d'adresses n'est pas prsent devant le deuxime registre,
l'assembleur CALM choisit le deuxime cas. Si la valeur de dplacement
(+dpl) manque, l'assembleur CALM met automatiquement la valeur nulle.
   Pour plusieurs codes machine, fonctionnellement 100% identiques, il n'y a
qu'une notation CALM. L'assembleur CALM choisit un. On ne peut pas gnrer
les autres.
   Le module M68000.PRO reconnat avec .PROCSET M68010 aussi les
instructions additionnelles du M68010.
   .PROCSET MACINSTR/NOMACINSTR (p.dfaut)/FPU/NOFPU (p.dfaut): voir
TM68000.ASM!
   .PROCVAL FPU_ID valeur: change le numro du FPU (par dfaut: 1), gamme:
0..7.

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)
                   {Ai+}                       (Ai)+
                   {-Ai}                       -(Ai)
                   {Ai}+dpl                   dpl(Ai)
                   {Ai}+A16^{Ri}+dpl          dpl(Ai,Ri)
                   {Ai}+A16^{Ri}+dpl          dpl(Ai,Ri.W)
                   {Ai}+32^{Ri}+dpl           dpl(Ai,Ri.L)
                   R^adresse                   adresse(PC)
                   {Ri}+R^adresse              adresse(PC,Ri)
                   expression:adresse_bit      adresse_bit,expression

   pseudo-         .ASCII                      DC.B
   instructions:   .BLK.8, .BLK.16, .BLK.32    DS.B, DS.W, DS.L
                   .END                        END
                   .FILL.8, .FILL.16, .FILL.32 DCB.B, DCB.W, DCB.L
                   .INS                        INCLUDE
                   .LIST                       LIST/NOLIST
                   .LOC                        ORG
                   .TITLE                      TTL
                   .8, .16, .32                DC.B, DC.W, DC.L

CALM assembler description for the 68000/68008/68010

Chosen addressing mode
   The CALM assembler chooses always the relative addressing mode for the
jump instructions (JUMP, CALL). The absolute addressing mode must be forced
by the corresponding address specifiers (A16^, 32^).
   In all other instructions, the CALM assembler chooses the absolute
addressing mode, when the source or/and the destination operand is the
memory.

Automatic optimisation of the instruction codes
   The following code optimisations are possible for jump instructions:

    JUMP    R8^address  [ 2 bytes ]
    JUMP    R16^address [ 4 bytes ]

The CALM assembler chooses the relative 8 bit addressing mode, when the
address is known and is within the limits of a relative 8 bit addressing
mode. There exist also two possibilities with the absolute addressing mode
(which needs always address specifiers):

    JUMP    A16^address [ 4 bytes ]
    JUMP    32^address  [ 6 bytes ]
    JUMP    U^address   [ 4 or 6 bytes, assembler chooses ]

The address with the address specifier A16^ corresponds to the ranges:
16'0000..16'7FFF and -16'0001..-16'8000. The second address range is
negative. This corresponds to the range 16'FFFF8000..16'FFFFFFFF when the
expression unit has a resolution of 32 bits. The second address range
must be negative to guarantee, that for all 68000 versions (68000, 68008,
68010 and 68020) this second address range is at the same place!
   For all other instructions, the absolute addressing mode is taken per
default. The following optimisations are possible (address specifiers are not
necessary):

    MOVE.32 A16^address,D0 [ 4 bytes ]
    MOVE.32 32^address,D0  [ 6 bytes ]

If one wants the relative addressing mode, the corresponding address
specifiers are necessary:

    MOVE.32 R16^address,D0 [ 4 bytes ]

   Additional code optimisations are possible::

    MOVE.32 #A8^value,Di [ 2 bytes ]
    MOVE.32 #value,Di    [ 6 bytes ]

The first case is automatically coded, when the CALM assembler knows the
value in the first pass and when the value is within the limits -128..+127.
   Also in the following instructions the CALM assembler optimises
automatically:

    ADD.s   #value,data- [ 2 (4) bytes less when .8/.16 (.32) ]
    SUB.s   #value,data- [ 2 (4) bytes less when .8/.16 (.32) ]

when the value is in the limits 1..8.

Remarks
   The indirect addressing with two registers and an offset value has two
possibilities:

    MOVE.8  {A0}+A16^{D0}+offset,D1
    MOVE.8  {A0}+32^{D0}+offset,D1

If the address specifier before the second register is absent, the CALM
assembler chooses the second case. If the offset is absent, the CALM
assembler takes automatically the value zero.
   In some cases, there exist one CALM notation for several, functionally
100% identical instruction codes. The CALM assembler chooses one of them.
There is no possibility to generate the others.
   The module M68000.PRO knows with .PROCSET M68010 also the additional
instructions of the M68010.
   .PROCSET MACINSTR/NOMACINSTR (p.default)/FPU/NOFPU (p.default): see
TM68000.ASM!
   .PROCVAL FPU_ID value: changes the FPU number (per default: 1), range: 0..7.

Differences to the producer assembler
   The different notations of the operation codes are given in the CALM
reference card.
   notation        CALM                         Motorola
   of the          #value                       #value
   addressing      address                      address
   modes:          {register}                   (register)
                   {Ai+}                        (Ai)+
                   {-Ai}                        -(Ai)
                   {Ai}+offset                  offset(Ai)
                   {Ai}+A16^{Ri}+offset         offset(Ai,Ri)
                   {Ai}+A16^{Ri}+offset         offset(Ai,Ri.W)
                   {Ai}+32^{Ri}+offset          offset(Ai,Ri.L)
                   R^address                    address(PC)
                   {Ri}+R^address               address(PC,Ri)
                   expression:bit_address       bit_address,expression

   pseudo-         .ASCII                       DC.B
   instructions:   .BLK.8, .BLK.16, .BLK.32     DS.B, DS.W, DS.L
                   .END                         END
                   .FILL.8, .FILL.16, .FILL.32  DCB.B, DCB.W, DCB.L
                   .INS                         INCLUDE
                   .LIST                        LIST/NOLIST
                   .LOC                         ORG
                   .TITLE                       TTL
                   .8, .16, .32                 DC.B, DC.W, DC.L

