Propeller Manual

Table Of Contents
LONG – Spin Language Reference
contains $44, $55, $99, $FF, 232 and 3, 0 and 0 since the data is stored in little-endian
format.
Note:
MyList could have been defined as word-aligned, long-sized data if the “byte
reference were replaced with “
word”.
This data is compiled into the object and resulting application as part of the executable code
section and may be accessed using the read/write form, syntax 3, of
LONG (see below). For
more information about using
LONG in this way, refer to the DAT section’sDeclaring
Data(Syntax 1) on page 100, and keep in mind that
LONG is used for the Size field in that
description.
Data items may be repeated by using the optional Count field. For example:
DAT
MyData long 640_000, $BB50[3]
The above example declares a long-aligned, long-sized data table, called MyData, consisting of
the following four values: 640000, $BB50, $BB50, $BB50. There were three occurrences of
$BB50 due to the
[3] in the declaration immediately after it.
Reading/Writing Longs of Main Memory (Syntax 3)
In
PUB and PRI blocks, syntax 3 of LONG is used to read or write long-sized values of main
memory. This is done by writing expressions that refer to main memory using the form:
long[BaseAddress][Offset]. Here’s an example.
PUB MemTest | Temp
Temp := LONG[@MyData][1] 'Read long value
long[@MyList][0] := Temp + $01234567 'Write long value
DAT
MyData long 640_000, $BB50 'Long-sized/aligned data
MyList byte long $FF995544, long 1_000 'Byte-sized/aligned
'long data
In this example, the DAT block (bottom of code) places its data in memory as shown in Figure
2-2. The first data element of
MyData is placed at memory address $18. The last data element
of
MyData is placed at memory address $1C, with the first element of MyList immediately
following it at $20. Note that the starting address ($18) is arbitrary and is likely to change as
the code is modified or the object itself is included in another application.
Page 130 · Propeller Manual v1.1