Qdatasheet_Logo
Integrated circuits, Transistor, Semiconductors Search and Datasheet PDF Download Site

ST20-C1 View Datasheet(PDF) - STMicroelectronics

Part Name
Description
MFG CO.
ST20-C1
ST-Microelectronics
STMicroelectronics ST-Microelectronics
'ST20-C1' PDF : 205 Pages View PDF
4 Using ST20-C1 instructions
4.5 Forming addresses
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.
Mnemonic
ldlp n
ldnlp n
ldpi n
wsub
Name
Meaning
load local pointer
Load the value Wptr + 4n.
load non-local pointer
Load the value Areg + 4n.
load pointer to instruction
Load the value Iptr + n.
word subscript
Load the value Areg + 4.Breg.
Table 4.8 Addressing instructions
4.5.1 The address of a variable
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 an instruction
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
ldc x; ldpi
For example, the address of a label L can be loaded by
ldc (L-M); ldpi
M:
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 Arrays
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).
41/205
®
Share Link: GO URL

All Rights Reserved © qdatasheet.com  [ Privacy Policy ] [ Contact Us ]