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�0P�B$��(A$,T,1):N$��(A$,T�1,1):� B$�"+" � S�1:�1130i�� 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:� 1080e	.P�P�10��(N$):T�T�1:N$��(A$,T,1):� 1057w	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)�")" � 1210n
�PO�PO�1:� PO��(TE$) � N$�"MISS"y
�� 1180�
�A$��(TE$,R,PO�R):�1000:�1170
[H.C.1150:t.1:v.0:s.1:p.0@pH.Cb$..(a$,t,1):n$..(a$,t.1,1):. b$."+" . s.1:.1130@IH.C. b$."-" . s.2:.1130@.HFD. b$."*" . s.3:.1130@.HPD. b$."/" . s.4:.1130@.HUD. b$."." . s.5:.1130@.HZD. .(b$).48 . .(b$).57 . n$."error":.@.H.Dp..(b$):t.t.1:n$..(a$,t,1)@QI!D. t..(a$) . 1080@:I$D. .(n$).48 . .(n$).57 . t.t.1:. 1080@EI.Dp.p.10..(n$):t.t.1:n$..(a$,t,1):. 1057@WI8D. s.1 . v.v.p@.IbD. s.2 . v.v.p@.IlD. s.3 . v.v.p@.IvD. s.4 . v.v.p@.I.D. s.5 . v.v.p@.IJDt.t.1:. .(a$).t . .@.ITD. 1010@.I.Dte$.a$:.r.1 . .(te$)@.J.D. .(te$,r,1)."(" . po.r:. 1180@-J.D.:a$.te$:.@jJ.D. .(te$,po,1).")" . 1210@NJ.Dpo.po.1:. po..(te$) . n$."miss"@YJ.D. 1180@.J.Da$..(te$,r,po.r):.1000:.1170@@@
00000000  1b 08 e8 03 8d 31 31 35  30 3a 54 b2 31 3a 56 b2  |.....1150:T.1:V.|
00000010  30 3a 53 b2 31 3a 50 b2  30 00 50 08 f2 03 42 24  |0:S.1:P.0.P...B$|
00000020  b2 ca 28 41 24 2c 54 2c  31 29 3a 4e 24 b2 ca 28  |..(A$,T,1):N$..(|
00000030  41 24 2c 54 aa 31 2c 31  29 3a 8b 20 42 24 b2 22  |A$,T.1,1):. B$."|
00000040  2b 22 20 a7 20 53 b2 31  3a 89 31 31 33 30 00 69  |+" . S.1:.1130.i|
00000050  08 fc 03 8b 20 42 24 b2  22 2d 22 20 a7 20 53 b2  |.... B$."-" . S.|
00000060  32 3a 89 31 31 33 30 00  82 08 06 04 8b 20 42 24  |2:.1130...... B$|
00000070  b2 22 2a 22 20 a7 20 53  b2 33 3a 89 31 31 33 30  |."*" . S.3:.1130|
00000080  00 9b 08 10 04 8b 20 42  24 b2 22 2f 22 20 a7 20  |...... B$."/" . |
00000090  53 b2 34 3a 89 31 31 33  30 00 b4 08 15 04 8b 20  |S.4:.1130...... |
000000a0  42 24 b2 22 5e 22 20 a7  20 53 b2 35 3a 89 31 31  |B$."^" . S.5:.11|
000000b0  33 30 00 dd 08 1a 04 8b  20 c6 28 42 24 29 b3 34  |30...... .(B$).4|
000000c0  38 20 b0 20 c6 28 42 24  29 b1 35 37 20 a7 20 4e  |8 . .(B$).57 . N|
000000d0  24 b2 22 45 52 52 4f 52  22 3a 8e 00 fc 08 1f 04  |$."ERROR":......|
000000e0  50 b2 c5 28 42 24 29 3a  54 b2 54 aa 31 3a 4e 24  |P..(B$):T.T.1:N$|
000000f0  b2 ca 28 41 24 2c 54 2c  31 29 00 11 09 21 04 8b  |..(A$,T,1)...!..|
00000100  20 54 b1 c3 28 41 24 29  20 a7 20 31 30 38 30 00  | T..(A$) . 1080.|
00000110  3a 09 24 04 8b 20 c6 28  4e 24 29 b3 34 38 20 b0  |:.$.. .(N$).48 .|
00000120  20 c6 28 4e 24 29 b1 35  37 20 a7 20 54 b2 54 ab  | .(N$).57 . T.T.|
00000130  31 3a 89 20 31 30 38 30  00 65 09 2e 04 50 b2 50  |1:. 1080.e...P.P|
00000140  ac 31 30 aa c5 28 4e 24  29 3a 54 b2 54 aa 31 3a  |.10..(N$):T.T.1:|
00000150  4e 24 b2 ca 28 41 24 2c  54 2c 31 29 3a 89 20 31  |N$..(A$,T,1):. 1|
00000160  30 35 37 00 77 09 38 04  8b 20 53 b2 31 20 a7 20  |057.w.8.. S.1 . |
00000170  56 b2 56 aa 50 00 89 09  42 04 8b 20 53 b2 32 20  |V.V.P...B.. S.2 |
00000180  a7 20 56 b2 56 ab 50 00  9b 09 4c 04 8b 20 53 b2  |. V.V.P...L.. S.|
00000190  33 20 a7 20 56 b2 56 ac  50 00 ad 09 56 04 8b 20  |3 . V.V.P...V.. |
000001a0  53 b2 34 20 a7 20 56 b2  56 ad 50 00 bf 09 60 04  |S.4 . V.V.P...`.|
000001b0  8b 20 53 b2 35 20 a7 20  56 b2 56 ae 50 00 d7 09  |. S.5 . V.V.P...|
000001c0  6a 04 54 b2 54 aa 31 3a  8b 20 c3 28 41 24 29 b3  |j.T.T.1:. .(A$).|
000001d0  54 20 a7 20 8e 00 e2 09  74 04 89 20 31 30 31 30  |T . ....t.. 1010|
000001e0  00 fb 09 7e 04 54 45 24  b2 41 24 3a 81 52 b2 31  |...~.TE$.A$:.R.1|
000001f0  20 a4 20 c3 28 54 45 24  29 00 1e 0a 88 04 8b 20  | . .(TE$)...... |
00000200  ca 28 54 45 24 2c 52 2c  31 29 b2 22 28 22 20 a7  |.(TE$,R,1)."(" .|
00000210  20 50 4f b2 52 3a 89 20  31 31 38 30 00 2d 0a 92  | PO.R:. 1180.-..|
00000220  04 82 3a 41 24 b2 54 45  24 3a 8e 00 4a 0a 9c 04  |..:A$.TE$:..J...|
00000230  8b 20 ca 28 54 45 24 2c  50 4f 2c 31 29 b2 22 29  |. .(TE$,PO,1).")|
00000240  22 20 a7 20 31 32 31 30  00 6e 0a a6 04 50 4f b2  |" . 1210.n...PO.|
00000250  50 4f aa 31 3a 8b 20 50  4f b1 c3 28 54 45 24 29  |PO.1:. PO..(TE$)|
00000260  20 a7 20 4e 24 b2 22 4d  49 53 53 22 00 79 0a b0  | . N$."MISS".y..|
00000270  04 89 20 31 31 38 30 00  9a 0a ba 04 41 24 b2 ca  |.. 1180.....A$..|
00000280  28 54 45 24 2c 52 2c 50  4f ab 52 29 3a 8d 31 30  |(TE$,R,PO.R):.10|
00000290  30 30 3a 89 31 31 37 30  00 00 00                 |00:.1170...|
0000029b