Here’s that article, promised in issue 1:3, to help get new 64K RAM owners off the ground.
Since the Z80 has 16 address lines, the number of possible address combinations is 2**16=65536 (or 64K, or 10000h; one greater than FFFFh, the highest address). If we look at the possible states of A14 and A15 (the most significant bits) the memory address range breaks down into four 16K “blocks.” If we also use A13, we have eight 8K blocks, and so on. But let’s just look at each 16K block and what each is used for in turn. Think of your RAM as a building with a basement and mezzanine, a main floor, and first and second stories.
The bottom 16K is split into the “basement” (0-8K = ROM) and the “mezzanine” (8-16K = user transparent RAM). The “basement” is of course not usable for your programming, but some RAMs decode this area to 8-16K to give you an “alternate mezzanine.” The “main floor” is where your entire BASIC system is normally at home. The two stories (32-48 and 48-64K) are much like the main floor, but there are restrictions. Before we look at these though, here are a few words on the ZX display.
The ZX81/ TS1000-1500 is an “interrupt-driven” machine, using the interrupts to switch between actual computing and generating the TV display. When the display is being created, the “second story” (48-64K) of addresses is used. Presumably to make the decoding simple, only the A15 bit is used internally, so the entire 32-64K range is off-limits to running machine-code. On many packs you can add the additional “Oliger mod” decoding to let you run machine-code in the “first floor”, but 48-64K is still tied up by the system hardware. This won’t work on all RAMs; it works with JLO’s (of course) and others, but NOT on Byte-Back’s UM64, nor on some “strange” packs like my little JRS 64.
The “mezzanine” is perhaps the nicest part of the house; you can run machine-code here, and it’s a great place to keep MC utilities. The party always congregates here, though, so it gets a little crowded; therefore you’ll have to plan it out before you start filling it.
You usually will run BASIC only in the “main floor,” but can push your BASIC instruction file up into the higher stories to allow up to 48K programs. Problems occur when part of the display file (riding on top of the program) is on the main floor and part on the first story; avoid this straddling during program entry by moving the DFILE up beyond the 32K mark in one step, in FAST mode, by entering or generating a huge REM statement (about 1K long) when you’re pushing the limit. After you’ve added enough of your own program, you can delete the dummy REM. A better way than typing REM xxxx (1000 times) is Memotech’s suggestion to enter PRINT 0+0+0.. (125 times) and make use of that extravagant floating point number storage. You can also run BASIC in the mezzanine or top stories by jimmying the “Next Line” system variable at 16425, but it’s a pain; and you can’t use GOTO/SUB inside such areas. (Thanks to Ray Kingsley for that one).
My favorite usage of the top stories is for storage of entire 16K programs; you can use block transfer routines located in the mezzanine to boot the whole 16K-32K range, SV’s and all, into whichever block, and later another similar routine zaps it back down about as fast as you can type RAND USR 8192. This is particularly handy when working with the 16K HOT-Z II. (I usually use it with BIG REM, useful for working with machine code written for the low-end of the BASIC area, but it’s not vital.) I then load the program being worked on in the 32-48K range, and use 48K-64K to store HOT Z, BIG REM and all, when it’s not being used (as when testing the program after changing and SAVEing back to tape, quitting HOT Z, and loading back the modified program).
A quick note about RAMTOP… 64K RAMs generally come with documentation that tells you to POKE it to 255/255. Well, you don’t have to do that unless you need a full 64K. I usually leave it at the 16K default value by omitting the POKEs; the machine now thinks it’s only 16K, but 32-64K is still available to PEEK/POKE or otherwise transfer (LDIR/LDDR) data. You might want to POKE it to 24K (0/160) to allow two 24K blocks, one for running and one for storage of a 24K program, or to 32K (0/192) so you can LOAD a 32K program while having a 16K program “in the wings.” Anything above RAMTOP is immune to NEW (and reset, provided RAMTOP is at or above 32767); so normally it will still be there even if you crash. (The exception is if you’ve modified your ROM to initialize all the way to 64K on reset; which is why I left mine as-is). Same holds true for the mezzanine (8-16K), regardless of whether or not the ROM initialization has been changed.