79/317
4 - Architecture of the ST7 core
E6 23
This instruction takes two bytes of memory. The farthest address that can be reached is
1FEh
(
0FFh
+
0FFh
).
Caution: there must be no space on either side of the comma within the parenthesis. Example:
(23h, X)
is incorrect.
Indexed with long offset mode
This mode is similar to the indexed with short offset mode, but the offset is a 16-bit number
that takes two bytes. It allows any address to be reached within the whole addressing range.
Example: to access byte
64h
of a character string starting at
4523h
in data memory, we first
load the
X
index with the value
4523h
. Then, the instruction
LD A, (4523h,X)
A is loaded with the value of the RAM address memory pointed
to by the 16-bit sum of the specified 16-bit offset and the
contents of the chosen index register. The whole memory can be
reached.
loads the accumulator with the value stored in memory at address
4587h
(
4523h
+
64h
). The
coding of the instruction is (in hexadecimal):
D6 45 23
This instruction takes three bytes of memory. If the sum of
X
and the offset exceeds
0FFFFh
,
the effective address rolls over zero. For example, if
X
contains 83h and the offset is
FFC2h
, the
effective address will be
45h
.
Caution: there must be no space on either side of the comma within the parenthesis. Example:
(4523h, X)
is incorrect.
Relative direct mode
This addressing mode is only used in jump instructions. The opcode is followed by a byte that
represents the offset or the displacement of the destination of the jump, relative to the current
value of the Program Counter. This displacement is a 8-bit signed number, so that the range
of such a jump is limited to -128 to +127 from the instruction following the jump. This mode is
efficient in conditional jumps, since the pieces of code that correspond to opposite cases (test
was true or false) are often located close to each other. When longer conditional jumps are re-
quired, the solution is to do a relative jump to a location within the reach of a relative jump,
where an absolute jump is made to the final destination.
These short-range jumps are usually called branches to contrast with the jump instruction that
uses long addressing mode and that can jump anywhere in the addressing space. In the ST7,
they are called relative jumps.
Содержание ST7 Series
Страница 1: ...ST7 8 BIT MCU FAMILY USER GUIDE JANUARY 1999 1 ...
Страница 238: ...238 317 8 C Language and the C Compiler 08 Burn bmp Then use the EPROMer programmer software as described in Chapter 7 ...
Страница 289: ...289 317 10 Second Application a Sailing Computer 10 befor Bs Rw Vw VMG AlphaR AlphaV Before the wind ...