ST20-C1 STMICROELECTRONICS [STMicroelectronics], ST20-C1 Datasheet - Page 41

no-image

ST20-C1

Manufacturer Part Number
ST20-C1
Description
Instruction Set Reference Manual
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
4.5
The addressing instructions provide access to items in data structures using short
sequences of single byte instructions. These instructions are listed in Table 4.8.
4.5.1
The absolute address of a local work space location is loaded using the ldlp primary
instruction. ldlp 0 can be used to load the value in the Wptr.
The ldnlp primary instruction is provided to calculate the absolute address of a non-
local variable.
The meaning of local and non-local is described in section 4.2.
4.5.2
The address of a location in the program being executed can be obtained by the ldpi
operation as follows. The address of the location x bytes past the next instruction
(which is itself pointed to by the instruction pointer register) can be pushed onto the
evaluation stack by
For example, the address of a label L can be loaded by
where the label M is the address of the instruction that follows the ldpi instruction. First
the offset in bytes from M to L is loaded into Areg. The ldpi then uses this offset and
the value in the instruction pointer register (which will be the address of label M ) to
load the address of label L into Areg. This technique is useful for generating relocat-
able code. Breg and Creg are unaffected.
4.5.3
The wsub instruction interprets Areg as the address of the beginning of a vector of
word-sized data objects, and Breg as an index into that vector. After execution, Areg
holds the address of the indexed element, and Creg is popped into Breg, leaving
Areg rotated into Creg. The operation performed by wsub is to multiply the integer in
Breg by four and to add this to the address in Areg (without overflow checking).
ldlp n
ldnlp n
ldpi n
wsub
Mnemonic
Forming addresses
The address of a variable
The address of an instruction
ldc x; ldpi
M:
Arrays
ldc (L-M); ldpi
load local pointer
load non-local pointer
load pointer to instruction
word subscript
Table 4.8 Addressing instructions
Name
Load the value
Load the value
Load the value
Load the value
4 Using ST20-C1 instructions
Meaning
Wptr
Areg
Iptr
Areg
+ n.
+ 4
+ 4
+ 4.
n
n
Breg
.
.
.
41/205

Related parts for ST20-C1