A 0 REM Generator

Developer(s): Rene Bruneau
Date: 1992
Type: Program
Platform(s): ZX81, TS 1000

Creates a REM line 0 of any length at the top of the program, to hold machine code. The 54-byte relocatable routine takes the length from SEED, so you set it with RAND: RAND 20 then LET L=USR (address) makes 0 REM with 20 characters. Rene Bruneau modified a routine from Your Computer and added an installer that copies the code to any address you give.

In the article you type a hex loader (RUN 100) and the bytes, then delete the loader; the download is that finished program, with the code already in the line 1 REM. RUN and give an address for the code; it must be outside the program area (the routine moves the program up), so lower RAMTOP first and put it above.

Published in Sinc-Link May-June 1992 (ZX81 Resources: A 0 REM Generator).

Related Articles

Reading through some old issues of Your Computer, I found this small machine code utility for creating REM statements of any length.

Image Gallery

Source Code

1 REM ---54 SPACES----
10 PRINT "ROUTINE ADDRESS"
20 INPUT ADD
30 FAST
40 FOR X=0 TO 53
50 POKE ADD+X, PEEK (16514+X)
60 NEXT X
70 SLOW
80 STOP
100 LET X=16514
110 LET T=0
120 LET A$=""
130 IF A$="" THEN INPUT A$
140 IF A$="S" THEN PRINT "CHECK SUM = ";T,P
150 POKE X,16*CODE A$+CODE A$(2)-476
160 LET T=T+ PEEK X
170 IF PEEK 16442<=2 THEN SCROLL
180 PRINT X;" ";A$(1 TO 2)
190 LET X=X+1
200 LET A$=A$(3 TO)
210 GOTO 130

Listing 2 (machine code, hex):
16514   ED 4B 32 40 C5 21 06 00
16522   09 E5 C1 21 7D 40 CD 9E
16530   09 3E 76 EB 77 3E 17 C1
16538   C5 04 2B 77 0D 20 FB 05
16546   20 F8 2B 3E EA 77 D1 13
16554   13 7A 2B 77 7B 2B 77 3E
16562   00 2B 77 2B 77 C9

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.