Motorola M68000 Betriebsanweisung Seite 81

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 256
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 80
Conditional and Arithmetic Instructions 67
referencing an address register. However, only word and longword forms
of the instruction can be used with an address register. The following
instruction would increment the value of memory location COUNT:
ADDQ.W #1,COUNT COUNT IS A WORD
At first it may seem that these instructions are identical to the ADDI
and SUBI instructions. In order to understand why the ADDQ and SUBQ
instructions are better, we have to delve into the actual machine instruc
tions generated when these mnemonics are used. The ADDI and SUBI
instructions will generate a 16-bit opcode word and one or two additional
16-bit values corresponding to the immediate operand. With the ADDQ
and SUBQ instructions, only the 16-bit opcode word is generated. This
results not only in a savings in memory locations but also in a significant
increase in speed because the programmer doesnt have to perform the
memory fetch to obtain the immediate data. In the case of the ADDQ
and SUBQ instructions, this data is contained in the 16-bit opcode word.
Along a similar line, a special MOVE instruction, MOVEQ, is pro
vided. This instruction allows an immediate source operand that must be
represented in 8 bits or less, giving a signed range between128 and
+127, or an unsigned range between 0 and 255. The destination is always
a data register, and the full 32 bits are used. This instruction is only avail
able in the longword form. It should be used whenever possible, since
the number of bytes required will be less than the corresponding MOVE
instruction. For example,
MOVEQ #100,DO
is preferable to
MOVE.L #100,DO
Many assemblers will automatically use the MOVEQ version whenever
possible, even if it hasnt been specified.
The 68000 provides many instructions that can be functionally dupli
cated by other instructions. When a programmer uses the more appro
priate instructions, programs are more readable and take up less space
in memory. This latter consideration is important for large programs, or
when you only a small amount of memory is available. We will make ex
tensive use of the ADDQ and SUBQ instructions for a variety of purposes
throughout this book.
Seitenansicht 80
1 2 ... 76 77 78 79 80 81 82 83 84 85 86 ... 255 256

Kommentare zu diesen Handbüchern

Keine Kommentare