

FOOLPROOF MERGING ON YOUR ZX-81
by Nick Goldman
from Sinclair User 21 (December 1983), page 151

Following an article in our August issue, Nick Goldman explains a simple
machine code routine.

This version of my merger routine requires both programs to be recorded
previously on tape. The maximum length of each program is 8K and the routine
requires the user to have 16K of memory. All the line numbers of program one
must be greater than those of program two. The Merger routine is also held on
tape [with filename "MERGER"].

To use the Merger, type:
   POKE 16388,22 (N/L)
   POKE 16389,96 (N/L)
   NEW           (N/L)
   LOAD "MERGER" (N/L)
to load your already-prepared program and
   RUN           (N/L)
to initiate the routine.

Next, load program one from tape and add the line XXXX REM END, where XXXX is
a line number just big enough to make it the last line of program one then type:
   RAND USR 32634 (N/L)
   NEW            (N/L)

Then load program two into the ZX-81 and type:
   POKE 16507,PEEK 16396 (N/L)
   POKE 16508,PEEK 16397 (N/L)

To complete the process, add REM lines to the end of the program, each
containing 100 Xs. There should be 10 such lines for each 1K of program one
and they should be numbered consecutively, so that the last one is line 9999.
If you decide that two such lines are required, add:
   9998 REM XXXXXXXXXXXXX
   XXXXXXXXXXXXXXXXXXXX
   XXXXXXXXXXXXXXXXXXXX
   XXXXXXXXXXXXXXXXXXXX
   XXXXXXXXXXXXXXXXXXXX
   XXXXXXX
   9999 REM - 100 Xs, as line 9998.

Finally, type:
   RAND USR 32710 (N/L)
and tidy the resulting merged program by deleting any extra REM lines
remaining at the end of the process.


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =


