Motorola M68000 User's Guide Page 89

  • Download
  • Add to my manuals
  • Print
  • Page
    / 256
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 88
Addressing Modes 75
this memory address at program execution time, we could reference
data using this address value rather than a symbol. This is the essence
of address register indirect addressing.
To use this addressing mode, an address must be placed into one of
the address registers. An address used in this manner is often called a
pointer. If we assume that the address of our data is in register AO, we
can reference the data by specifying the operand as (AO). In other words,
all we do is put parenthesis around the register designator. The general
form of this addressing mode is (An). Let’s assume that a word of data
is at location $10000. If we place the value $10000 into register A0, we
can reference this data. The following instructions will move this data to
register DO:
MOVEA.L #$10000,A0
MOVE.W (A0),DO
In this case we used the MOVEA.L instruction to place the value $10000
into register A0. Note that we used a MOVEA.L and not a MOVEA.W for
this instruction. Even though we are going to obtain a word of data, an
address is always a 32-bit longword value.
It is rare that we know the actual memory address for a particular
piece of data. How, then, can we find the address of a location repre
sented only by a symbolic name? This is actually quite simple. There
are two methods we can use. The first method simply moves the ad
dress value in as an immediate value. The following program excerpt
will move the address of COUNT into A0 and then move the data value
at COUNT into register DO.
MOVEA.L #COUNT,AO
MOVE.W (A0),DO
COUNT: DC.W 1234
The second method is to use a special instruction specifically designed
for this purpose, the load effective address instruction, LEA. Its general
form is:
LEA <ea>,An
It has the advantage that it determines the effective address at execution
time and can therefore be used with a number of different addressing
modes. The above instructions would be rewritten as
LEA COUNT,A0
MOVE.W (A0),DO
Page view 88
1 2 ... 84 85 86 87 88 89 90 91 92 93 94 ... 255 256

Comments to this Manuals

No comments