122-32000 Parallax Inc, 122-32000 Datasheet - Page 279

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Object Address Plus Symbol ‘
The Object Address Plus Symbol operator returns the value of the symbol following it plus
the current object’s program base address. Object Address Plus Symbol can only be used in
variable expressions.
This operator is useful when creating a table of offset addresses, then at run time, using those
offsets to reference the absolute run-time addresses they represent. For example, a
may contain a number of strings to which you want both direct and indirect access. Here’s an
example
DAT
At run time we can access those strings directly, using
them indirectly is troublesome because each string is of a different length; making it difficult
to use any of them as a base for indirect address calculations.
The solution might seem to be within reach by simply making another table of the addresses
themselves, as in:
DAT
This creates a table of words, starting
unique string. Unfortunately, for compile-time constants (like those of the
address returned by
absolute address, of the symbol. To get the true, run-time address, we need to add the
object’s program base address to the symbol’s offset address. That is what the Object
Address Plus Symbol operator does. Example:
REPEAT Idx FROM 0 TO 2
The above example increments
the compile-time offset of the string stored in element
operator in front of the
compile-time offset value that was retrieved, resulting in a valid run-time address of the
string. The
to process each character of the string.
Str1 byte "Hello.", 0
Str2 byte "This is an example", 0
Str3 byte "of strings in a DAT block.",0
StrAddr word @Str1, @Str2, @Str3
PrintStr(@@StrAddr[Idx])
DAT
PrintStr
block containing strings.
@
method, whose code is not shown in this example, can use that address
is only the compile-time offset address, rather than the run-time
StrAddr[Idx]
Idx
@@
from 0 through 2. The
at StrAddr
statement adds the object’s base address to the
, where each word contains the address of a
@Str1
Idx
StrAddr[Idx]
,
@Str2
of the
Propeller Manual v1.0 · Page 279
, and
StrAddr
@Str3
statement retrieves
StrAddr
table. The
, but accessing
table), the
DAT
block
@@

Related parts for 122-32000