Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199607.adf » Regulars » StarInfo/Thurlby/EasyDiv

StarInfo/Thurlby/EasyDiv

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 » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199607.adf » Regulars
Filename: StarInfo/Thurlby/EasyDiv
Read OK:
File size: 0206 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >EasyDiv
   20REM by Les Thurlby
   21REM (c) AU July 1996
   30
   40MODE 0
   50DIM A(20)
   60INPUT"DIVIDEND ";B
   70INPUT"DIVISOR ";A(1)
   80PRINT
   90FOR N=1 TO 20
  100A(N)=A(1)*2^(N-1)
  110IF A(N)<=B PRINT A(N);" = DIVISOR * ";2^(N-1)
  120IF A(N)>B THEN R=N-1:A(N)=0:N=20
  130NEXT N
  140PRINT
  150M=B-A(R):PRINT B;"-";A(R)"="B-A(R);TAB(29)2^(R-1):T=2^(R-1)
  160FOR N=R-1 TO 1 STEP -1
  170M=M-A(N):IF M>=0 PRINT M+A(N);"-";A(N);"=";M;TAB(29)2^(N-1):T=T+2^(N-1)
  180IF M<0 PRINT M+A(N);"-";A(N);"......NO GO":M=M+A(N)
  190NEXT N
  200PRINT;SPC(29);"------":PRINT;SPC(29);T;" = QUOTIENT"
  210PRINT;SPC(29);M;" = REMAINDER"

� >EasyDiv
� by Les Thurlby
� (c) AU July 1996

(� 0
2� A(20)
<�"DIVIDEND ";B
F�"DIVISOR ";A(1)
P�
Z� N=1 � 20
dA(N)=A(1)*2^(N-1)
n,� A(N)<=B � A(N);" = DIVISOR * ";2^(N-1)
x � A(N)>B � R=N-1:A(N)=0:N=20
�� N
��
�8M=B-A(R):� B;"-";A(R)"="B-A(R);�29)2^(R-1):T=2^(R-1)
�� N=R-1 � 1 � -1
�CM=M-A(N):� M>=0 � M+A(N);"-";A(N);"=";M;�29)2^(N-1):T=T+2^(N-1)
�2� M<0 � M+A(N);"-";A(N);"......NO GO":M=M+A(N)
�� N
�,�;�(29);"------":�;�(29);T;" = QUOTIENT"
��;�(29);M;" = REMAINDER"
�
00000000  0d 00 0a 0e f4 20 3e 45  61 73 79 44 69 76 0d 00  |..... >EasyDiv..|
00000010  14 14 f4 20 62 79 20 4c  65 73 20 54 68 75 72 6c  |... by Les Thurl|
00000020  62 79 0d 00 15 16 f4 20  28 63 29 20 41 55 20 4a  |by..... (c) AU J|
00000030  75 6c 79 20 31 39 39 36  0d 00 1e 04 0d 00 28 07  |uly 1996......(.|
00000040  eb 20 30 0d 00 32 0b de  20 41 28 32 30 29 0d 00  |. 0..2.. A(20)..|
00000050  3c 12 e8 22 44 49 56 49  44 45 4e 44 20 22 3b 42  |<.."DIVIDEND ";B|
00000060  0d 00 46 14 e8 22 44 49  56 49 53 4f 52 20 22 3b  |..F.."DIVISOR ";|
00000070  41 28 31 29 0d 00 50 05  f1 0d 00 5a 0e e3 20 4e  |A(1)..P....Z.. N|
00000080  3d 31 20 b8 20 32 30 0d  00 64 15 41 28 4e 29 3d  |=1 . 20..d.A(N)=|
00000090  41 28 31 29 2a 32 5e 28  4e 2d 31 29 0d 00 6e 2c  |A(1)*2^(N-1)..n,|
000000a0  e7 20 41 28 4e 29 3c 3d  42 20 f1 20 41 28 4e 29  |. A(N)<=B . A(N)|
000000b0  3b 22 20 3d 20 44 49 56  49 53 4f 52 20 2a 20 22  |;" = DIVISOR * "|
000000c0  3b 32 5e 28 4e 2d 31 29  0d 00 78 20 e7 20 41 28  |;2^(N-1)..x . A(|
000000d0  4e 29 3e 42 20 8c 20 52  3d 4e 2d 31 3a 41 28 4e  |N)>B . R=N-1:A(N|
000000e0  29 3d 30 3a 4e 3d 32 30  0d 00 82 07 ed 20 4e 0d  |)=0:N=20..... N.|
000000f0  00 8c 05 f1 0d 00 96 38  4d 3d 42 2d 41 28 52 29  |.......8M=B-A(R)|
00000100  3a f1 20 42 3b 22 2d 22  3b 41 28 52 29 22 3d 22  |:. B;"-";A(R)"="|
00000110  42 2d 41 28 52 29 3b 8a  32 39 29 32 5e 28 52 2d  |B-A(R);.29)2^(R-|
00000120  31 29 3a 54 3d 32 5e 28  52 2d 31 29 0d 00 a0 14  |1):T=2^(R-1)....|
00000130  e3 20 4e 3d 52 2d 31 20  b8 20 31 20 88 20 2d 31  |. N=R-1 . 1 . -1|
00000140  0d 00 aa 43 4d 3d 4d 2d  41 28 4e 29 3a e7 20 4d  |...CM=M-A(N):. M|
00000150  3e 3d 30 20 f1 20 4d 2b  41 28 4e 29 3b 22 2d 22  |>=0 . M+A(N);"-"|
00000160  3b 41 28 4e 29 3b 22 3d  22 3b 4d 3b 8a 32 39 29  |;A(N);"=";M;.29)|
00000170  32 5e 28 4e 2d 31 29 3a  54 3d 54 2b 32 5e 28 4e  |2^(N-1):T=T+2^(N|
00000180  2d 31 29 0d 00 b4 32 e7  20 4d 3c 30 20 f1 20 4d  |-1)...2. M<0 . M|
00000190  2b 41 28 4e 29 3b 22 2d  22 3b 41 28 4e 29 3b 22  |+A(N);"-";A(N);"|
000001a0  2e 2e 2e 2e 2e 2e 4e 4f  20 47 4f 22 3a 4d 3d 4d  |......NO GO":M=M|
000001b0  2b 41 28 4e 29 0d 00 be  07 ed 20 4e 0d 00 c8 2c  |+A(N)..... N...,|
000001c0  f1 3b 89 28 32 39 29 3b  22 2d 2d 2d 2d 2d 2d 22  |.;.(29);"------"|
000001d0  3a f1 3b 89 28 32 39 29  3b 54 3b 22 20 3d 20 51  |:.;.(29);T;" = Q|
000001e0  55 4f 54 49 45 4e 54 22  0d 00 d2 1c f1 3b 89 28  |UOTIENT".....;.(|
000001f0  32 39 29 3b 4d 3b 22 20  3d 20 52 45 4d 41 49 4e  |29);M;" = REMAIN|
00000200  44 45 52 22 0d ff                                 |DER"..|
00000206