Home » Personal collection » Commodore disks » disk65a_programs_1.d64 » maths
maths
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Commodore disks » disk65a_programs_1.d64 |
Filename: | maths |
Read OK: | ✔ |
File size: | 029B bytes |
Load address: | 0801 |
Exec address: | 0000 |
File contents
1000 GOSUB1150:T=1:V=0:S=1:P=0 1010 B$=MID$(A$,T,1):N$=MID$(A$,T+1,1):IF B$="+" THEN S=1:GOTO1130 1020 IF B$="-" THEN S=2:GOTO1130 1030 IF B$="*" THEN S=3:GOTO1130 1040 IF B$="/" THEN S=4:GOTO1130 1045 IF B$="↑" THEN S=5:GOTO1130 1050 IF ASC(B$)<48 OR ASC(B$)>57 THEN N$="ERROR":RETURN 1055 P=VAL(B$):T=T+1:N$=MID$(A$,T,1) 1057 IF T>LEN(A$) THEN 1080 1060 IF ASC(N$)<48 OR ASC(N$)>57 THEN T=T-1:GOTO 1080 1070 P=P*10+VAL(N$):T=T+1:N$=MID$(A$,T,1):GOTO 1057 1080 IF S=1 THEN V=V+P 1090 IF S=2 THEN V=V-P 1100 IF S=3 THEN V=V*P 1110 IF S=4 THEN V=V/P 1120 IF S=5 THEN V=V^P 1130 T=T+1:IF LEN(A$)<T THEN RETURN 1140 GOTO 1010 1150 TE$=A$:FORR=1 TO LEN(TE$) 1160 IF MID$(TE$,R,1)="(" THEN PO=R:GOTO 1180 1170 NEXT:A$=TE$:RETURN 1180 IF MID$(TE$,PO,1)=")" THEN 1210 1190 PO=PO+1:IF PO>LEN(TE$) THEN N$="MISS" 1200 GOTO 1180 1210 A$=MID$(TE$,R,PO-R):GOSUB1000:GOTO1170
��1150:T�1:V�0:S�1:P�0 P�B$��(A$,T,1):N$��(A$,T�1,1):� B$�"+" � S�1:�1130 i�� B$�"-" � S�2:�1130 �� B$�"*" � S�3:�1130 �� B$�"/" � S�4:�1130 �� B$�"^" � S�5:�1130 �� �(B$)�48 � �(B$)�57 � N$�"ERROR":� �P��(B$):T�T�1:N$��(A$,T,1) !� T��(A$) � 1080 : $� �(N$)�48 � �(N$)�57 � T�T�1:� 1080 e .P�P�10��(N$):T�T�1:N$��(A$,T,1):� 1057 w 8� S�1 � V�V�P � B� S�2 � V�V�P � L� S�3 � V�V�P � V� S�4 � V�V�P � `� S�5 � V�V�P � jT�T�1:� �(A$)�T � � � t� 1010 � ~TE$�A$:�R�1 � �(TE$) �� �(TE$,R,1)�"(" � PO�R:� 1180 - ��:A$�TE$:� J �� �(TE$,PO,1)�")" � 1210 n �PO�PO�1:� PO��(TE$) � N$�"MISS"