Recent Post

Condition Code flags of 68000

N(Negative):Set to 1 if the result is negative; otherwise , cleared to 0

Z(Zero): Set to 1 if the result is zero; otherwise , cleared to 0

V(Overflow): Set to 1 if arithmetic overflow occurs ; otherwise , cleared to 0

C(Carry): Set to 1 if a carry-out results from the operation; otherwise , cleared to 0

X(Extend): It is set in the same way as the C flag, but is not affected by as many instructions.

               Mnemonic Name
Displacement Size
Operation Performed
PC  [PC]+disp
          Bcc(Branch Conditionally)
If cc is true, then
PC  [PC]+disp
            BSR(Branch to subroutine)
SP      [SP]-4;
[SP]      [PC];
PC       [PC]+disp
       DBcc(Decrement & Branch Conditionally)
If cc is false, then
Dn      [Dn]-1;
If [dn]=! -1, then
PC  [PC]+disp

 Logic Instructions:

The 68000 has several logic instructions that performs logical AND, OR, and XOR operations as well as instructions that shift and rotate operands in several different ways.

Consider an example, suppose that register D1 contains some 32-bit binary pattern, and we want to determine if the pattern in bit positions b18 through b14 is 11001. This can be done using the instruction          AND.L   #$7C000, D1

                                                 CMPI.L  #$64000, D1

                                                 BEQ       YES
The first instruction performs the logical AND of individual bits of the source and destination operands, leaving the result in registers D1. The hex number 7C000 has ones in bit positions b18 through b14 and zeros elsewhere. Thus, as a result of the AND operation, the five bits in position b18 through b14in register D1 retain their original values and the remaining bits are cleared to 0. The subsequent Compare instruction tests whether these five bits correspond to the desired pattern.

No comments