BM68020.TXT

Beschreibung zum CALM-Assembler fr 68020/68030/68040/CPU32

Gewhlte Adressierung
   Bei den 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
   Bei den Sprungbefehlen (JUMP, CALL) sind folgende Codeoptimisierungen
mglich:

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

Der CALM-Assembler whlt die relative 8 Bit Adressierung, wenn die Adresse
bekannt und innerhalb der Grenzen einer relativen 8 Bit Adressierung liegt.
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, 68020, 68030, 68040 und CPU32) an der gleichen 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 ]
    MOVE.32 R32^Adresse,D0 [ 8 Bytes ]
    MOVE.32 R^Adresse,D0   [ 4 oder 8 Bytes, Assembler whlt ]

   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 bei .8/.16 (.32) ]
    SUB.s   #Wert,data- [ 2 (4) Bytes weniger bei .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. Das Gleiche gilt fr die neuen 68020/68030/68040/CPU32-
Adressierungsmglichkeiten (nicht alle fr CPU32):

    MOVE.8 {A0}+size^{D0}*scale+Abstand,D1
    MOVE.8 {{A0}+Abstand1}+size^{D0}*scale+Abstand2,D1
    MOVE.8 {{A0}+size^{D0}*scale+Abstand1}+Abstand2,D1
    MOVE.8 size^{D0}*scale+R^Adresse,D1
    MOVE.8 {R^Adresse}+size^{D0}*scale+Abstand,D1
    MOVE.8 {size^{D0}*scale+R^Adresse}+Abstand,D1

   Mit den neuen Adressierungsmglichkeiten sind einige neue
Adressierungsarten im "Program Space" mglich (normalerweise "Data Space").
Diese Unterscheidung ist nur mit einer MMU sinnvoll. Mit dem Prfix P^
wird der Unterschied angezeigt (Motorola: ZPC):

    MOVE.8 P^size^{D0}*scale+Abstand,D1
    MOVE.8 P^{Abstand1}+size^{D0}*scale+Abstand2,D1
    MOVE.8 P^{size^{D0}*scale+Abstand1}+Abstand2,D1

   Anmerkung: Die relative Adressierung ist automatisch im "Program Space".

   Fr eine CALM-Schreibweise existieren zahlreiche, funktionell 100%
identische Befehlscodes und Adressierungsarten. Der CALM-Assembler whlt
eine(n) davon. Die anderen knnen nicht generiert werden.
   So ist z.B. der Befehl TRAP,VS im 68020/68030/68040/CPU32 zweimal vorhanden
(Motorola: TRAPV und TRAPcc (neu)). Da aber der neue Befehl (TRAPcc) im 68020/
68030/68040/CPU32 viel leistungsfhiger ist, wird auf den alten Befehl (TRAPV)
verzichtet.
   Bei den Sprungbefehlen (JUMP, CALL) kann die maximale Reichweite
eingestellt werden: .PROCSET DEFR16 erlaubt R8^ und R16^ (wie beim 68000/10)
[Vorgabewert]; .PROCSET DEFR32 erlaubt R8^, R16^ und R32^.
   .PROCSET FPU/NOFPU (Vorgabe): siehe TM68020.ASM!
   .PROCSET CPU32/M68040/M68030/M68020 (Vorgabe): siehe TM68020.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)
                 {Ai}+size^{Ri}*scale+Abstand   (Abstand,Ai,Ri.size*scale)
                 {{Ai}+Ab1}+size^{Ri}*scale+Ab2 ([Ab1,Ai],Ri.size*scale,Ab2)
                 {{Ai}+size^{Ri}*scale+Ab1}+Ab2 ([Ab1,Ai,Ri.size*scale],Ab2)
                 R^Adresse                      (Adresse,PC)
                 {Ri}+R^Adresse                 (Adresse,PC,Ri)
                 size^{Ri}*scale+R^Adresse      (Adresse,PC,Ri.size*scale)
                 {R^Adresse}+size^{Ri}*scale+Ab ([Adresse,PC],Ri.size*scale,Ab)
                 {size^{Ri}*scale+R^Adresse}+Ab ([Adresse,PC,Ri.size*scale],Ab)
                 P^size^{Ri}*scale+Abstand      (Abstand,ZPC,Ri.size*scale)
                 P^{Ab1}+size^{Ri}*scale+Ab2    ([Ab1,ZPC],Ri.size*scale,Ab2)
                 P^{size^{Ri}*scale+Ab1}+Ab2    ([Ab1,ZPC,Ri.size*scale],Ab2)
                 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 68020/68030/68040/CPU32 pour l'assembleur CALM

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

Optimisation automatique du code machine
   Pour les instructions de saut (JUMP, CALL), les optimisations de code
possibles sont:

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

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

    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 d'adresses A16^ correspond  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
toujours  la mme place et ceci pour toutes les versions du 68000 (68000,
68008, 68010, 68020, 68030, 68040 et CPU32).
   Pour toutes les autres instructions, l'adressage absolu est utilis. Les
optimisations possibles sont (les indicateurs d'adresses ne sont pas
ncessaires):

    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 ]
    MOVE.32 R32^adresse,D0 [ 8 octets ]
    MOVE.32 R^adresse,D0   [ 4 ou 8 octets, l'assembleur choisit ]

   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 registres et une valeur de dplacement
a 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 met automatiquement la valeur nulle. La mme
chose est valable pour les modes d'adressages nouvelles du 68020/68030/68040-
/CPU32 (pas tous pour le CPU32):

    MOVE.8 {A0}+size^{D0}*scale+dpl,D1
    MOVE.8 {{A0}+dpl1}+size^{D0}*scale+dpl2,D1
    MOVE.8 {{A0}+size^{D0}*scale+dpl1}+dpl2,D1
    MOVE.8 size^{D0}*scale+R^adresse,D1
    MOVE.8 {R^adresse}+size^{D0}*scale+dpl,D1
    MOVE.8 {size^{D0}*scale+R^adresse}+dpl,D1

   Les modes d'adressages nouvelles permettent des modes d'adressages
nouvelles dans le "Program Space" (normalement "Data Space"). Cette diffrence
n'est utile qu'avec une MMU. Avec le prfixe P^ (Motorola: ZPC) on indique la
diffrence:

    MOVE.8 P^size^{D0}*scale+dpl,D1
    MOVE.8 P^{dpl1}+size^{D0}*scale+dpl2,D1
    MOVE.8 P^{size^{D0}*scale+dpl1}+dpl2,D1

   Remarque: L'adressage relatif se trouve automatiquement dans le "Program
Space".

   Pour plusieurs codes machine et modes d'adressage, fonctionnellement 100%
identiques, il n'y a qu'une notation CALM. L'assembleur CALM choisit un code
parmi ceux. On ne peut pas gnrer les autres.
   Par ex., l'instruction TRAP,VS existe deux fois dans le 68020/68030/68040-
/CPU32 (Motorola: TRAPV et TRAPcc (nouveau dans le 68020/68030/68040/CPU32)).
Puisque l'instruction nouvelle (TRAPcc) est plus puissante, on renonce 
l'instruction ancienne (TRAPV).
   Pour les instructions de saut (JUMP, CALL), on peut fixer le rayon d'action:
.PROCSET DEFR16   permet R8^ et R16^ (compatible avec le 68000/10) [par
dfaut];   .PROCSET DEFR32   permet R8^, R16^ et R32^.
   .PROCSET FPU/NOFPU (par dfaut): voir TM68020.ASM!
   .PROCSET CPU32/M68040/M68030/M68020 (par dfaut): voir TM68020.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
feuille de rfrence CALM.
   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)
                {Ai}+size^{Ri}*scale+dpl      (dpl,Ai,Ri.size*scale)
                {{Ai}+Ab1}+size^{Ri}*scale+Ab2 ([Ab1,Ai],Ri.size*scale,Ab2)
                {{Ai}+size^{Ri}*scale+Ab1}+Ab2 ([Ab1,Ai,Ri.size*scale],Ab2)
                R^adresse                      (adresse,PC)
                {Ri}+R^adresse                 (adresse,PC,Ri)
                size^{Ri}*scale+R^adresse      (adresse,PC,Ri.size*scale)
                {R^adresse}+size^{Ri}*scale+Ab ([adresse,PC],Ri.size*scale,Ab)
                {size^{Ri}*scale+R^adresse}+Ab ([adresse,PC,Ri.size*scale],Ab)
                P^size^{Ri}*scale+dpl         (dpl,ZPC,Ri.size*scale)
                P^{Ab1}+size^{Ri}*scale+Ab2    ([Ab1,ZPC],Ri.size*scale,Ab2)
                P^{size^{Ri}*scale+Ab1}+Ab2    ([Ab1,ZPC,Ri.size*scale],Ab2)
                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 68020/68030/68040/CPU32

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,
CALL):

    JUMP    R8^address  [ 2 bytes ]
    JUMP    R16^address [ 4 bytes ]
    JUMP    R32^address [ 6 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 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, 68020, 68030, 68040, and CPU32) 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 ]
    MOVE.32 R32^address,D0 [ 8 bytes ]
    MOVE.32 R^address,D0   [ 4 or 8 bytes, assembler chooses ]

   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. The same applies to the new
addressing modes of the 68020/68030/68040/CPU32 (not all for the CPU32):

    MOVE.8 {A0}+size^{D0}*scale+offset,D1
    MOVE.8 {{A0}+offset1}+size^{D0}*scale+offset2,D1
    MOVE.8 {{A0}+size^{D0}*scale+offset1}+offset2,D1
    MOVE.8 size^{D0}*scale+R^address,D1
    MOVE.8 {R^address}+size^{D0}*scale+offset,D1
    MOVE.8 {size^{D0}*scale+R^address}+offset,D1

   With these new addressing modes also some new addressing modes are
possible in the "program space" (normally we have "data space"). This
distinction is only useful with a MMU. The prefix P^ is used to show the
difference (Motorola: ZPC):

    MOVE.8 P^size^{D0}*scale+offset,D1
    MOVE.8 P^{offset1}+size^{D0}*scale+offset2,D1
    MOVE.8 P^{size^{D0}*scale+offset1}+offset2,D1

   Note: The relative addressing is always in the "program space".

   In some cases, there exist one CALM notation for several, functionally
100% identical instruction codes and addressing modes. The CALM assembler
chooses one of them. There is no possibility to generate the others.
   For example, the instruction TRAP,VS exist in the 68020/68030/68040/CPU32
twice (Motorola: TRAPV and TRAPcc (new in the 68020/68030/68040/CPU32)). As
the new instruction (TRAPcc) in the 68020/68030/68040/CPU32 is more powerful,
the old instruction (TRAPV) is no more generated.
   The address range of the jump instructions (JUMP, CALL) can be fixed:
.PROCSET DEFR16   allows R8^ and R16^ (compatible with the 68000/10) [per
default];   .PROCSET DEFR32   allows R8^, R16^ and R32^.
   .PROCSET FPU/NOFPU (per default): see TM68020.ASM!
   .PROCSET CPU32/M68040/M68030/M68020 (per default): see TM68020.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)
                {Ai}+size^{Ri}*scale+offset    (offset,Ai,Ri.size*scale)
                {{Ai}+of1}+size^{Ri}*scale+of2 ([of1,Ai],Ri.size*scale,of2)
                {{Ai}+size^{Ri}*scale+of1}+of2 ([of1,Ai,Ri.size*scale],of2)
                R^address                      (address,PC)
                {Ri}+R^address                 (address,PC,Ri)
                size^{Ri}*scale+R^address      (address,PC,Ri.size*scale)
                {R^address}+size^{Ri}*scale+of ([address,PC],Ri.size*scale,of)
                {size^{Ri}*scale+R^address}+of ([address,PC,Ri.size*scale],of)
                P^size^{Ri}*scale+offset       (offset,ZPC,Ri.size*scale)
                P^{of1}+size^{Ri}*scale+of2    ([of1,ZPC],Ri.size*scale,of2)
                P^{size^{Ri}*scale+of1}+of2    ([of1,ZPC,Ri.size*scale],of2)
                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

