Most BASICs (but not ZX81 BASIC) have READ, DATA and RESTORE statements. Here’s a way to accomplish their equivalent on your ZX81:
DATA information is entered as a string variable. For example, if you want the integers 123, 446, 78, 1, and 896, enter the string variable A$=”123446078001896″. Note that 78 is entered as 078 and 1 as 001 to keep the same number of digits as the other entries.
RESTORE is entered as a subroutine:
100 LET N=1
110 RETURN
The first time you want to use the data list, call this subroutine. READ is entered as another subroutine:
120 LET Z=(VAL(A$(N)))*100+VAL(A$(N+1))*10+VAL(A$(N+2))
130 LET N=N+3
140 RETURN
Use the instruction following your GOSUB 120 instruction to set your desired variable equal to Z.
If the data list contains decimal data, enter the information in the string variable as integer digits and modify subroutine line 120 as follows:
120 LET Z=(VAL (A$(N)))*10+VAL (A$(N+1))+(VAL (A$(N+2)))*.1
To save an instruction, you could combine the two subroutines:
100 LET N=1
120 LET Z=(VAL (A$(N)))*100+VAL (A$(N+1))*10+VAL (A$(N))
130 LET N=N+1
140 RETURN