Quantcast
Viewing latest article 1
Browse Latest Browse All 44

Why did BASIC programs tend to READ a redundant copy of DATA?

Take for example this BASIC version of ELIZA which starts out (in lines 50–170) by a number of READ loops which copy DATA (lines 1340 and following) into a handful of arrays.

Isn't this rather wasteful on an 8-bit computer with perhaps anywhere from 4KB to 48KB of RAM?

That is, first the program itself, including all its lines of DATA statements must be loaded into RAM. Then when the program runs it proceeds to DIMadditional RAM and READ it into a separate "working copy".

Now I suppose if that "working copy" needed to be modified, this data duplication would be useful to get a fresh copy that reset to its initial values on each RUN. But what inspired implementers of the various BASICs to build in a DATA/READ feature instead of some RAM-friendlier mechanism like a syntax for defining read-only arrays?

Alternatively, why wasn't it particularly common for programmers to assign array items directly — as this Apple 1 port of ELIZA (archive link) does — to leave more RAM free?


Viewing latest article 1
Browse Latest Browse All 44

Trending Articles