The DATA pointer may be altered at any time by an @ sign followed
by a new pointer value:
list
DATA
DATA has a few variations of use to allocate defined and undefined
data. Defined data is fully declared and known at compile time. Un-
defined data is the mere allocation of data space, while not assigning
values into the bytes of EEPROM (to be done at run-time, instead).
Defined and undefined data are declared as follows:
for defined data:
fee
DATA
fie
DATA
foe
DATA
for undefined data:
fum
DATA
abc
DATA
Important concept: Defined DATA and BASIC program memory are
always downloaded to the BS2. Undefined data and unused EEPROM
memory are not downloaded. This allows you to change programs
while keeping data, assuming both programs defined the same stretch
of memory as undefined DATA. Alt-M will show you maps of EEPROM
allocation. This download/don't-download rule is applied to 16-byte
blocks. If any byte within a 16-byte block is defined DATA or BASIC
program, that whole block is downloaded. Use Alt-M to see this.
In summary, DATA is used to define EEPROM byte usage that doesn't
conflict with the BASIC program storage:
• DATA can be preceeded by a symbol which will be assigned the
constant value of the current DATA pointer.
• Byte-size data is assumed, but 'word' can be used to break a word
into two bytes of storage.
• The @ sign is used to redirect the DATA pointer. If a symbol preceeds
Page 22 • BASIC Stamp II Manual 0.94 • Parallax, Inc. • (916) 624-8333
BASIC Stamp II
@$100,"some data"
0,1,2,3,4,5,6,7,8,9
word 1000
0 (256)
(1024)
word (16)
'actual bytes
'make two bytes: $E8 and $03
'256 bytes initialized as 0
'reserved 1K byte of undefined data
'reserve 16 words of undefined data
Need help?
Do you have a question about the BASIC Stamp II and is the answer not in the manual?