Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Regulars2 » StarInfo/Cooke/BallPack

StarInfo/Cooke/BallPack

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_199801_2.adf » Regulars2
Filename: StarInfo/Cooke/BallPack
Read OK:
File size: 069A bytes
Load address: 0000
Exec address: 0000
File contents
   10PROCmode("X800 Y600 G256"):OFF
   20FOR i=0 TO 255
   30 COLOUR i,i,i,i
   40NEXT
   50most=200
   60
   70min=16
   80max=128
   90
  100DIM x(most),y(most),r(most),c(most)
  110n=0
  120REPEAT
  130 REPEAT
  140  x=RND(1600)
  150  y=RND(1200)
  160  r=FNrad(x,y)
  170 UNTIL r>min
  180 CIRCLE FILL x,y,r
  190 x(n)=x
  200 y(n)=y
  210 r(n)=r
  220 c(n)=r
  230 n+=1
  240UNTIL n>most
  250CLS
  260FOR i=0 TO most-1
  270r(i)=r(i)*1.5
  280c(i)=c(i)*1.5
  290NEXT
  300m=max*1.5
  310togo=most
  320
  330REPEAT
  340 FOR i=0 TO most-1
  350  IF r(i)>0 THEN
  360  c=(c(i)-r(i))*255/c(i)
  370  GCOL c,c,c
  380  CIRCLE FILL x(i),y(i),r(i)
  390  r(i)=r(i)-2
  400  IF r(i)<=0 togo-=1
  410  ENDIF
  420 NEXT
  430UNTIL togo=0
  440IFGET
  450END
  460
  470DEF FNrad(x,y)
  480IF n>0 THEN
  490 FOR r=min TO max
  500  FOR i=0 TO n-1
  510   d=SQR((x-x(i))^2 + (y-y(i))^2)
  520   IF d < r+r(i) THEN =d-r(i)-1
  530  NEXT
  540 NEXT
  550ENDIF
  560=min+RND(max-min)
  570
  580REM >PROCmode
  590REM Same as BASIC MODE "X... Y... C..." etc.
  600REM but uses a mode selector instead of a
  610REM call to WimpMode thus preserving the
  620REM desktop's mode
  630END
  640:
  650DEF PROCmode(mode$)
  660LOCAL c$,ex,ey,mode,end
  670DIM mode 64
  680end=mode+20
  690!mode=1
  700mode!4=VALFN_m(mode$,"X","")
  710mode!8=VALFN_m(mode$,"Y","")
  720c$=FN_m(mode$,"C","*")
  730IF c$="*" THEN
  740 c$=FN_m(mode$,"G","")
  750 IF c$="256" !end=3:end!4=255:end+=8
  760ENDIF
  770mode!12=FN_bpp(c$)
  780mode!16=VALFN_m(mode$,"F","-1")
  790ex=VALFN_m(mode$,"EX","-1")
  800IF ex<>-1 !end=4:end!4=ex:end+=8
  810ey=VALFN_m(mode$,"EY","-1")
  820IF ey<>-1 !end=5:end!4=ey:end+=8
  830!end=-1
  840MODE mode
  850ENDPROC
  860
  870DEF FN_m(s$,p$,d$)
  880LOCAL i,j
  890i=INSTR(s$,p$)
  900IF i<1 AND d$="" ERROR 490,"Missing "+p$
  910IF i<1 THEN =d$
  920j=INSTR(s$+" "," ",i+1)
  930=MID$(s$,i+1,j-i-1)
  940
  950DEF FN_bpp(n$)
  960CASE n$ OF
  970 WHEN "2":=0
  980 WHEN "4":=1
  990 WHEN "16":=2
 1000 WHEN "256":=3
 1010 WHEN "32T","32t","32K","32k":=4
 1020 WHEN "16M","16m":=5
 1030 OTHERWISE: ERROR 490,"Bad parameter "+n$
 1040ENDCASE

�mode("X800 Y600 G256"):�
� i=0 � 255
 � i,i,i,i
(�
2most=200
<
F
min=16
Pmax=128
Z
d%� x(most),y(most),r(most),c(most)
nn=0
x�
� �
�  x=�(1600)
�  y=�(1200)
�  r=�rad(x,y)
� � r>min
� ȏ Ȑ x,y,r
� x(n)=x
� y(n)=y
� r(n)=r
� c(n)=r
�	 n+=1
�� n>most
��
� i=0 � most-1
r(i)=r(i)*1.5
c(i)=c(i)*1.5
"�
,
m=max*1.5
6
togo=most
@
J�
T � i=0 � most-1
^  � r(i)>0 �
h  c=(c(i)-r(i))*255/c(i)
r
  � c,c,c
|  ȏ Ȑ x(i),y(i),r(i)
�  r(i)=r(i)-2
�  � r(i)<=0 togo-=1
�  �
� �
�� togo=0
��
��
�
�� �rad(x,y)
�� n>0 �
� � r=min � max
�  � i=0 � n-1
�#   d=�((x-x(i))^2 + (y-y(i))^2)
   � d < r+r(i) � =d-r(i)-1
  �
 �
&�
0=min+�(max-min)
:
D� >PROCmode
N.� Same as BASIC MODE "X... Y... C..." etc.
X+� but uses a mode selector instead of a
b*� call to WimpMode thus preserving the
l� desktop's mode
v�
�:
�� �mode(mode$)
�� c$,ex,ey,mode,end
�
� mode 64
�end=mode+20
�!mode=1
�mode!4=��_m(mode$,"X","")
�mode!8=��_m(mode$,"Y","")
�c$=�_m(mode$,"C","*")
�� c$="*" �
� c$=�_m(mode$,"G","")
�' � c$="256" !end=3:end!4=255:end+=8
��
mode!12=�_bpp(c$)
 mode!16=��_m(mode$,"F","-1")
ex=��_m(mode$,"EX","-1")
 #� ex<>-1 !end=4:end!4=ex:end+=8
*ey=��_m(mode$,"EY","-1")
4#� ey<>-1 !end=5:end!4=ey:end+=8
>!end=-1
H
� mode
R�
\
f� �_m(s$,p$,d$)
p	� i,j
z
i=�s$,p$)
�%� i<1 � d$="" � 490,"Missing "+p$
�� i<1 � =d$
�j=�s$+" "," ",i+1)
�=�s$,i+1,j-i-1)
�
�� �_bpp(n$)
�Ȏ n$ �
�
 � "2":=0
�
 � "4":=1
� � "16":=2
� � "256":=3
�! � "32T","32t","32K","32k":=4
� � "16M","16m":=5
! : � 490,"Bad parameter "+n$
�
�
00000000  0d 00 0a 1d f2 6d 6f 64  65 28 22 58 38 30 30 20  |.....mode("X800 |
00000010  59 36 30 30 20 47 32 35  36 22 29 3a 87 0d 00 14  |Y600 G256"):....|
00000020  0f e3 20 69 3d 30 20 b8  20 32 35 35 0d 00 1e 0e  |.. i=0 . 255....|
00000030  20 fb 20 69 2c 69 2c 69  2c 69 0d 00 28 05 ed 0d  | . i,i,i,i..(...|
00000040  00 32 0c 6d 6f 73 74 3d  32 30 30 0d 00 3c 04 0d  |.2.most=200..<..|
00000050  00 46 0a 6d 69 6e 3d 31  36 0d 00 50 0b 6d 61 78  |.F.min=16..P.max|
00000060  3d 31 32 38 0d 00 5a 04  0d 00 64 25 de 20 78 28  |=128..Z...d%. x(|
00000070  6d 6f 73 74 29 2c 79 28  6d 6f 73 74 29 2c 72 28  |most),y(most),r(|
00000080  6d 6f 73 74 29 2c 63 28  6d 6f 73 74 29 0d 00 6e  |most),c(most)..n|
00000090  07 6e 3d 30 0d 00 78 05  f5 0d 00 82 06 20 f5 0d  |.n=0..x...... ..|
000000a0  00 8c 0f 20 20 78 3d b3  28 31 36 30 30 29 0d 00  |...  x=.(1600)..|
000000b0  96 0f 20 20 79 3d b3 28  31 32 30 30 29 0d 00 a0  |..  y=.(1200)...|
000000c0  11 20 20 72 3d a4 72 61  64 28 78 2c 79 29 0d 00  |.  r=.rad(x,y)..|
000000d0  aa 0c 20 fd 20 72 3e 6d  69 6e 0d 00 b4 10 20 c8  |.. . r>min.... .|
000000e0  8f 20 c8 90 20 78 2c 79  2c 72 0d 00 be 0b 20 78  |. .. x,y,r.... x|
000000f0  28 6e 29 3d 78 0d 00 c8  0b 20 79 28 6e 29 3d 79  |(n)=x.... y(n)=y|
00000100  0d 00 d2 0b 20 72 28 6e  29 3d 72 0d 00 dc 0b 20  |.... r(n)=r.... |
00000110  63 28 6e 29 3d 72 0d 00  e6 09 20 6e 2b 3d 31 0d  |c(n)=r.... n+=1.|
00000120  00 f0 0c fd 20 6e 3e 6d  6f 73 74 0d 00 fa 05 db  |.... n>most.....|
00000130  0d 01 04 12 e3 20 69 3d  30 20 b8 20 6d 6f 73 74  |..... i=0 . most|
00000140  2d 31 0d 01 0e 11 72 28  69 29 3d 72 28 69 29 2a  |-1....r(i)=r(i)*|
00000150  31 2e 35 0d 01 18 11 63  28 69 29 3d 63 28 69 29  |1.5....c(i)=c(i)|
00000160  2a 31 2e 35 0d 01 22 05  ed 0d 01 2c 0d 6d 3d 6d  |*1.5.."....,.m=m|
00000170  61 78 2a 31 2e 35 0d 01  36 0d 74 6f 67 6f 3d 6d  |ax*1.5..6.togo=m|
00000180  6f 73 74 0d 01 40 04 0d  01 4a 05 f5 0d 01 54 13  |ost..@...J....T.|
00000190  20 e3 20 69 3d 30 20 b8  20 6d 6f 73 74 2d 31 0d  | . i=0 . most-1.|
000001a0  01 5e 10 20 20 e7 20 72  28 69 29 3e 30 20 8c 0d  |.^.  . r(i)>0 ..|
000001b0  01 68 1c 20 20 63 3d 28  63 28 69 29 2d 72 28 69  |.h.  c=(c(i)-r(i|
000001c0  29 29 2a 32 35 35 2f 63  28 69 29 0d 01 72 0d 20  |))*255/c(i)..r. |
000001d0  20 e6 20 63 2c 63 2c 63  0d 01 7c 1a 20 20 c8 8f  | . c,c,c..|.  ..|
000001e0  20 c8 90 20 78 28 69 29  2c 79 28 69 29 2c 72 28  | .. x(i),y(i),r(|
000001f0  69 29 0d 01 86 11 20 20  72 28 69 29 3d 72 28 69  |i)....  r(i)=r(i|
00000200  29 2d 32 0d 01 90 17 20  20 e7 20 72 28 69 29 3c  |)-2....  . r(i)<|
00000210  3d 30 20 74 6f 67 6f 2d  3d 31 0d 01 9a 07 20 20  |=0 togo-=1....  |
00000220  cd 0d 01 a4 06 20 ed 0d  01 ae 0c fd 20 74 6f 67  |..... ...... tog|
00000230  6f 3d 30 0d 01 b8 06 e7  a5 0d 01 c2 05 e0 0d 01  |o=0.............|
00000240  cc 04 0d 01 d6 0f dd 20  a4 72 61 64 28 78 2c 79  |....... .rad(x,y|
00000250  29 0d 01 e0 0b e7 20 6e  3e 30 20 8c 0d 01 ea 12  |)..... n>0 .....|
00000260  20 e3 20 72 3d 6d 69 6e  20 b8 20 6d 61 78 0d 01  | . r=min . max..|
00000270  f4 11 20 20 e3 20 69 3d  30 20 b8 20 6e 2d 31 0d  |..  . i=0 . n-1.|
00000280  01 fe 23 20 20 20 64 3d  b6 28 28 78 2d 78 28 69  |..#   d=.((x-x(i|
00000290  29 29 5e 32 20 2b 20 28  79 2d 79 28 69 29 29 5e  |))^2 + (y-y(i))^|
000002a0  32 29 0d 02 08 1f 20 20  20 e7 20 64 20 3c 20 72  |2)....   . d < r|
000002b0  2b 72 28 69 29 20 8c 20  3d 64 2d 72 28 69 29 2d  |+r(i) . =d-r(i)-|
000002c0  31 0d 02 12 07 20 20 ed  0d 02 1c 06 20 ed 0d 02  |1....  ..... ...|
000002d0  26 05 cd 0d 02 30 13 3d  6d 69 6e 2b b3 28 6d 61  |&....0.=min+.(ma|
000002e0  78 2d 6d 69 6e 29 0d 02  3a 04 0d 02 44 0f f4 20  |x-min)..:...D.. |
000002f0  3e 50 52 4f 43 6d 6f 64  65 0d 02 4e 2e f4 20 53  |>PROCmode..N.. S|
00000300  61 6d 65 20 61 73 20 42  41 53 49 43 20 4d 4f 44  |ame as BASIC MOD|
00000310  45 20 22 58 2e 2e 2e 20  59 2e 2e 2e 20 43 2e 2e  |E "X... Y... C..|
00000320  2e 22 20 65 74 63 2e 0d  02 58 2b f4 20 62 75 74  |." etc...X+. but|
00000330  20 75 73 65 73 20 61 20  6d 6f 64 65 20 73 65 6c  | uses a mode sel|
00000340  65 63 74 6f 72 20 69 6e  73 74 65 61 64 20 6f 66  |ector instead of|
00000350  20 61 0d 02 62 2a f4 20  63 61 6c 6c 20 74 6f 20  | a..b*. call to |
00000360  57 69 6d 70 4d 6f 64 65  20 74 68 75 73 20 70 72  |WimpMode thus pr|
00000370  65 73 65 72 76 69 6e 67  20 74 68 65 0d 02 6c 14  |eserving the..l.|
00000380  f4 20 64 65 73 6b 74 6f  70 27 73 20 6d 6f 64 65  |. desktop's mode|
00000390  0d 02 76 05 e0 0d 02 80  05 3a 0d 02 8a 12 dd 20  |..v......:..... |
000003a0  f2 6d 6f 64 65 28 6d 6f  64 65 24 29 0d 02 94 17  |.mode(mode$)....|
000003b0  ea 20 63 24 2c 65 78 2c  65 79 2c 6d 6f 64 65 2c  |. c$,ex,ey,mode,|
000003c0  65 6e 64 0d 02 9e 0d de  20 6d 6f 64 65 20 36 34  |end..... mode 64|
000003d0  0d 02 a8 0f 65 6e 64 3d  6d 6f 64 65 2b 32 30 0d  |....end=mode+20.|
000003e0  02 b2 0b 21 6d 6f 64 65  3d 31 0d 02 bc 1d 6d 6f  |...!mode=1....mo|
000003f0  64 65 21 34 3d bb a4 5f  6d 28 6d 6f 64 65 24 2c  |de!4=.._m(mode$,|
00000400  22 58 22 2c 22 22 29 0d  02 c6 1d 6d 6f 64 65 21  |"X","")....mode!|
00000410  38 3d bb a4 5f 6d 28 6d  6f 64 65 24 2c 22 59 22  |8=.._m(mode$,"Y"|
00000420  2c 22 22 29 0d 02 d0 19  63 24 3d a4 5f 6d 28 6d  |,"")....c$=._m(m|
00000430  6f 64 65 24 2c 22 43 22  2c 22 2a 22 29 0d 02 da  |ode$,"C","*")...|
00000440  0e e7 20 63 24 3d 22 2a  22 20 8c 0d 02 e4 19 20  |.. c$="*" ..... |
00000450  63 24 3d a4 5f 6d 28 6d  6f 64 65 24 2c 22 47 22  |c$=._m(mode$,"G"|
00000460  2c 22 22 29 0d 02 ee 27  20 e7 20 63 24 3d 22 32  |,"")...' . c$="2|
00000470  35 36 22 20 21 65 6e 64  3d 33 3a 65 6e 64 21 34  |56" !end=3:end!4|
00000480  3d 32 35 35 3a 65 6e 64  2b 3d 38 0d 02 f8 05 cd  |=255:end+=8.....|
00000490  0d 03 02 15 6d 6f 64 65  21 31 32 3d a4 5f 62 70  |....mode!12=._bp|
000004a0  70 28 63 24 29 0d 03 0c  20 6d 6f 64 65 21 31 36  |p(c$)... mode!16|
000004b0  3d bb a4 5f 6d 28 6d 6f  64 65 24 2c 22 46 22 2c  |=.._m(mode$,"F",|
000004c0  22 2d 31 22 29 0d 03 16  1c 65 78 3d bb a4 5f 6d  |"-1")....ex=.._m|
000004d0  28 6d 6f 64 65 24 2c 22  45 58 22 2c 22 2d 31 22  |(mode$,"EX","-1"|
000004e0  29 0d 03 20 23 e7 20 65  78 3c 3e 2d 31 20 21 65  |).. #. ex<>-1 !e|
000004f0  6e 64 3d 34 3a 65 6e 64  21 34 3d 65 78 3a 65 6e  |nd=4:end!4=ex:en|
00000500  64 2b 3d 38 0d 03 2a 1c  65 79 3d bb a4 5f 6d 28  |d+=8..*.ey=.._m(|
00000510  6d 6f 64 65 24 2c 22 45  59 22 2c 22 2d 31 22 29  |mode$,"EY","-1")|
00000520  0d 03 34 23 e7 20 65 79  3c 3e 2d 31 20 21 65 6e  |..4#. ey<>-1 !en|
00000530  64 3d 35 3a 65 6e 64 21  34 3d 65 79 3a 65 6e 64  |d=5:end!4=ey:end|
00000540  2b 3d 38 0d 03 3e 0b 21  65 6e 64 3d 2d 31 0d 03  |+=8..>.!end=-1..|
00000550  48 0a eb 20 6d 6f 64 65  0d 03 52 05 e1 0d 03 5c  |H.. mode..R....\|
00000560  04 0d 03 66 13 dd 20 a4  5f 6d 28 73 24 2c 70 24  |...f.. ._m(s$,p$|
00000570  2c 64 24 29 0d 03 70 09  ea 20 69 2c 6a 0d 03 7a  |,d$)..p.. i,j..z|
00000580  0d 69 3d a7 73 24 2c 70  24 29 0d 03 84 25 e7 20  |.i=.s$,p$)...%. |
00000590  69 3c 31 20 80 20 64 24  3d 22 22 20 85 20 34 39  |i<1 . d$="" . 49|
000005a0  30 2c 22 4d 69 73 73 69  6e 67 20 22 2b 70 24 0d  |0,"Missing "+p$.|
000005b0  03 8e 0f e7 20 69 3c 31  20 8c 20 3d 64 24 0d 03  |.... i<1 . =d$..|
000005c0  98 16 6a 3d a7 73 24 2b  22 20 22 2c 22 20 22 2c  |..j=.s$+" "," ",|
000005d0  69 2b 31 29 0d 03 a2 13  3d c1 73 24 2c 69 2b 31  |i+1)....=.s$,i+1|
000005e0  2c 6a 2d 69 2d 31 29 0d  03 ac 04 0d 03 b6 0f dd  |,j-i-1).........|
000005f0  20 a4 5f 62 70 70 28 6e  24 29 0d 03 c0 0b c8 8e  | ._bpp(n$)......|
00000600  20 6e 24 20 ca 0d 03 ca  0d 20 c9 20 22 32 22 3a  | n$ ..... . "2":|
00000610  3d 30 0d 03 d4 0d 20 c9  20 22 34 22 3a 3d 31 0d  |=0.... . "4":=1.|
00000620  03 de 0e 20 c9 20 22 31  36 22 3a 3d 32 0d 03 e8  |... . "16":=2...|
00000630  0f 20 c9 20 22 32 35 36  22 3a 3d 33 0d 03 f2 21  |. . "256":=3...!|
00000640  20 c9 20 22 33 32 54 22  2c 22 33 32 74 22 2c 22  | . "32T","32t","|
00000650  33 32 4b 22 2c 22 33 32  6b 22 3a 3d 34 0d 03 fc  |32K","32k":=4...|
00000660  15 20 c9 20 22 31 36 4d  22 2c 22 31 36 6d 22 3a  |. . "16M","16m":|
00000670  3d 35 0d 04 06 21 20 7f  3a 20 85 20 34 39 30 2c  |=5...! .: . 490,|
00000680  22 42 61 64 20 70 61 72  61 6d 65 74 65 72 20 22  |"Bad parameter "|
00000690  2b 6e 24 0d 04 10 05 cb  0d ff                    |+n$.......|
0000069a