Page 1 of 1

The display file (DFILE or D-FILE) in RAM

Posted: Sat Mar 08, 2025 4:39 pm
by 1024MAK
In a ZX81 that has been expanded:
Question on where and when the display file (DFILE or D-FILE) may cause problems if you have more than 16K bytes of RAM (for example with 32K, 48K or 64K of RAM).

The below taken from a Memotech manual for one of their Memopak RAM expansions.
Memotech wrote:
What is where?

As programs are entered into the system the elements are sifted into the instruction file and the array file. The instruction file, the display file (holding screen data) and the array file lie next to each other in that order
at the bottom end of memory.

Gradually, as the instruction file increases, the other files are pushed up through memory. Remember, the original K of RAM in the ZX81 (located at 16K) has been disabled and all its functions take place in the MEMOPAK.

This pushing goes on until either the array file reaches the top of the memory or until the display file begins to straddle the 32K mark (by going above 32767).

Naturally, this last situation won't occur if you've only got 16K of RAM.

Does this mean if I've got 32K or more of RAM, I still can't have more than 15K or so of instructions?

No. Many people think you are restricted but there is a neat trick where you can force your display file to leap the 32K mark in one bound by putting in a large, dummy instruction. The important thing is to make sure that the display
file never straddles the 32K mark. Here is how:

a) On input check from time to time the value in the VARS system variable, as this lies just above the end of the display file:
PRINT PEEK 16401 * 256 + PEEK 16400

b) When the values of VARS approaches 32767, enter a huge line into the program, like:
LET ZERO = 0 + 0 + 0 + 0 etc.
with about 100 repetitions of [+0].
This will push the display file entirely above 32768.

c) Check the system variable D-FILE to make sure the display file now begins above 32768:
PRINT PEEK 16397 * 256 + PEEK 16396
if it is, then you can carry on programming.
Mark

Re: The display file (DFILE or D-FILE) in RAM

Posted: Sat Mar 08, 2025 4:52 pm
by Moggy
Thanks for conformation Mark I knew I'd seen it somewhere before.