Motorola M68000 Uživatelská příručka Strana 76

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 256
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 75
62 Assembly Language Programming for the 68000 Family
MOVE.L #10,DO
NEXT: JSR OUTDEC
JSR NEWLINE
SUB.L #1,D0
BNE NEXT
The programmer may also want to determine if an arithmetic opera
tion results in a positive or a negative value. The negative bit (N) will be
set to a binary 1 for all negative numbers (note that zero is always a pos
itive number in two’s complement). The negative bit is set to the same
value as the sign bit of the result of the operation. The BMI (branch on
minus) and BPL (branch on plus) instructions will test for negative and
positive numbers respectively.
The MOVE instruction always sets the negative and zero bits in the
CCR just as the arithmetic instructions do. However, the programmer
sometimes desires to determine if a value is zero or negative, but hasnt
moved it or used it in arithmetic. A special instruction, TST, is provided
for just such a purpose. The general form is
TST[.<size>] <ea>
The following instructions test register D5 and memory location COUNT.
TST.L D5
TST.L COUNT
Of course, the TST instruction must be followed with an appropriate
conditional branch.
The Extend Bit
The extend bit (X) is normally a copy of the carry bit. It is used for
performing multiple precision arithmetic, which will be covered in detail
in Chapter 11. However, you should be aware that some instructions do
not affect the extend bit. The most notable of these instructions is the
MOVE instruction. MOVE conditionally sets or clears N and Z, clears V
and C, but doesnt change the current value of X. You wont be using the
extend bit at this time, so this fact shouldnt cause concern.
Com parisons
An essential task in any programming language is the comparison of
two numbers, or any data items that are being represented by numerical
Zobrazit stránku 75
1 2 ... 71 72 73 74 75 76 77 78 79 80 81 ... 255 256

Komentáře k této Příručce

Žádné komentáře