Hello User,

We expect you are already getling lots of fun and use out of your Sinclair ZX81 
Computer (or your ZX80!).

We think this will grow with the addition of the MEMOPAK 32K, as you will now 
be dealing with much bigger programs and arrays. You're now in a position to 
compete with some of the much more expensive home, office and workshop computers 
on the market . And if you already have a 16K memory pack, you will now have a 
total of 48K RAM. See the back of this booklet for detaiis of how to use both 
of them together. We hope you like the elegant design. Now let's try to answer 
some of your queries.

How do I set up the MEMOPAK 32K?

Make sure your power supply is not connected to the ZX81 when you plug the pack 
into the back. You will find it plugs it firmly enough to be used safely, but 
to cut all wobble, you can use the three Velcro tabs as well .

Now you will have the ZX81 and the pack looking and acting like one unit. 
If you have the Sinclair printer, this will plug neatly into the back of the 
memory.
Now you can join up the power supply to your ZX81.

What should I do to use the new, larger memory area?

On powering up, a small K will appear in the bottom left hand corner of the 
screen. This means that your system is ready to go, but the computer is 
expecting to use only a maximum of 16K. So you'll probably want to 
tell the computer that more memory is present. On the other hand, you do not 
have to use all available memory (See Chapter 26 of the ZX81 handbook).

There is a memory location which you change in order to tell the computer the 
upper limit of your memory (or RAMTOP if you're into the jargon). This is 16389. 
To set top of RAM at 48K, type the following: 
POKE 16389, 192 (this is usually set at 128 for a 32K limit).
NEW (the memory is now cleared to start afresh; and will now be organised to 
     the new limit)
To check the current top of RAM, type 
PRINT PEEK 16389 and the value of 192 should appear in the top left-hand corner 
of the screen.
For a quick check that the memory is now at your finger tips you can now try 
the following little programs:

10 DIM A$(60,500) 
    or 
10 DIM A(6000) 
    or 
10 POKE 4800O, 128 
20 PRINT PEEK 48000

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 1K 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).

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 displayfile: 
   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.

How can I use the MEMOPAK 32K if I've got a white ZX80?

The MEMOPAK 32K drives the ROM directly - but with the ZX80 it can't do this 
unless you first carry out the following simple hardware modifications.

a) Break the connecting track between IC6-Pin 7 and IC2 Pin 20.
b) Put a 680 ohm resistor between IC6-Pin 7 (74LS157N) and IC2 Pin 20 (ROM).
c) Connect IC2-Pin 20 to the edge connector plug 23B (ROM C.S.) This is the 
   finger furthest away from the keyway slot and on the underside of the board.

We regret we cannot offer this service ourselves and we cannot accept 
responsibility for malfunction as a result of this modification such as screen 
glitches.

Have you any tips for running a full ZX81 system?
Yes. These are the hints buzzing around the users. They may or may not help in 
your situation. When connected to MEMOPAK 32K and printer, make sure that 
LOADing takes place with cassette recorder volume set at maximum. If possible 
make sure that your cassette recorder and ZX81 are plugged into different 
mains sockets. 
Maybe you shouldn't have the LOAD (EAR) and SAVE (MIKE) connectors plugged in at 
the same time. LOADing is more likely to be successful if you quote the filename,
rather than null ("") Always clean your connectors. Don't use the first 20 
seconds of a cassette tape as that's where a lot of LOAD bugs live.

Can I run programs written for a 16K pack with the MEMOPAK 32K?

Yes, they should run straight away, but things are a little tricky if you want 
to enlarge your arrays to use the larger memory and you have been SAVEing your 
data. Basically, you have to re-enter all data after you have redimensioned, to 
be sure that the right data is going to be accessed. What you can do is: 
a) Load the original program 
b) Edit in a special routine which will list and label the contents of all v
   ariables on the printer. 
c) Run this routine. You now have a hard copy of your data. 
d) Re-set your dimensions. Also enter a routine to allow you to re-lnput all your 
   old values plus any new ones. 
e) Run your program and enter the values.

It's probably quickest to start afresh! You may also encounter problems if you 
have been using machine code routines with the ZX81 alone.

A couple of program examples

BASIC strings are stored in the instruction area of RAM. This means that when 
you set a literal, say,	
   LET A$="CAT" 
the word CAT is actually duplicated, once as a literal as part of the instruction, 
and once in the variable areas A$. It would be more economic if we could set up 
an initialisation routine which would store all literals once only- in the 
variables area. This simple loop would let you input up to 10 strings of 
20 characters each:

10 DIM A$(10, 20)
20 INPUT K
30 IF K = 0 THEN GOTO 70
40 INPUT B$
50 LET A$(K) = B$
60 GOTO 20
............................
70 INPUT K
30 IF K=0 THEN GOTO 110
90 PRINT A$(K)
100 GOTO 70
...........................
110 REM AUTOMATIC SELF SAVE 
120 SAVE "SELF"
130 GOTO 20 
140 STOP 

Breakdown: 
Lines  20-60  Store strings 
Lines  70-100 Display strings 
Lines 110-140 Save program with string arrays

Now look carefully at the instructions from line 110. With increased array 
capacity in the memory you will probably want to store your data more permanently 
and it is possibte to save your arrays (and their contents) along with your 
program.

However, it's important that when you next load the program, it does not carry 
out a RUN but a GOTO instead; otherwise RUN will automatically clear the arrays. 
This program will SAVE itself automatically (line 120). 
When you next LOAD it will pick up straight away at line 130 -the line after the 
SAVE- and branch back to the line quoted there (in this case 20). In this way the 
RUN instruction is avoided and the variables are not cleared. But make sure you 
don't branch back to a point where you re-dimension the array you're trying to 
save!

Can I use the MEMOPAK 32K in conjunction with a 16K pack?

Yes, all you have to do is plug your other pack as a slave unit onto the back of 
our 32K pack. There are three possible slave units:

a) Our standard MEMOPAK 16K. This is the one with switches, which should be set in 
   SLAVE mode (1 and 4 ON; 2 and 3 OFF) .
 
b) Our MEMOPAK BASELINE 16K. This just fits on the back (or with the ZX printer in 
   front of it). 
c) The Sinclair 16K pack. This also fits on the back just like the BASELINE 16K.

Fit the ZX81 and the packs and the printer together. You will now have 48K of RAM 
available, and to use this you will need to set a new RAMTOP each time you power 
up:

POKE 16389, 255
NEW

Good Luck from all at MEMOTECH