Overcoming the DATA statement in BASIC

Apple I

Ok, here's an old question that was asked years ago to the Apple 1 owners club members. I thought I'd answer this question.

How do you rewrite the BASIC program when you are using the DATA and READ command.

Answer: Easy, PEEK & POKE

Example
10 DATA 1,2,3,4,5,6,7,8,9
20 FOR I=1 TO 9
30 READ A(I):NEXT I

The fix:

In the monitor:

300:01 02 03 04 05 06 07 08 09

From BASIC:

10 Z=0:FOR I=1 TO 9
20 A(I)=PEEK(768+Z):Z=Z+1:NEXT I

You could even eliminate the Z and use I but I wanted to point out the easier way to show.

Hope this helps people converting BASIC programs.

Vince

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
iceandfire's picture

Data Statement

Boy that answer took a long time getting to me. About 28 years! I wrote that question for the Apple I Owners Club newsletter back in 1978, and this is the first time I've seen the correct response to it. Vince is the winner. The only prize, though is a harty handshake and an attaboy!:-)

Larry