BP BASIC have commands READ and DATA to work with sequences of numbers. It doesn't have command RESTORE to set reading to certain point. This is a bug from my point of view.
BP BASIC documentation is not good and I have to experiment to find details about commands. I have found that when all data are read with READ command, reading starts from the start. That is not bad but it is an ERROR in other BASIC implementations (error like OUT OF DATA).
Statements READ and DATA could be used to generate sequence of pulses with different length. In the case that two different patterns has to be combined, RESTORE command is useful; like to have two subroutines to generate two different patterns.
I have simpler example to demonstrate how DATA sequence is read in the loop:
HiZ(BASIC)>list
10 FOR I=1 TO 20
20 READ A
30 PRINT I;" ";A
40 NEXT I
50 DATA 2,3,5,7,9,11
60 DATA 13,17,19
65535 END
62 bytes.
Ready
HiZ(BASIC)>run
1 2
2 3
3 5
4 7
5 9
6 11
7 13
8 17
9 19
10 2
11 3
12 5
13 7
14 9
15 11
16 13
17 17
18 19
19 2
20 3
Ready
HiZ(BASIC)>
Example of program that uses RESTORE (that is not supported and escaped with REM):
10 REM RESTORE 300
20 GOSUB 200
30 FOR I=1 TO 5
40 REM RESTORE 400
50 GOSUB 200
60 NEXT I
70 REM RESTORE 300
80 GOSUB 200
90 REM RESTORE 300
100 GOSUB 200
110 END
200 READ A
210 IF A=9999 THEN RETURN
220 PRINT A
230 GOTO 200
300 DATA 1,2,4,8,9999
400 DATA 9,3,1,9999
My BusPirate is from eBay, small cute box with two LEDs.
BP BASIC have commands
READ
andDATA
to work with sequences of numbers. It doesn't have commandRESTORE
to set reading to certain point. This is a bug from my point of view.BP BASIC documentation is not good and I have to experiment to find details about commands. I have found that when all data are read with
READ
command, reading starts from the start. That is not bad but it is an ERROR in other BASIC implementations (error like OUT OF DATA).Statements
READ
andDATA
could be used to generate sequence of pulses with different length. In the case that two different patterns has to be combined,RESTORE
command is useful; like to have two subroutines to generate two different patterns.I have simpler example to demonstrate how DATA sequence is read in the loop:
Example of program that uses RESTORE (that is not supported and escaped with REM):
My BusPirate is from eBay, small cute box with two LEDs.