MEMORY EXPANSION PROGRAM
by Toni Baker
from ZX Computing, April 1987

[This is an April Fool, so doesn't do anything useful.  JimG]


Toni Baker shows how to squeeze some extra
memory out of 16 and 48K Spectrums.


Once upon a time, when I was a lot younger than I am now, I was
privileged enough to own a calculator. It wasn't anything flash, you
understand, because calculators had only just come onto the market -
but it was good enough for me at the time. It did add and subtract,
multiply and divide. All very simple stuff, I grant you, but fun at
the time.

A friend of mine also had a calculator. This was a more expensive
version. It was made by the same company, but was the next one up in
the range. It had an extra column of buttons on the right, and was
coloured black instead of white. The extra buttons were things like
M+, M-, MR and so on - all memory functions, allowing you to store and
recall numbers and so on. Then, one day, while we were playing a
casual game of throwing- calculators- round- the- room (as children
do), the case of my prized calculator came apart, revealing a panel of
little rubber buttons on one half, and a grid of wires on the other
half. It became immediately apparent to me that pushing down one of
the rubber buttons would make contact between a vertical wire and a
horizontal wire, and hence register the key depression. It was then
that I noticed an inconsistency - there were more vertical wires than
there were columns of keys, giving an extra six possible contacts.


Surprise surprise!

Imagine my surprise when, with the case still open, I pressed on the
extra contacts to see what happened - only to find that they performed
the M+, M-, MR (etc) functions of the more expensive version. It
seemed that the internal hardware of the two calculators was
identical, but they were put into two different external cases so that
they could sell at two different prices for differing sections of the
market. I suppose it must have been cheaper for them to do that than
to produce two entirely different machines.

With that little anecdote in mind, we return to the present.
Calculators have long gone out of fashion - today, computers are [the]
in thing. I began to wonder, however, whether what was true of
calculators in the early days, might also be true of computers now.
Could it be possible that inside the various different boxes there was
basically one, and only one, type of Spectrum?

Literally speaking, of course, this cannot be true. The IN ports seem
to give different results for different issues of Spectrum, but the
central problem remains. It is not possible that the advanced features
of the Spectrum 128 (extra memory, full screen editor, and so on) are,
and have always been, available on the old 48K and 16K Spectrums?

It turns out that is in fact the case. Both 16K and 48K machines have
in fact already got 128K of RAM built in - though accessing it has not
been easy. On the Spectrum 128, outputting a byte to port 7FFD was
sufficient to page in the extra memory. On the 48K and 16K machines
this is not so.

It is possible, however, to devise a machine code program which will
give genuine access to the extra RAM and ROM memory. Such a program is
Included in this article. It is a BASIC program with the machine code
held in DATA statements. The BASIC program - essentially a machine
code loader - will POKE the machine code into memory and then, by
means of a USR statement, run the machine code itself. The last item
in each DATA statement is a checksum to ensure that the line has been
typed in correctly. If the checksum does not match with the rest of
the row then an error message is generated, indicating the line number
at which the DATA was incorrect.

Once the program has been typed in, with each DATA statement error
free, then the program may be RUN. There will be a short delay whilst
the machine code is loaded into memory, and then the computer will,
effectively, turn itself into a Spectrum 128, and will remain so until
the power is switched off.


Reset

The effect of running this program is equivalent to pressing the RESET
button on a normal Spectrum 128. The screen goes black with a white
border for a few seconds before you are presented with the main 128
menu. A cyan bar outlines the first item on the menu, TAPE LOADER.
Ignore this for the moment. Using the CURSOR DOWN function
(CAPS-SHIFT/6 if you don't have a Spectrum+ with a separate
CURSOR-DOWN key) move the cyan bar to the second item, 128 BASIC, and
your machine is every bit as good as the 128 itself.

I would like to stress at this point that the program will convert a
Spectrum to a Spectrum 128 by software means alone! This is important,
because it means that the guarantee is not invalidated!

Of course the main problem with converting a Spectrum by this means is
that it doesn't supply an instruction book. It is not within the scope
of this article to give detailed information on 128 BASIC, and
furthermore, neither Sinclair nor Amstrad will provide an instruction
book without supplying a computer as well. The only thing I can
suggest is that you find a friend who's got a Spectrum 128, and borrow
their instruction book. If you don't know anyone who owns a Spectrum
128 then it might be worth your while joining a local computer club.
Most of the extra memory in a Spectrum 128 is locked up in a software
data-storage system called silicon disc, or RAMdisc. It is worthwhile
getting hold of an instruction book, for the simple reason that
without it you won't know how to access the extra memory in 128 BASIC.


M/C

How the machine code program works is surprisingly simple. As has been
previously stated, an output to port 7FFD alone is not sufficient. The
Spectrum contains two new registers, which to my knowledge have never
been properly exploited. They are referred to as "Alternative
Programming Registers", and it is the first of these (APR1 for short)
which discriminates between the various different hardware models of
the Spectrum. Access to the chip is by a complex sequence of OUT
instructions. This sequence is performed automatically by all
Spectrums whenever the machine is either switched on or reset, so that
the machine knows what kind of Spectrum it's supposed to be.

I'll leave it to you now to actually load in the program and try it
out. Good luck, and I'll see you again next month.
