EasyManua.ls Logo

ST ST7 - Page 79

ST ST7
317 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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.

Table of Contents

Related product manuals