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

  • 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 92
Addressing Modes 79
the second string is the same length as the first. If it is not, then the first
string would be a substring of the second and the two are therefore not
identical. If the second string were a substring of the first, the CMPM.B
instruction would fail. I will leave it as an exercise to rewrite this program
to allow matching substrings.
Address Register Indirect With Predecrem ent
This addressing mode is very similar to address register indirect with
postincrement. Its general form is (An). Notice that the minus sign must
precede the register number. There are two major differences. First, the
value in the specified address register is decremented by the data size
rather than incremented. The other difference is in when this decrementing
takes place. With address register indirect with postincrement, the address
register was incremented after the effective address was computed. With
address register indirect with predecrement, the decrementing takes place
before the effective address is computed.
At first, you might be tempted to think of this addressing mode as a
way to access memory in decreasing address order. You might want to
move a chunk of memory starting with the highest memory location. This
can be done with some care. You have to remember that predecrementing
will occur. This means that the initial address value you place in the
address register will not be the address of the first piece of data. It will
be off by data-size bytes. You can certainly take this into consideration by
adjusting the value in the address register. This can be done in two ways.
You can generate a label that is on the next higher memory location:
DS.W 100 WORD ARRAY
BLOCK s EQU *
The asterisk is used to obtain the current value of the assemblers location
counter. In this case, its value will be equal to the memory location
immediately following the last word of the data. You would then be
able to access this array in reverse order with the following instructions:
LEA BLOCK,AO
MOVE.W -(AO),DO GETS DATA ELEMENT INTO DO
The other method would involve placing a pointer to the last data element
in the address register and then adjusting it before use. Here is how you
would do it:
Zobrazit stránku 92
1 2 ... 88 89 90 91 92 93 94 95 96 97 98 ... 255 256

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

Žádné komentáře