May June 1980 - Commodore Computers
May June 1980 - Commodore Computers
May June 1980 - Commodore Computers
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
1OO 100 COMPUTE. MAY/JUNE. I 198O. <strong>1980</strong>. ISSUE 4.<br />
in line 10. Remember that this number is the size<br />
of your dimensioned variables.<br />
Refer R to Table T 1. Locations 140 and 141 form<br />
the program-end address. . Locations 142 and 143 form<br />
the stack address and locations 144 and 145 form the<br />
pointer to the end of memory used by the program.<br />
The RUN command sets all of them equal to the<br />
incorrect end-of-program pointer. . Lines 10 through 40<br />
correct them.<br />
Here H comes the only hard part. You are going<br />
to have to peek around in memory. The RUN R U N<br />
command sets the length of all strings to zero. You<br />
must repair their lengths if you want to save string<br />
data.<br />
Table 1.<br />
Table 1.<br />
These two byte addresses point to (Q important a nt areas used by<br />
Atari Acari Basic.<br />
Use this<br />
To get the location of this<br />
PEEK(130) PEEK( 130) + PEEK(131)*256 PEEK(131)"256 Variable Va,;able name table ,able<br />
PEEK(134) + PEEK(135)'256 PEEK( 135) "256 Variable Va,;able value table ,able<br />
PEEK(136) +PEEK(137)*256+ PEEK(137)"2S6 Beginning Seg;n n; ng of program<br />
Use these only when program running<br />
Use these only when program running<br />
PEEK(HO) PEEK(I40) + PEEK(141)'256<br />
PEEK(141)"256<br />
End of program and d beginning of dimensioned<br />
variables<br />
PEEKO42) PEEK( 142) + PEEK(143)*256<br />
PEEK( 143)"256<br />
End of dimensioned variables and beginning of<br />
stack<br />
PEEK(144) I44) + PEEK(145)*256<br />
PEEK(145)"256<br />
End of memory mory used by program<br />
Look at Table 3. The third entry in the variable<br />
value table is the string ALPHAS. ALPHA$. Its current length<br />
is 5 + +0*256 0'256 or 5. These two bytes must be set to<br />
the correct length of the string. Type the command:<br />
PRINT PEEK(134) + PEEK(135),256. PEEK(135)*256.<br />
Now you<br />
know where the variable value table is. If you have<br />
been writing the program in the listings, you should<br />
get the answer 2056. Assume the string is the first<br />
entry in the table. The locations of the length is<br />
Table 3<br />
Table 3<br />
The variable value table; table: Each entry is eightt bytes.<br />
V ariable<br />
Variable<br />
ABI AB1<br />
Table Entry<br />
Table T 2<br />
The T variable name table: Entry lengths are different. differcllI.<br />
Box symbolizes that 128 is added to ASCII value of last<br />
character to show the name's end. cnd .<br />
Variable<br />
Variable name<br />
Variable Variable name<br />
AB1 ASI<br />
AB [Tj<br />
AR{3,4) AR(3,4)<br />
AR[JJ<br />
CD<br />
CDOG(17)<br />
I CDOGjTJ<br />
IT]<br />
ALPHAS (10) ALPHA[|j ALPHAI1I<br />
E [El [])<br />
FIG<br />
FI [G]<br />
AS ill<br />
Note: Variable names can be up to 120 characters long<br />
and are a completely unique. Variable ABCA i.s is different<br />
from variable ABCD. A Variable names DO NOT appear<br />
in the program in memory. Only a I1 byte pointer to<br />
the variable name in the variable name table appears.<br />
Table Entry<br />
Contents<br />
1234561 2 3 4 5 6 7 8 Meaning<br />
, 01 0/ 0/64/,.0, 0/64/5,0. 0,0, 0 First byte is 0; 0: this is a number. Second byte is 0: this is thee first entry. 64<br />
is the exponent. 5 is the binary coded decimal value.<br />
FI IQ)<br />
3 character number name<br />
2 character array name<br />
e<br />
4 character array a name<br />
6 character string name<br />
1 character number name<br />
3 character number name<br />
Note; Variable names can be up to 120 characters long:<br />
the variable name in the variable name table appears.<br />
2060 anda 2061. Since the length of the string of data<br />
being saved in the example is 10, I set location<br />
2060 to a 10 lOin line 60 of the program.<br />
Try it out<br />
The program is complete. Save it. Now RunR it. You<br />
will probably get garbage in the print out. Put a<br />
10 character string in the string variable. Now put<br />
numbers in various entries in the B array. Typing<br />
a 9 for the I subscript will end the program with a<br />
CSAVE. C Do this CSAVE onto a new tape. TurnT the<br />
computer off and on. Now load this new copy of the<br />
program and run it. Viola! TheT data is still there!<br />
Now load this new copy of the program and run it.<br />
Viola! V ! The data is still there! Now just imagine that<br />
this was your budget information, , address book or<br />
other files. . You have a no-hassle one-tape system.<br />
.<br />
Conclusion<br />
I have provided more information about this internals<br />
of the Atari than is really necessary to solve<br />
thiss problem. If you are interested in this kind of<br />
information, , study it. If not, skip it. If you have<br />
any questions, I would be glad to answer them. . One<br />
warning. Doo not press break while the program p'rogram is<br />
running and then type RUN. Always use the CONT<br />
AR(3,4)<br />
AR(3,4)<br />
doe,n',<br />
doesn't<br />
matter<br />
matter<br />
64 + lillO, 1/1/0, 0/4, 0/5,0<br />
64 makes this an array. + I 1 means thatt it has been dimensioned. 0 ° +0*256 is the<br />
displacement displacement into thee array area. 4 + 00*256 is the size of the first dimension and<br />
5 +0-256 +0*256 is the size of the second dimension. .<br />
CDOG( 17)<br />
CDOG(17)<br />
doe,n',<br />
doesn't<br />
matter<br />
64 + 1/2/120,0/18,0/1, 120.0/ 18,011,00<br />
This array is displaced 120 bytes into the aarray aarea, and it is ddimensioned<br />
18+0*256+ 0 by 1 +0*256.<br />
ALPHAS( IO) " 1234S "<br />
ALPHA$(10)<br />
FIG<br />
"12345'<br />
E .05<br />
.05<br />
FIG -S<br />
128 + 1/31228,Of!), 1/3/228,0/5, OliO, 0/10, 0<br />
01 4/63/5,0, 0,0, 0<br />
0/ 4/63/5,0, 0,0. 0<br />
01 S/64 + 12815. 0.0, 0<br />
0/ 5/64+ 128/5, 0.0, 0<br />
128 makes this a string. + I 1 means that it has been dimensioned. . It starts<br />
228 + +0*256 bytes into the array area. . The current length of the string is<br />
,) 5 +0*256. The maximum imulll size of the string is 10 +0*256.<br />
This is a number. The exponent is now 63 so the number is only 11 1/100100 of its<br />
integer value, or .05.<br />
This is a minus number ( + 128 on exponent) nt)