Now that our readers use both 4K and 8K ROMs, SYNTAX supports both sets of users. We’ll tell you how to overcome differences in the 2 designs. Here’s how to put ML at the same addresses in both.
With the 8K ROM, USR routines reside at high RAM addresses. You POKE the first address you want to use to locations 16388 & 16389 (p.168 of ZX81 manual). Use the following program to get equal space in 4K machines so SYNTAX ML programs will run at specified locations. Use of ROM routines and system variables or locations must change, but many routines work in either machine.
Answer the first prompt with the number of K of memory on your machine. Respond to the second prompt with the number of bytes you want reserved. Next load your BASIC program; it will be kept away from the ML area. (The usual program would aid loading ML, say a monitor.)
Your first user location will then be at 16382-N+(1024*K).
5 INPUT K
6 INPUT N
7 LET M=16384+(K*1024)-1-N-1
10 POKE 17152,33
20 POKE 17153,M-(M/256)*256
30 POKE 17154,M/256
40 POKE 17155,195
50 POKE 17156,107
60 POKE 17157,2
70 LET X=USR(17152)
Syntactic Sum= 11550,4K
Although this program sets aside space at the top of any size memory, we will publish programs assembled for 1K memories. To use our code directly, respond to the first prompt with 1.
You input your memory size and the space you want for USR routines. This BASIC program then loads HL with the address of a fake top of RAM and jumps to the INIT routine at 26BH, 619 dec (see ROM listing) after the computer would have set the memory top.