I have been making a bit of progress and the program now runs through all files without a problem, but I had to make a couple of modifications to the original program. There was en error in line 350 and line 450 needed an amendment. Here is the full program listing:
100 REM Adventure File 1
110 PRINT@5,19:"Adventure"
120 FIND@5:1
130 FOR J=1 TO 131
140 INPUT@5:A,B
150 NEXT J
160 PRINT "File 1 total: ", J-1, "pairs of numbers read"
200 REM Adventure File 2
220 FIND@5:2
230 FOR J=1 TO 114
240 INPUT@5:A$
250 INPUT@5:B
260 NEXT J
270 PRINT "File 2 total: ", J-1, "string/number pairs read"
300 REM Adventure file 3
320 FIND@5:3
310 REM Note empty var before comma = 6 vars
330 DIM K0(5)
340 FOR J=1 TO 228
350 INPUT@5:K0
360 NEXT J
370 PRINT "File 3 total: ",J-1, "groups of 5 numbers read"
400 REM Adventure file 4
410 T = 0
415 X = 0
417 Y = 0
418 Z = 0
420 FIND@5:4
430 FOR J=1 TO 38
440 INPUT@5:A$
450 NEXT J
460 X = J - 1
470 PRINT "File 4 sub-total: ", X, "statements read"
480 FOR J = 39 TO 76
490 INPUT@5:A
500 Y = Y + 1
510 NEXT J
520 PRINT "File 4 sub-total: ", Y, "numbers read"
530 FOR J = 77 TO 114
540 INPUT@5:A$
550 Z = Z + 1
560 NEXT J
570 PRINT "File 4 sub-total: ", Z, "items read"
580 T = X + Y + Z
590 PRINT "File 4 total: ", T, "lines read"
600 END
Naturally a bit more tweaking was required to the emulator code.
I also wanted to check something. This is an excerpt from file 3 of the adventure program:
,2,2,5,5,3
,3,8,8,0,0
,3,3,6,6,1
,1,4,4,0,0
,5,5,1,1,4
,4,2,2,0,0
,3,3,2,2,8
,8,5,5,0,0
,1,1,6,6,4
,4,3,3,0,0
Why does INPUT still treat this as 5 variables, not 6? Wouldn't the preceding comma imply a null variable in the first position? Setting K0 to 5 elements works, but setting it to 6 fails.
I have pushed up the updated code.