BASIC stamp manual v2.2

DATA – BASIC Stamp Command Reference
Page 158 BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com
Text4 DATA CLS, "This program also demonstrates retrieving data "
DATA "out of order ", CR, "in relation to the way it is "
DATA "stored in EEPROM. Additionally,", CR, "control codes "
DATA "(like carriage-returns, clear-screens, etc) can ", CR
DATA "be embedded right in the data, as it is here. ", CR
DATA CR, 0
Text2 DATA "This is an example of a good way to save space in "
DATA "your ", CR, "BASIC Stamp's program by storing data "
DATA "into EEPROM and ", CR, "retrieving it, one byte at a "
DATA "time, and transmitting it ", CR, "with just a single "
DATA "DEBUG (or SEROUT) command.", CR, CR, 0
Text5 DATA "The Print_It routine simply takes the idx variable, "
DATA "retrieves", CR, "the character at the EEPROM location "
DATA "pointed to by it, and ", CR, "prints it to the screen "
DATA "until it finds a byte with a value of 0.", CR, CR, 0
Main:
DEBUG CLS ' Clear DEBUG window
FOR phrase = 1 TO 6 ' Print blocks one by one
LOOKUP (phrase - 1),
[Text1, Text2, Text3, Text4, Text5, Text6], idx
GOSUB Print_It
PAUSE 5000 ' Pause for 5 seconds
NEXT
END
Print_It:
DO
READ idx, char ' Get next character
idx = idx + 1 ' Point to next location
IF (char = 0) THEN EXIT ' If 0, we're done with block
DEBUG char ' Otherwise, transmit it
LOOP
RETURN ' Return to the main routine