... Save zx81's memory ... it'had only 16kb...
If you had to code a big basic program, you had preserve all bytes you can.
In basic,
For example:
10 goto 1
This line Take
4 bytes : used by the line Header,
+ 1 byte : for the goto command.
+ 1 byte : for the numeric string : "1"
+ 5 bytes : use by the system to decode the numeric value.
= 11 bytes. (i don't add the <end of line> tag (128/76h)!)
To improve you code, you had to avoid numerics encoding.
Like this
10 goto PI/PI
4 : header (can't be changed : 2bytes for the line number, 2bytes for the line lenght.)
+ 1byte : for goto command.
+ 1byte : PI
+ 1byte : /
+ 1byte : PI
= 8 bytes. (3bytes saved!)
Now, If you use a constant:
5 LET I=PI/PI
10 goto I
4 : header (can't be changed : 2bytes for the line number, 2bytes for the line lenght.)
+ 1byte : for goto command.
+ 1byte : I
= 6 bytes. (5bytes saved! in the Goto line)
Constants examples:
A=0 =PI-PI
B=1 =PI/PI
C=2 =B+B
D=3 =C+B or int PI
E=4 =C*C
In case of numbers between 0 and 255,
you can use the "code" function, but most of chars values can't be typed on the keyboard!
67 to 127, and 230 to 255! (you had to have a "K" cursor in Basic!)
Juste type:
10 goto val"67"
In case of "1000" or "2000", you can use the exponant tag!
10 goto val"1E3" or val"2E3"
You can use the PEEK function in the rom PEEK PI=255 or PEEK+constant...
You can also save memory if you type a single line...
10 IF A>0 then PRINT"MORE" (16bytes+5bytes numerics)
20 IF A=0 then PRINT"EQUAL" (17bytes+5bytes numerics)+header*4+EOL*1
30 IF A<0 then PRINT"LESS" (16bytes+5bytes numerics) +header*4+EOL*1
= 64 bytes+8*header+2*EOL.
=> 74 bytes.
10 PRINT "MORE" AND A>0;"LESS" AND A<0;"EQUAL" AND A=0 (34bytes+3*5bytes numerics)
= 49 bytes.
**** 25 bytes saved ****
if, O=PI-PI
10 PRINT "MORE" AND A>O;"LESS" AND A<O;"EQUAL" AND A=O (34bytes)
=34Bytes.
**** 40 bytes saved ****
Juste for 1 line!
You can alsa try to use the XuR Basic optimizer, but it's hard to change you program with "CODE" funtions...
Your program must be finished to use it!
