
Addressing Modes 73
least one word of memory. If we have an immediate operand, this
immediate constant data is placed in one or two successive words of
memory, right along with the instruction—a byte or word constant takes up
a word of memory, while a longword constant takes up the next two words.
The data may be a numeric constant, a symbol, or an expression. Here
are some examples of valid immediate addresses:
MOVE.B #$FF,BDATA
ADDI.L I1000/D5
MAX: EQU 200
SUBI.W #MAX*3,COUNT
Note that ADDI and SUBI were used instead of ADD and SUB.
Absolute Addressing
This is the third addressing mode that you have already used. In order
to understand the operation of this addressing mode, you will first have
to recall the structure of memory. Remember that each byte of memory
has an associated address or location. These addresses start at zero and
continue up to the maximum size of allowable memory. A byte, word, or
longword can be stored in memory. Words or longwords must be located
at even-numbered memory addresses. So, we can specify a particular
piece of data by its address in memory. There are actually two different
absolute addressing modes: absolute short and absolute long. The normal
one is absolute long. This allows a full 32-bit address to be specified.
When we want to directly access the contents of a location in memory,
we can use absolute addressing. The instruction
MOVE.B 5000rDO
moves the byte of data at location 500010 in memory into register DO. We
normally don’t use a numeric address, but a symbolic one.
MOVE.B DATA,DO
would be more common. Don’t get confused by the first example. This
not the same thing as immediate mode; without the # character it is taken
as absolute addressing. In the second example, the assembler substitutes
the correct value for the memory address of symbol DATA. For absolute
long addressing, the address is held in two words that follow the opcode
Commenti su questo manuale