Motorola M68000 Betriebsanweisung Seite 72

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 256
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 71
58 Assembly Language Programming for the 68000 Family
way as the other registers. We dont treat the contents of the CCR as a
numeric quantity. Instead, we indirectly use the values of individual bits
in the CCR. Each of these special bits, or condition codes, has a specific
meaning when set or reset. If a bit is set it has a value of binary 1. If it is
reset it has a value of binary 0. The CCR is an 8-bit register, but not all
of the 8 bits are used. It is organized as follows:
CONDITION CODE REGISTER
7 4 0
X(extend) Transparent to data movement. When affected, it is set the
same as the C bit.
N (negative) Set if the most significant bit of the result is set. Cleared
otherwise.
Z(zero) Set if the result equals zero. Cleared otherwise.
V(overflow) Set if there was an arithmetic overflow. Cleared otherwise.
C(carry) Set if a carry is generated out of the most significant bit of
the operands for an addition. Also set if a borrow is
generated in a subtraction. Cleared otherwise.
After the execution of a 68000 instruction, some of the condition codes
may be affected. Not all instructions affect the CCR. The majority of
CCR usage is related to arithmetic operations such as addition, subtrac
tion, and the comparison of two numeric quantities.
The representation of numbers in two’s complement binary was dis
cussed in Chapter 1. Recall that numbers can be interpreted as signed or
unsigned depending on the interpretation of the most significant bit. This
bit is referred to as the sign bit for signed numbers. Many times we will
desire to treat a number as a positive value only. By allowing the use of
the most significant bit as a normal bit of the number, and not a sign,
we can double the magnitude of the numbers that can be represented.
The ADD and SUB instructions operate identically for both signed and
unsigned numbers. The interpretation is up to the programmer. How
ever, by the use of particular bits in the CCR we can test the outcome
of arithmetic operations for both signed
and unsigned numbers.
The Carry Bit
One of the most important checks that must be made on an arithmetic
operation is whether or not the result has exceeded the size of the
Seitenansicht 71
1 2 ... 67 68 69 70 71 72 73 74 75 76 77 ... 255 256

Kommentare zu diesen Handbüchern

Keine Kommentare