Pl INSTRUC.DOC

From Atari Wiki
Revision as of 10:42, 17 December 2023 by Olivier.jan (talk | contribs)
Jump to navigation Jump to search
                         -------------------------
                           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)
   -----------------------------
   The 3 operation sizes are allowed for this instruction,
   size [.W] is taken by default.

   The 'source' operand is copied (and remains unchanged) to (into)
   the 'destination' operand.

   The addressing modes allowed 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 addressing modes allowed for the 'destination' operand are:
                                                   -----------
     dn
     an
     BBBB
     BB
     (an)
     (an)+
     -(an)
     d(an)
     d(an,rn)


   At the CCR level: Only the N and Z bits are affected
                ---


   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 a byte (-128<= D <128)
   The destination operand is a data register

   The source data, a signed byte, is copied into a data
   register after SIGN EXTENSION OF THE REGISTER:
   
      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:
              ------
   #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 byte 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 being faster, but
   -- remember the conditions for using Moveq!



   MOVEA      source,an   :(.W),(.L)
   --------------------
   The MOVEA instruction completes 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 operand size, there is
   sign extension of the address register an.
   The .B size is not allowed for MOVEA.


   The addressing modes allowed 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    #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'

   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!



   AND  source,dn       (.B),[.W],(.L)
   --------------
   or 

   AND  dn,destination  (.B),[.W],(.L)
   -------------------
  
   Allows to perform a logical AND between its two operands.   

   That is, the 2 operands coded in Binary are added together following a
   rule such that:

   1+1 gives 1
   1+0 gives 0
   0+0 gives 0
   0+1 gives 0

   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

   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)

   For the second form of AND, the addressing modes allowed for the
   operand 'destination' are:
               -----------
     dn
     an
     BBBB
     BB
     (an)
     (an)+
     -(an)
     d(an)
     d(an,rn)

    
    Only the N and Z bits of the CCR are affected by this instruction.
                             ---                             


   OR   source,dn       (.B),[.W],(.L)
   --------------
   or 

   OR   dn,destination  (.B),[.W],(.L)
   -------------------
  
   Allows to perform a logical OR between its two operands.   

   That is, the 2 operands coded in Binary are added together following a
   rule such that:

   1+1 gives 1
   1+0 gives 1
   0+1 gives 1
   0+0 gives 0

   And so for each bit of the 2 instruction operands.
   
   Example:  MOVE.B     #%11101011,d0;  %11101011
   -------   MOVE.B     #%10101000,d1;  %10101000
             OR.B       d0,d1         ;   ||||||||
                                         ||||||||
                                         '''
             the byte obtained:        %11101011

   For the first possible syntax of OR, 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)

   For the second form of OR, the addressing modes allowed for the
   operand 'destination' are:
               -----------
     dn
     an
     BBBB
     BB
     (an)
     (an)+
     -(an)
     d(an)
     d(an,rn)

    
    Only the N and Z bits of the CCR are affected by this instruction.
                             ---                             


   EOR  dn,destination  (.B),[.W],(.L)
   -------------------
  
   Allows to perform a logical EOR (exclusive OR) between its two
   operands.   

   That is, the 2 operands coded in Binary are added together following a
   rule such that:

   1+1 gives 0
   0+0 gives 0
   0+1 gives 1
   1+0 gives 1

   And so for each bit of the 2 instruction operands.
   
   Example:  MOVE.B     #%11101011,d0;  %11101011
   -------   MOVE.B     #%10101000,d1;  %10101000
             EOR.B      d0,d1        ;   ||||||||
                                         ||||||||
                                         '''
             the byte obtained:        %01000011


   The addressing modes allowed for the operand 'destination' are:
                                                    -----------
     dn
     an
     BBBB
     BB
     (an)
     (an)+
     -(an)
     d(an)
     d(an,rn)

    
    Only the N and Z bits of the CCR are affected by this instruction.
                             ---                             

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