Pl INSTRUC.DOC: Difference between revisions

From Atari Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 40: Line 40:
   
   
MOVE source,destination :(.B),[.W],(.L)
+
MOVE source,destination :(.B),[.W],(.L)
-----------------------------
+
-----------------------------
The 3 operation sizes are allowed for this instruction,
+
All three operation sizes are allowed for this instruction,
size [.W] is taken by default.
+
with [.W] being the default size.
   
The 'source' operand is copied (and remains unchanged) to (into)
+
The 'source' operand is copied (and remains unchanged) to (in)
the 'destination' operand.
+
the 'destination' operand.
   
The addressing modes allowed for the 'source' operand are:
+
The allowed addressing modes for the source operand are:
  +
------
------
 
dn (data registers)
+
dn (data registers)
an (address registers)
+
an (address registers)
BBBB
+
BBBB
BB
+
BB
#BBB
+
#BBB
(an)
+
(an)
(an)+
+
(an)+
-(an)
+
-(an)
d(an)
+
d(an)
d(an,rn)
+
d(an,rn)
d(pc)
+
d(pc)
d(pc,rn)
+
d(pc,rn)
   
The addressing modes allowed for the 'destination' operand are:
+
The allowed addressing modes for the destination operand are:
  +
-----------
-----------
 
dn
+
dn
an
+
an
BBBB
+
BBBB
BB
+
BB
(an)
+
(an)
(an)+
+
(an)+
-(an)
+
-(an)
d(an)
+
d(an)
d(an,rn)
+
d(an,rn)
   
  +
Only the N and Z Bits of the CCR are affected.
   
  +
Example of use:
At the CCR level: Only the N and Z bits are affected
 
  +
----------------------
---
 
  +
Move.l #1456701,d0
   
  +
The L-M equal to 1256701 is placed in the data register d0.
   
Example of use:
 
----------------------
 
MOVEQ #1456701,d0
 
   
The L-M equal to 1256701 is set in the data register d0
+
MOVEQ #D,dn
  +
------------------
  +
The source operand is an immediate, signed data contained in an
  +
octet (-128<= D <128).
  +
The destination operand is a data register.
   
  +
The source data, signed and contained in an octet, is copied into a
 
  +
data register with SIGN EXTENSION of the register:
   
MOVEQ #D,dn
+
Meaning that the data is placed in the least significant byte of
  +
the Dn register and the MSB is extended (copied) up to the 31st bit of
------------------
 
  +
the register, so that the data register is fully affected by the
The source operand is an immediate, signed data, contained in a byte (-128<= D <128)
 
  +
'data loading' and the sign of the data is preserved.
The destination operand is a data register
 
   
The source data, a signed byte, is copied into a data
+
The source operand therefore allows the addressing mode:
  +
------
register after SIGN EXTENSION OF THE REGISTER:
 
  +
#BBB ( -128<= BBB <128 )
 
I.e. the data is placed in the low-order byte of register Dn and the MSB has been extended (copied) to the 31st bit of
 
register, so that the data register is entirely affected
 
by the 'loading' of the data and the data's sign is
 
preserved.
 
   
The source operand thus accepts the following addressing mode:
+
The destination operand is a data register.
------
+
-----------
#BBB ( -128<= BBB <128 )
 
   
  +
Only the N and Z Bits of the CCR are affected by this instruction.
The destination operand is a data register.
 
  +
---
----------- ------------------
 
   
  +
Example:
  +
--------
  +
MOVEQ #%01100101,d0
   
  +
The octet 01100101 is placed in d0:
Only the N and Z bits of the CCR are affected by this instruction
 
---
 
   
  +
d0= : 00000000000000000000000001100101
Example:
 
  +
Bit nr 31 .
--------
 
  +
. .
MOVEQ #%01100101,d0
 
  +
MSB (0) <---------------MSB (0)
   
  +
There has been sign extension of d0 (here MSB=0 because 01100101>0)
The byte 01100101 is placed in d0:
 
   
  +
NB: Moveq is distinguished from Move by greater speed, but
d0= : 00000000000000000000000001100101
 
  +
-- remember the conditions of use of Moveq!
Bit nr 31 .
 
. .
 
MSB (0) <---------------MSB (0)
 
   
There has been sign extension of d0 (here MSB=0 because 01100101>0)
 
   
  +
MOVEA source,an :(.W),(.L)
NB: Moveq is distinguished from Move by being faster, but
 
  +
--------------------
-- remember the conditions for using Moveq!
 
  +
The Movea instruction complements the Move instruction as it accepts an
  +
Address Register for the destination operand.
   
  +
On most assemblers, the syntax MOVE source,an is
  +
accepted and automatically translated to MOVEA source,an.
   
  +
If the source operand uses the .W operation size, there is
  +
sign extension of the address register an.
  +
The .B size is not allowed for MOVEA.
   
MOVEA source,an :(.W),(.L)
+
The allowed addressing modes for the source operand are:
--------------------
+
------
  +
dn
The MOVEA instruction completes the MOVE instruction as it accepts an
 
  +
an
Address Register for the destination operand.
 
+
BBBB
  +
BB
On most assemblers, the syntax MOVE source,an is
 
  +
#BBB
accepted and automatically translated to MOVEA source,an
 
  +
(an)
  +
(an)+
  +
-(an)
  +
d(an)
  +
d(an,rn)
  +
d(pc)
  +
d(pc,rn)
   
  +
The destination operand is an address register
If the source operand uses the .W operand size, there is
 
  +
-----------
sign extension of the address register an.
 
The .B size is not allowed for MOVEA.
+
The MOVEA instruction does not affect the CCR.
  +
---
   
  +
Example of use:
  +
----------------------
  +
MOVEA.L #etiq,a5
   
  +
The address register a5 is loaded with the address pointed to by the
The addressing modes allowed for the source operand are:
 
  +
label 'etiq'.
------
 
dn
 
an
 
BBBB
 
BB
 
#BBB
 
(an)
 
(an)+
 
-(an)
 
d(an)
 
d(an,rn)
 
d(pc)
 
d(pc,rn)
 
   
   
  +
LEA source,an : [.L]
The destination operand is an address register
 
----------- ------------------
+
----------------
The MOVEA instruction does not affect the CCR.
 
---
 
 
Example of use:
 
----------------------
 
MOVEA.L #label,a5
 
 
The address register a5 is loaded with the address pointed to by the
 
label 'label'
 
 
 
 
LEA source,an : [.L]
 
----------------
 
 
 
This instruction reads:'Load Effective Address'
+
This instruction reads: 'Load Effective Address'
 
Only the operation size .L is possible, which is indeed taken by default.
 
 
It allows to set the address pointed to by the source operand in
 
an address register.
 
 
The source operand accepts the following addressing modes:
 
------
 
 
BBBB
 
BB
 
(an)
 
d(an)
 
d(an,rn)
 
d(pc)
 
d(pc,rn)
 
 
DESTINATION IS OMITTED HERE. PLEASE PROVIDE THE COMPLETE INSTRUCTION FOR FURTHER TRANSLATION.
 
-------------------------
 
<Text truncated due to exceeding character limit; continuing from DIVU instruction>
 
 
The addressing modes allowed for the source operand are:
 
------
 
dn
 
BBBB
 
BB
 
#BBB
 
(an)
 
(an)+
 
-(an)
 
d(an)
 
d(an,rn)
 
d(pc)
 
d(pc,rn)
 
 
The C bit of the CCR is set to 0, the N, Z, V bits are set according to the
 
result, the X bit is not affected.
 
 
NB:.Make sure that the data ('source' and 'dn') are
 
-- positive and that the source operand is not 0!
 
 
.The instructions that operate on unsigned data are
 
faster than their complementary instructions that operate
 
on signed data (MULS/MULU, DIVS/DIVU), this is their
 
only advantage.
 
 
The instructions MULS and DIVS can of course also operate
 
on positive instructions.
 
 
 
CLR destination (.B),[.W],(.L)
 
--------------------
 
The CLR instruction turns OFF all BITS of the destination
 
operand (CLeaR).
 
 
The 3 sizes of operation are possible.
 
 
The addressing modes allowed for the destination operand are:
 
-----------
 
dn
 
BBBB
 
BB
 
(an)
 
(an)+
 
-(an)
 
d(an)
 
d(an,rn)
 
 
 
The Z bit of the CCR is set to 1, N, V, C bits are set to 0, X is not
 
affected. ---
 
 
Example of use:
 
----------------------
 
MOVE.W #%1111011101110110,d0
 
CLR.B d0
 
 
The low-order byte of d0 is set to 0, so d0 will now contain the word:
 
%1111011100000000 .
 
 
NB: .CLR.x instruction is logically equivalent to the instruction
 
--- 'MOVEQ.x #0, destination' but is curiously slower!
 
 
 
   
  +
Only the .L operation size is possible, and is the default.
AND source,dn (.B),[.W],(.L)
 
--------------
 
or
 
   
  +
It allows for placing the address pointed to by the source operand into
AND dn,destination (.B),[.W],(.L)
 
  +
an address register.
-------------------
 
 
Allows to perform a logical AND between its two operands.
 
   
  +
The source operand allows the addressing modes:
That is, the 2 operands coded in Binary are added together following a
 
  +
------
rule such that:
 
   
  +
BBBB
1+1 gives 1
 
1+0 gives 0
+
BB
  +
(an)
0+0 gives 0
 
  +
d(an)
0+1 gives 0
 
  +
d(an,rn)
  +
d(pc)
  +
d(pc,rn)
   
  +
The destination operand is an address register
And so for each bit of the 2 instruction operands.
 
  +
----------- ------------------
 
Example: MOVE.B #%11101011,d0; %11101011
 
------- MOVE.B #%10101000,d1; %10101000
 
AND.B d0,d1 ; ||||||||
 
||||||||
 
''''''''
 
the byte obtained: %10101000
 
   
  +
The LEA instruction does not influence the CCR.
For the first possible syntax of AND, the possible addressing modes
 
  +
---
for the operand 'source' are:
 
------
 
dn
 
an
 
BBBB
 
BB
 
#BBB
 
(an)
 
(an)+
 
-(an)
 
d(an)
 
d(an,rn)
 
d(pc)
 
d(pc,rn)
 
   
  +
Example of use:
For the second form of AND, the addressing modes allowed for the
 
  +
----------------------
operand 'destination' are:
 
  +
LEA etiq,a2
-----------
 
dn
 
an
 
BBBB
 
BB
 
(an)
 
(an)+
 
-(an)
 
d(an)
 
d(an,rn)
 
   
  +
The address pointed to by the label 'etiq' is placed in the
 
  +
address register a2.
Only the N and Z bits of the CCR are affected by this instruction.
 
  +
In fact, this can also be done with MOVE.L #etiq,a2, but
---
 
  +
it is less fast.
   
   
OR source,dn (.B),[.W],(.L)
+
CLR destination :(.B),[.W],(.L)
--------------
+
------------------
or
 
   
OR dn,destination (.B),[.W],(.L)
+
This instruction reads: 'CLeaR destination'
-------------------
 
 
Allows to perform a logical OR between its two operands.
 
   
  +
And allows for setting all bits of the destination operand to 0.
That is, the 2 operands coded in Binary are added together following a
 
rule such that:
 
   
  +
All three operation sizes are possible.
1+1 gives 1
 
1+0 gives 1
 
0+1 gives 1
 
0+0 gives 0
 
   
  +
The allowed addressing modes for the destination operand are:
And so for each bit of the 2 instruction operands.
 
  +
-----------
 
  +
dn
Example: MOVE.B #%11101011,d0; %11101011
 
  +
BBBB
------- MOVE.B #%10101000,d1; %10101000
 
  +
BB
OR.B d0,d1 ; ||||||||
 
  +
(an)
||||||||
 
  +
(an)+
''''''''
 
  +
-(an)
the byte obtained: %11101011
 
  +
d(an)
  +
d(an,rn)
   
For the first possible syntax of OR, the possible addressing modes
+
The Z bit of the CCR is set to 1, the N, V, C bits to 0.
  +
---
for the operand 'source' are:
 
------
 
dn
 
an
 
BBBB
 
BB
 
#BBB
 
(an)
 
(an)+
 
-(an)
 
d(an)
 
d(an,rn)
 
d(pc)
 
d(pc,rn)
 
   
  +
Example of use:
For the second form of OR, the addressing modes allowed for the
 
  +
----------------------
operand 'destination' are:
 
  +
CLR.W D0
-----------
 
dn
 
an
 
BBBB
 
BB
 
(an)
 
(an)+
 
-(an)
 
d(an)
 
d(an,rn)
 
   
  +
The 16 bits of the least significant word of d0 are set to 0.
 
Only the N and Z bits of the CCR are affected by this instruction.
 
---
 
   
   
EOR dn,destination (.B),[.W],(.L)
+
NEG destination : (.B),[.W],(.L)
-------------------
+
---------------------
 
Allows to perform a logical EOR (exclusive OR) between its two
 
operands.
 
   
  +
Allows for performing the NEGation of the destination operand.
That is, the 2 operands coded in Binary are added together following a
 
rule such that:
 
   
  +
All three operation sizes are possible.
1+1 gives 0
 
0+0 gives 0
 
0+1 gives 1
 
1+0 gives 1
 
   
  +
The destination operand is subtracted from 0, which has the effect of
And so for each bit of the 2 instruction operands.
 
  +
changing the sign of the operand: Bits that were active are
 
  +
turned off and bits that were off are activated.
Example: MOVE.B #%11101011,d0; %11101011
 
------- MOVE.B #%10101000,d1; %10101000
 
EOR.B d0,d1 ; ||||||||
 
||||||||
 
''''''''
 
the byte obtained: %01000011
 
   
  +
The destination operand allows the following addressing modes:
  +
-----------
  +
dn
  +
BBBB
  +
BB
  +
(an)
  +
(an)+
  +
-(an)
  +
d(an)
  +
d(an,rn)
   
  +
All Bits of the CCR are affected by the NEGation depending on the
The addressing modes allowed for the operand 'destination' are:
 
  +
result obtained.
-----------
 
  +
---
dn
 
an
 
BBBB
 
BB
 
(an)
 
(an)+
 
-(an)
 
d(an)
 
d(an,rn)
 
   
  +
Example of use:
 
  +
----------------------
Only the N and Z bits of the CCR are affected by this instruction.
 
  +
MOVE #%1010101010101010,d0
---
 
  +
NEG.W d0
   
  +
The word %0101010101010101 is obtained in d0.
**Note to the reader:**
 
This translated text covers the `MOVE` to `EOR` instructions within the given excerpt. The French text provided was excessively long, and the translation cut off at the `EOR` instruction. As a result, not all instructions referenced in the original French text have been covered in this translation. If a continuation of the instructions from `EOR` to the end of the document is needed, please provide the relevant text in smaller segments.
 

Revision as of 11:50, 17 December 2023

                         -------------------------
                           CHAPTER  FOUR

                         THE 68000 INSTRUCTIONS

                         -------------------------



                     *** THE 68000 INSTRUCTIONS ***
                     ---------------------------------

- Here is a chapter that is entirely dedicated to the different
  68000 assembler instructions.

- Now that you know how to access data in memory thanks to addressing
  modes, we will look at the instructions that allow to modify, move...
  in other words to manipulate the data.

- For each instruction, I will give you:

  .The syntax for the instruction and its operands.
  .Its effects, its purpose.
  .The addressing modes allowed for the operands.
  .The effect of the instruction on the registers and notably on
   the CCR.
  .And of course some examples of use...

- New concepts will appear in the explanations concerning
  instructions, they will be detailed, explained and commented.



                           --------------------

                    *** THE 68000 INSTRUCTIONS ***
                    ---------------------------------


MOVE       source,destination   :(.B),[.W],(.L)

All three operation sizes are allowed for this instruction, with [.W] being the default size. The 'source' operand is copied (and remains unchanged) to (in) the 'destination' operand. The allowed addressing modes for the source operand are:
dn (data registers) an (address registers) BBBB BB #BBB (an) (an)+ -(an) d(an) d(an,rn) d(pc) d(pc,rn) The allowed addressing modes for the destination operand are:
dn an BBBB BB (an) (an)+ -(an) d(an) d(an,rn) Only the N and Z Bits of the CCR are affected. Example of use:
Move.l #1456701,d0 The L-M equal to 1256701 is placed in the data register d0. MOVEQ #D,dn
The source operand is an immediate, signed data contained in an octet (-128<= D <128). The destination operand is a data register. The source data, signed and contained in an octet, is copied into a data register with SIGN EXTENSION of the register: Meaning that the data is placed in the least significant byte of the Dn register and the MSB is extended (copied) up to the 31st bit of the register, so that the data register is fully affected by the 'data loading' and the sign of the data is preserved. The source operand therefore allows the addressing mode:
#BBB ( -128<= BBB <128 ) The destination operand is a data register.
Only the N and Z Bits of the CCR are affected by this instruction. --- Example:
MOVEQ #%01100101,d0 The octet 01100101 is placed in d0: d0= : 00000000000000000000000001100101 Bit nr 31 . . . MSB (0) <---------------MSB (0) There has been sign extension of d0 (here MSB=0 because 01100101>0) NB: Moveq is distinguished from Move by greater speed, but -- remember the conditions of use of Moveq! MOVEA source,an  :(.W),(.L)
The Movea instruction complements the Move instruction as it accepts an Address Register for the destination operand. On most assemblers, the syntax MOVE source,an is accepted and automatically translated to MOVEA source,an. If the source operand uses the .W operation size, there is sign extension of the address register an. The .B size is not allowed for MOVEA. The allowed addressing modes for the source operand are:
dn an BBBB BB #BBB (an) (an)+ -(an) d(an) d(an,rn) d(pc) d(pc,rn) The destination operand is an address register
The MOVEA instruction does not affect the CCR. --- Example of use:
MOVEA.L #etiq,a5 The address register a5 is loaded with the address pointed to by the label 'etiq'. LEA source,an  : [.L]
This instruction reads: 'Load Effective Address' Only the .L operation size is possible, and is the default. It allows for placing the address pointed to by the source operand into an address register. The source operand allows the addressing modes:
BBBB BB (an) d(an) d(an,rn) d(pc) d(pc,rn) The destination operand is an address register
------------------ The LEA instruction does not influence the CCR. --- Example of use:
LEA etiq,a2 The address pointed to by the label 'etiq' is placed in the address register a2. In fact, this can also be done with MOVE.L #etiq,a2, but it is less fast. CLR destination  :(.B),[.W],(.L)
This instruction reads: 'CLeaR destination' And allows for setting all bits of the destination operand to 0. All three operation sizes are possible. The allowed addressing modes for the destination operand are:
dn BBBB BB (an) (an)+ -(an) d(an) d(an,rn) The Z bit of the CCR is set to 1, the N, V, C bits to 0. --- Example of use:
CLR.W D0 The 16 bits of the least significant word of d0 are set to 0. NEG destination  : (.B),[.W],(.L)
Allows for performing the NEGation of the destination operand. All three operation sizes are possible. The destination operand is subtracted from 0, which has the effect of changing the sign of the operand: Bits that were active are turned off and bits that were off are activated. The destination operand allows the following addressing modes:
dn BBBB BB (an) (an)+ -(an) d(an) d(an,rn) All Bits of the CCR are affected by the NEGation depending on the result obtained. --- Example of use:
MOVE #%1010101010101010,d0 NEG.W d0 The word %0101010101010101 is obtained in d0.