ZX Computings - OpenLibra
ZX Computings - OpenLibra
ZX Computings - OpenLibra
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Machine code<br />
saving machine code<br />
Summary Of<br />
Possible Methods<br />
I first considered all the<br />
possibilities:<br />
1. Establishing a dummy array<br />
with DIM A(x) and then<br />
POKE into VARS.<br />
2. Moving RAM TOP down (as<br />
Mr. Sinclair has provided<br />
two nice little POKEable<br />
bytes 16388/16389 for<br />
just this purpose) and then<br />
POKEing the code into the<br />
available space NEW and<br />
CLS can't touch it, which is a<br />
major advantage.<br />
3. POKEing into a REM statement.<br />
Here at least, the code<br />
would be saved and safe<br />
from attack, but I was worried<br />
about displaying the<br />
REM and the dreaded<br />
system crash that would<br />
follow when the basic interpreter<br />
found naughty, nondisplayable<br />
codes for it to<br />
put on the screen.<br />
4. POKEing above program and<br />
display file, but far enough<br />
below the stacks, to prevent<br />
collision with the "calculator<br />
stack". At least the<br />
code is immobile here, but I<br />
never liked this one with the<br />
<strong>ZX</strong>80, as it's a bit "by<br />
guess" as to whether the<br />
code gets overwritten or<br />
not.<br />
5. Setting up a string array to<br />
contain the code and stripping<br />
it out byte by byte. This<br />
gobbles up memory at a<br />
phenomenal rate, plus the<br />
fact that you are tied to<br />
relative code as the strings<br />
shift.<br />
The Sinclair Manual<br />
The Sinclair Manual is as good<br />
as useless on using machine<br />
As a self-confessed machine code<br />
freak, who gets withdrawal symptons<br />
without a daily shot of bytes, Mike<br />
Bidden decided to push some code up<br />
the <strong>ZX</strong>81, only to discover that it was<br />
a totally different machine from the<br />
<strong>ZX</strong>80. and that he was unable to use<br />
his tried and tested favourite<br />
methods. This was due to lack of RAM<br />
or because the overseeing 8K ROM did<br />
naughty things to the code he POKEd<br />
in. Let Mike tell you the story...<br />
code (read Chapter 26), but to<br />
be fair, it's directed at those<br />
new to programming and in this<br />
it succeeds. The Sinclair<br />
Manual mentions methods 2, 3<br />
and 5 with scant detail, but I<br />
began to wonder why there<br />
was no mention of a dummy<br />
array and VARS.<br />
Experimentation<br />
So I set out to try this method<br />
first. I have always favoured<br />
MICROMON (the <strong>ZX</strong>80 magic<br />
book) for this purpose. Micromon<br />
pokes hex code into VARS<br />
(system variable area). I converted<br />
Micromon into something<br />
the <strong>ZX</strong>81 could recognise<br />
(no TL$ on the 81 you have to<br />
use (2 to ) instead). Having<br />
got the program in and running,<br />
I discovered that there were only<br />
about 50 bytes left for the<br />
code and that DIM A(25) was<br />
about all that was possible. Not<br />
only that, I could not POKE into<br />
the VARS area, all my carefully<br />
considered bytes were overwritten<br />
to zeros. Perhaps I was<br />
doing something wrong, but at<br />
this stage I stopped trying to<br />
POKE into VARS<br />
Method two worked as<br />
described in the Sinclair<br />
Manual, but what's the use of<br />
code you cannot save, without<br />
a special routine that consumes<br />
precious memory. So I discard-<br />
1 P E N 1 0 0 C H A R A C T E R S O F<br />
Y O U R C H O I C E<br />
LO L E T A = 155:L4-<br />
1 5 CLS<br />
P R I N T A ; " " ; P E E K R<br />
i FT A=A-H<br />
3 INPUT<br />
- *'" THEN GOTO IS<br />
1,0 IP >,$= M" THEN GOTO 90<br />
C0 IF = THEN GOTO 120<br />
7-2- POKE R 1 j. UAL A*<br />
£ O T O 15<br />
INPUT A<br />
100 GOTO 15<br />
3 2 0 C L S<br />
125 FAST<br />
1 3 0 L E T U - U 3 R