If you have programs which autoRUN after LOADing, and would like to examine or back up these programs, you have a problem: how to keep control of the machine. You need a LOAD that never RUNs.
To convince the ZX/TS machine not to RUN after LOADing, we CALL the LOAD routine in machine code. In normal operation, the operating system JPs (jumps) to the LOAD code: if we CALL, then after the LOAD it will return to our machine code calling routine. We can then JP to the STOP statement code, forcing the machine to STOP and give an error report.
You need to put the machine code LOAD routine out of the way in memory. If you store it in a REM statement, it will be wiped out when LOADing occurs. You can safely tuck this routine above RAMTOP or in an unused portion of a 64K RAM. To set RAMTOP, type:
POKE 16389,n
POKE 16388,235
NEW
Where n depends on your RAM size, one of the following:
RAM RAMTOP n
1K 17388 67
2K 18412 71
16K 32748 127
32K 49132 191
48K 65516 255
64K 65516 255
Now you’re ready to input the machine code routine. This routine sets up the LOAD filename to be “” and calls the LOAD routine, then jumps to the STOP routine:
Loc. Contents Mnemonics 00 2A 14 40 LD HL,(E_LINE) 03 22 16 40 LD (CH_ADD),HL 06 36 0B LD (HL),'"' 08 23 INC HL 09 36 0B LD (HL),'"' 0B 23 INC HL 0C 36 76 LD (HL),76 0E CD 40 03 CALL LOAD 11 C3 DC 0C JP STOP
To enter this program, set RAMTOP, then type in the BASIC listing and RUN it. Input each of these numbers, one at a time (reading left to right):
042 020 064 034 022 064 054 011 035 054 011 035 054 118 205 064 003 195 220 012
Now delete line 30 and save the program on tape.
To LOAD a program without autoRUNning it, first set RAMTOP and LOAD this routine. Use GOTO 10 to move the routine above RAMTOP, then use the USR call that this routine tells you to LOAD the tape you don’t want to autoRUN.
If all goes well, you should get an error report (STOP statement encountered) instead of having the program take off and RUN.
5 DIM D(20)
10 LET A=(PEEK 16389)*256+(PEEK 16388)
20 FOR X=1 TO 20
30 INPUT D(X)
40 POKE A+X,D(X)
50 NEXT X
60 PRINT "LOAD WITH RAND USR ";A+1
SYNTACTIC SUM: 7656, 8K ROM
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.