20
PRINT
N
and the program is entered properly.
Type
GOTO
10
and again you will find that this line is rejected because its syntax cannot be checked; however, of you rub
it out and type
RUN
it will work. (
RUN
clears out the array, making plenty of space.)
Now type in the same as before from
NEW
up to line 30, and then
40
REM
XXXXXXXXXXXX
(12 Xs), which will end up looking like 40 RE. When you press
NEWLINE
, the listing will just consist of line
30, and in fact line 40 has been completely lost. This is because it was simply too long to fit in the program.
The effect is a bit worse when the line is a lengthened version of a line that is already in the program, for
you will lose both the old line from the program and the new line that was to replace it.
The ultimate cure for this is to buy a RAM pack, which fits on the back of the computer. The Sinclair 16K
RAM pack gives the computer sixteen times as much memory as it has in its unexpanded form.
If you have an old ZX80 3K RAM pack, it will not work on the ZX81.
The behaviour with the RAM pack is rather different, because the display file is filled out with spaces to
make each line 32 characters long (note that
SCROLL
upsets this - see chapter 27). Now printing and
listing will not make the computer run out of memory, and you will not see all these shortened listings, and
umping around; but you will see the lines sticking or getting lost, and again the only cure is to find some
spare space.
If you have a memory expansion board, put it on and go through the typing in this chapter, using
DIM
A(3069)
to replace
DIM
A(150).
To summarize, this is a tangled tale and the moral is to avoid getting an absolutely jam-packed compute
if you can. However, the second moral is that things are not usually as bad as they look.
1. If the listing starts shortening or thinhgs start jumping around, then the space is getting tight.
2. If
NEWLINE
seems to have no effect at the end of a line, then there is probably no room to deal with a
number. Rub out the line using
EDIT
-
NEWLINE
or
RUBOUT
.
3.
NEWLINE
might lose a line altogether.
For all these oddities, the cure is the same. Don't panic, and look for some spare space.
The first thing to consider is
CLEAR
. If you have some variables and you do not mind losing any of
them, then this is the thing to do.
Failing this, look for unnecessary statements in the program, such as
REM
statements, and delete some
of those.
Summary
When the memory fills up odd things can happen; but they are not usually fatal.