2
e
Table 5.64: PUT Quick Facts.
U
S
P
RAM.
SES FOR
CRATCH
AD
S
P
RAM
CRATCH
AD
LOCATIONS AND
.
THEIR PURPOSE
5: BASIC Stamp Command Reference – PUT
PUT
2
2
PUT Location, Value
sx
p
Function
Put Value into Scratch Pad RAM Location.
• Location is a variable/constant/expression (0 – 63: BS2e/BS2sx, 0 -
127: BS2p) that specifies the Scratch Pad RAM location to write to.
• Value is a variable/constant/expression (0 - 255) to store in RAM.
Quick Facts
Scratch Pad RAM
size and
organization
General-purpose
locations
Special use
location
Explanation
The PUT command writes a byte-sized value into the specified Scratch
Pad RAM location. All values in the general-purpose locations can be
written to from within any of the 8 program slots.
Scratch Pad RAM is useful for passing data to programs in other program
slots and for additional workspace. It is different than regular RAM in
that symbol names cannot be assigned directly to locations and each
location is always configured as a byte only. The following code will write
the value 100 to location 25, read it back out with GET, and display it:
Temp
VAR
PUT 25, 100
GET 25, Temp
DEBUG DEC Temp
Most Scratch Pad RAM locations are available for general use. The highest
location (63 for BS2e/BS2sx and 127 for BS2p) is a special, read-only,
location that always contains the number of the currently running
program slot. On the BS2p, the upper nibble of location 127 also contains
BS1
BS2
BS2e BS2sx BS2p
BS2e, BS2sx
64 bytes (0 – 63). Organized
as bytes only.
0 – 62
Current program slot number in
read-only location 63.
BYTE
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 245
BS2p
128 bytes (0 – 127). Organized as
bytes only.
0 – 126
Current program slot number in
lowest nibble of read-only location
127. Current read/write slot number
in highest nibble of location 127.
Need help?
Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?