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.
A. Beasley<br />
After using the <strong>ZX</strong>80 for a<br />
few months I found that there<br />
was a need for a simple<br />
renumbering program. In the<br />
attempt to solve the problem a<br />
BASIC program was written<br />
out but this took far too much<br />
memory space. While machine<br />
code was the obvious solution<br />
it did raise yet another<br />
problem. How could the<br />
program be stored so that it<br />
could be used without any<br />
trouble. After attempting to<br />
store it in a REM line it was<br />
found that some of the codes<br />
made the system crash when<br />
the program was listed.<br />
Solutions<br />
To get over the problem the<br />
following method was<br />
developed. First all the<br />
variables are CLE A Red. A<br />
string variable is now set up to<br />
contain the required number of<br />
bytes and the machine code is<br />
POKEd into it. As this string<br />
variable is the first in the list<br />
its location can be found from<br />
the two bytes called VARS,<br />
see page 1 22 in the manual.<br />
By adding one to the value<br />
obtained you have the location<br />
of the first character in the<br />
string. To call the program you<br />
simply find the value of VARS,<br />
add one and use this number<br />
as a USR call.<br />
More Problems<br />
This method generates its own<br />
set of problems, however. If<br />
you are using it tor program<br />
operation you cannot use the<br />
following commands, RUN,<br />
CLEAR or NEW. By using<br />
GOTO you can get over the<br />
RUN problem and the others<br />
are not really drastic.<br />
The main advantage of this<br />
method is that when you save<br />
the program you still preserve<br />
the string for the next time. It<br />
should be noted that the<br />
GOTO and GOSUB statements<br />
are not altered but you do get<br />
everything into 35 bytes.<br />
4ER 1982 <strong>ZX</strong> COMPUTING SUMMER 1982<br />
Operation<br />
To use the program type in<br />
with Z$ containing 33<br />
characters. Now run the<br />
program then remove it by<br />
typing just the line numbers<br />
and then 'Newline'. The<br />
program you wish to renumber<br />
can be keyed in but remember<br />
not to use the RUN or CLEAR<br />
keys and make sure that the<br />
program does not contain Z $.<br />
To activate the renumber<br />
type PRINT USR<br />
(1 + PEEK(1 6392) + PEEK-<br />
(1 6393)* 256).<br />
1<br />
2<br />
3<br />
4<br />
5<br />
6<br />
7<br />
8<br />
9<br />
10<br />
1 1<br />
12<br />
13<br />
CLEAR<br />
LET Z$ • *aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"<br />
LET<br />
A$ = '06000E0A2128407023713E0A814F30-<br />
0404 CB70C0237EFE7620FA237ECB7FC018E6"<br />
LET A = 1 + PEEK! 16392) + PEEK! 1 6393*256)<br />
FOR C = 1 TO 33<br />
LET B = CODE (A$)-28<br />
LET B = B* 16<br />
LET A$ -TL$(A$)<br />
LET B = B + C0DE(A$) - 28<br />
LET A$ =TL${A$}<br />
POKE A,B<br />
LET A = A + 1<br />
NEXT C