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

StarInfo/Cooke/HSVpetals

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/HSVpetals
Read OK:
File size: 0617 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >HSVpetals
   20ON ERROR ERROR EXT ERR,REPORT$+" at line "+STR$ERL:END
   40PROCmode("X800 Y600 C32T"):OFF
   50max=100
   60size=80
   70rad=800
   80DIM a(max),r(max)
   81SYS "OS_SWINumberFromString",,"ColourTrans_ConvertHSVToRGB" TO hsv_rgb
   90r=size
  100FOR i=0 TO max-1
  110 REPEAT
  120  a(i)=RND(1)*360
  130  r(i)=RND(rad)
  140  x=800+SINRAD(a(i))*r(i)
  150  y=600+COSRAD(a(i))*r(i)
  160 UNTIL POINT(x,y)=0
  170 CIRCLE FILL x,y,r
  180NEXT
  190CLS
  200REPEAT
  210 FOR i=0 TO max-1
  220  H=a(i)*65536
  230  S=r(i)*65536/rad
  240  V=(size-r)*65536/size
  250  SYS hsv_rgb,H,S,V TO R,G,B
  260  x=800+SINRAD(a(i))*(r(i)-r*2)
  270  y=600+COSRAD(a(i))*(r(i)-r*2)
  280  GCOL R>>8,G>>8,B>>8
  290  CIRCLE FILL x,y,r
  300 NEXT
  310 r=r*.95
  320UNTIL r<1
  330IFGET
  340REM >PROCmode
  350REM Same as BASIC MODE "X... Y... C..." etc.
  360REM but uses a mode selector instead of a
  370REM call to WimpMode thus preserving the
  380REM desktop's mode
  390END
  400:
  410DEF PROCmode(mode$)
  420LOCAL c$,ex,ey,mode,end
  430DIM mode 64
  440end=mode+20
  450!mode=1
  460mode!4=VALFN_m(mode$,"X","")
  470mode!8=VALFN_m(mode$,"Y","")
  480c$=FN_m(mode$,"C","*")
  490IF c$="*" THEN
  500 c$=FN_m(mode$,"G","")
  510 IF c$="256" !end=3:end!4=255:end+=8
  520ENDIF
  530mode!12=FN_bpp(c$)
  540mode!16=VALFN_m(mode$,"F","-1")
  550ex=VALFN_m(mode$,"EX","-1")
  560IF ex<>-1 !end=4:end!4=ex:end+=8
  570ey=VALFN_m(mode$,"EY","-1")
  580IF ey<>-1 !end=5:end!4=ey:end+=8
  590!end=-1
  600MODE mode
  610ENDPROC
  620
  630DEF FN_m(s$,p$,d$)
  640LOCAL i,j
  650i=INSTR(s$,p$)
  660IF i<1 AND d$="" ERROR 490,"Missing "+p$
  670IF i<1 THEN =d$
  680j=INSTR(s$+" "," ",i+1)
  690=MID$(s$,i+1,j-i-1)
  700
  710DEF FN_bpp(n$)
  720CASE n$ OF
  730 WHEN "2":=0
  740 WHEN "4":=1
  750 WHEN "16":=2
  760 WHEN "256":=3
  770 WHEN "32T","32t","32K","32k":=4
  780 WHEN "16M","16m":=5
  790 OTHERWISE: ERROR 490,"Bad parameter "+n$
  800ENDCASE

� >HSVpetals
!� � � � �,�$+" at line "+Þ:�
(�mode("X800 Y600 C32T"):�
2max=100
<size=80
Frad=800
P� a(max),r(max)
QHș "OS_SWINumberFromString",,"ColourTrans_ConvertHSVToRGB" � hsv_rgb
Z
r=size
d� i=0 � max-1
n �
x  a(i)=�(1)*360
�  r(i)=�(rad)
�  x=800+��(a(i))*r(i)
�  y=600+��(a(i))*r(i)
� � �x,y)=0
� ȏ Ȑ x,y,r
��
��
��
� � i=0 � max-1
�  H=a(i)*65536
�  S=r(i)*65536/rad
�  V=(size-r)*65536/size
�  ș hsv_rgb,H,S,V � R,G,B
  x=800+��(a(i))*(r(i)-r*2)
  y=600+��(a(i))*(r(i)-r*2)
  � R>>8,G>>8,B>>8
"  ȏ Ȑ x,y,r
, �
6 r=r*.95
@	� r<1
J�
T� >PROCmode
^.� Same as BASIC MODE "X... Y... C..." etc.
h+� but uses a mode selector instead of a
r*� call to WimpMode thus preserving the
|� desktop's mode
��
�:
�� �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")
0#� ex<>-1 !end=4:end!4=ex:end+=8
:ey=��_m(mode$,"EY","-1")
D#� ey<>-1 !end=5:end!4=ey:end+=8
N!end=-1
X
� mode
b�
l
v� �_m(s$,p$,d$)
�	� i,j
�
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 10 f4 20 3e 48  53 56 70 65 74 61 6c 73  |..... >HSVpetals|
00000010  0d 00 14 21 ee 20 85 20  85 20 a2 20 9f 2c f6 24  |...!. . . . .,.$|
00000020  2b 22 20 61 74 20 6c 69  6e 65 20 22 2b c3 9e 3a  |+" at line "+..:|
00000030  e0 0d 00 28 1d f2 6d 6f  64 65 28 22 58 38 30 30  |...(..mode("X800|
00000040  20 59 36 30 30 20 43 33  32 54 22 29 3a 87 0d 00  | Y600 C32T"):...|
00000050  32 0b 6d 61 78 3d 31 30  30 0d 00 3c 0b 73 69 7a  |2.max=100..<.siz|
00000060  65 3d 38 30 0d 00 46 0b  72 61 64 3d 38 30 30 0d  |e=80..F.rad=800.|
00000070  00 50 13 de 20 61 28 6d  61 78 29 2c 72 28 6d 61  |.P.. a(max),r(ma|
00000080  78 29 0d 00 51 48 c8 99  20 22 4f 53 5f 53 57 49  |x)..QH.. "OS_SWI|
00000090  4e 75 6d 62 65 72 46 72  6f 6d 53 74 72 69 6e 67  |NumberFromString|
000000a0  22 2c 2c 22 43 6f 6c 6f  75 72 54 72 61 6e 73 5f  |",,"ColourTrans_|
000000b0  43 6f 6e 76 65 72 74 48  53 56 54 6f 52 47 42 22  |ConvertHSVToRGB"|
000000c0  20 b8 20 68 73 76 5f 72  67 62 0d 00 5a 0a 72 3d  | . hsv_rgb..Z.r=|
000000d0  73 69 7a 65 0d 00 64 11  e3 20 69 3d 30 20 b8 20  |size..d.. i=0 . |
000000e0  6d 61 78 2d 31 0d 00 6e  06 20 f5 0d 00 78 13 20  |max-1..n. ...x. |
000000f0  20 61 28 69 29 3d b3 28  31 29 2a 33 36 30 0d 00  | a(i)=.(1)*360..|
00000100  82 11 20 20 72 28 69 29  3d b3 28 72 61 64 29 0d  |..  r(i)=.(rad).|
00000110  00 8c 19 20 20 78 3d 38  30 30 2b b5 b2 28 61 28  |...  x=800+..(a(|
00000120  69 29 29 2a 72 28 69 29  0d 00 96 19 20 20 79 3d  |i))*r(i)....  y=|
00000130  36 30 30 2b 9b b2 28 61  28 69 29 29 2a 72 28 69  |600+..(a(i))*r(i|
00000140  29 0d 00 a0 0e 20 fd 20  b0 78 2c 79 29 3d 30 0d  |).... . .x,y)=0.|
00000150  00 aa 10 20 c8 8f 20 c8  90 20 78 2c 79 2c 72 0d  |... .. .. x,y,r.|
00000160  00 b4 05 ed 0d 00 be 05  db 0d 00 c8 05 f5 0d 00  |................|
00000170  d2 12 20 e3 20 69 3d 30  20 b8 20 6d 61 78 2d 31  |.. . i=0 . max-1|
00000180  0d 00 dc 12 20 20 48 3d  61 28 69 29 2a 36 35 35  |....  H=a(i)*655|
00000190  33 36 0d 00 e6 16 20 20  53 3d 72 28 69 29 2a 36  |36....  S=r(i)*6|
000001a0  35 35 33 36 2f 72 61 64  0d 00 f0 1b 20 20 56 3d  |5536/rad....  V=|
000001b0  28 73 69 7a 65 2d 72 29  2a 36 35 35 33 36 2f 73  |(size-r)*65536/s|
000001c0  69 7a 65 0d 00 fa 1e 20  20 c8 99 20 68 73 76 5f  |ize....  .. hsv_|
000001d0  72 67 62 2c 48 2c 53 2c  56 20 b8 20 52 2c 47 2c  |rgb,H,S,V . R,G,|
000001e0  42 0d 01 04 1f 20 20 78  3d 38 30 30 2b b5 b2 28  |B....  x=800+..(|
000001f0  61 28 69 29 29 2a 28 72  28 69 29 2d 72 2a 32 29  |a(i))*(r(i)-r*2)|
00000200  0d 01 0e 1f 20 20 79 3d  36 30 30 2b 9b b2 28 61  |....  y=600+..(a|
00000210  28 69 29 29 2a 28 72 28  69 29 2d 72 2a 32 29 0d  |(i))*(r(i)-r*2).|
00000220  01 18 16 20 20 e6 20 52  3e 3e 38 2c 47 3e 3e 38  |...  . R>>8,G>>8|
00000230  2c 42 3e 3e 38 0d 01 22  11 20 20 c8 8f 20 c8 90  |,B>>8..".  .. ..|
00000240  20 78 2c 79 2c 72 0d 01  2c 06 20 ed 0d 01 36 0c  | x,y,r..,. ...6.|
00000250  20 72 3d 72 2a 2e 39 35  0d 01 40 09 fd 20 72 3c  | r=r*.95..@.. r<|
00000260  31 0d 01 4a 06 e7 a5 0d  01 54 0f f4 20 3e 50 52  |1..J.....T.. >PR|
00000270  4f 43 6d 6f 64 65 0d 01  5e 2e f4 20 53 61 6d 65  |OCmode..^.. Same|
00000280  20 61 73 20 42 41 53 49  43 20 4d 4f 44 45 20 22  | as BASIC MODE "|
00000290  58 2e 2e 2e 20 59 2e 2e  2e 20 43 2e 2e 2e 22 20  |X... Y... C..." |
000002a0  65 74 63 2e 0d 01 68 2b  f4 20 62 75 74 20 75 73  |etc...h+. but us|
000002b0  65 73 20 61 20 6d 6f 64  65 20 73 65 6c 65 63 74  |es a mode select|
000002c0  6f 72 20 69 6e 73 74 65  61 64 20 6f 66 20 61 0d  |or instead of a.|
000002d0  01 72 2a f4 20 63 61 6c  6c 20 74 6f 20 57 69 6d  |.r*. call to Wim|
000002e0  70 4d 6f 64 65 20 74 68  75 73 20 70 72 65 73 65  |pMode thus prese|
000002f0  72 76 69 6e 67 20 74 68  65 0d 01 7c 14 f4 20 64  |rving the..|.. d|
00000300  65 73 6b 74 6f 70 27 73  20 6d 6f 64 65 0d 01 86  |esktop's mode...|
00000310  05 e0 0d 01 90 05 3a 0d  01 9a 12 dd 20 f2 6d 6f  |......:..... .mo|
00000320  64 65 28 6d 6f 64 65 24  29 0d 01 a4 17 ea 20 63  |de(mode$)..... c|
00000330  24 2c 65 78 2c 65 79 2c  6d 6f 64 65 2c 65 6e 64  |$,ex,ey,mode,end|
00000340  0d 01 ae 0d de 20 6d 6f  64 65 20 36 34 0d 01 b8  |..... mode 64...|
00000350  0f 65 6e 64 3d 6d 6f 64  65 2b 32 30 0d 01 c2 0b  |.end=mode+20....|
00000360  21 6d 6f 64 65 3d 31 0d  01 cc 1d 6d 6f 64 65 21  |!mode=1....mode!|
00000370  34 3d bb a4 5f 6d 28 6d  6f 64 65 24 2c 22 58 22  |4=.._m(mode$,"X"|
00000380  2c 22 22 29 0d 01 d6 1d  6d 6f 64 65 21 38 3d bb  |,"")....mode!8=.|
00000390  a4 5f 6d 28 6d 6f 64 65  24 2c 22 59 22 2c 22 22  |._m(mode$,"Y",""|
000003a0  29 0d 01 e0 19 63 24 3d  a4 5f 6d 28 6d 6f 64 65  |)....c$=._m(mode|
000003b0  24 2c 22 43 22 2c 22 2a  22 29 0d 01 ea 0e e7 20  |$,"C","*")..... |
000003c0  63 24 3d 22 2a 22 20 8c  0d 01 f4 19 20 63 24 3d  |c$="*" ..... c$=|
000003d0  a4 5f 6d 28 6d 6f 64 65  24 2c 22 47 22 2c 22 22  |._m(mode$,"G",""|
000003e0  29 0d 01 fe 27 20 e7 20  63 24 3d 22 32 35 36 22  |)...' . c$="256"|
000003f0  20 21 65 6e 64 3d 33 3a  65 6e 64 21 34 3d 32 35  | !end=3:end!4=25|
00000400  35 3a 65 6e 64 2b 3d 38  0d 02 08 05 cd 0d 02 12  |5:end+=8........|
00000410  15 6d 6f 64 65 21 31 32  3d a4 5f 62 70 70 28 63  |.mode!12=._bpp(c|
00000420  24 29 0d 02 1c 20 6d 6f  64 65 21 31 36 3d bb a4  |$)... mode!16=..|
00000430  5f 6d 28 6d 6f 64 65 24  2c 22 46 22 2c 22 2d 31  |_m(mode$,"F","-1|
00000440  22 29 0d 02 26 1c 65 78  3d bb a4 5f 6d 28 6d 6f  |")..&.ex=.._m(mo|
00000450  64 65 24 2c 22 45 58 22  2c 22 2d 31 22 29 0d 02  |de$,"EX","-1")..|
00000460  30 23 e7 20 65 78 3c 3e  2d 31 20 21 65 6e 64 3d  |0#. ex<>-1 !end=|
00000470  34 3a 65 6e 64 21 34 3d  65 78 3a 65 6e 64 2b 3d  |4:end!4=ex:end+=|
00000480  38 0d 02 3a 1c 65 79 3d  bb a4 5f 6d 28 6d 6f 64  |8..:.ey=.._m(mod|
00000490  65 24 2c 22 45 59 22 2c  22 2d 31 22 29 0d 02 44  |e$,"EY","-1")..D|
000004a0  23 e7 20 65 79 3c 3e 2d  31 20 21 65 6e 64 3d 35  |#. ey<>-1 !end=5|
000004b0  3a 65 6e 64 21 34 3d 65  79 3a 65 6e 64 2b 3d 38  |:end!4=ey:end+=8|
000004c0  0d 02 4e 0b 21 65 6e 64  3d 2d 31 0d 02 58 0a eb  |..N.!end=-1..X..|
000004d0  20 6d 6f 64 65 0d 02 62  05 e1 0d 02 6c 04 0d 02  | mode..b....l...|
000004e0  76 13 dd 20 a4 5f 6d 28  73 24 2c 70 24 2c 64 24  |v.. ._m(s$,p$,d$|
000004f0  29 0d 02 80 09 ea 20 69  2c 6a 0d 02 8a 0d 69 3d  |)..... i,j....i=|
00000500  a7 73 24 2c 70 24 29 0d  02 94 25 e7 20 69 3c 31  |.s$,p$)...%. i<1|
00000510  20 80 20 64 24 3d 22 22  20 85 20 34 39 30 2c 22  | . d$="" . 490,"|
00000520  4d 69 73 73 69 6e 67 20  22 2b 70 24 0d 02 9e 0f  |Missing "+p$....|
00000530  e7 20 69 3c 31 20 8c 20  3d 64 24 0d 02 a8 16 6a  |. i<1 . =d$....j|
00000540  3d a7 73 24 2b 22 20 22  2c 22 20 22 2c 69 2b 31  |=.s$+" "," ",i+1|
00000550  29 0d 02 b2 13 3d c1 73  24 2c 69 2b 31 2c 6a 2d  |)....=.s$,i+1,j-|
00000560  69 2d 31 29 0d 02 bc 04  0d 02 c6 0f dd 20 a4 5f  |i-1)......... ._|
00000570  62 70 70 28 6e 24 29 0d  02 d0 0b c8 8e 20 6e 24  |bpp(n$)...... n$|
00000580  20 ca 0d 02 da 0d 20 c9  20 22 32 22 3a 3d 30 0d  | ..... . "2":=0.|
00000590  02 e4 0d 20 c9 20 22 34  22 3a 3d 31 0d 02 ee 0e  |... . "4":=1....|
000005a0  20 c9 20 22 31 36 22 3a  3d 32 0d 02 f8 0f 20 c9  | . "16":=2.... .|
000005b0  20 22 32 35 36 22 3a 3d  33 0d 03 02 21 20 c9 20  | "256":=3...! . |
000005c0  22 33 32 54 22 2c 22 33  32 74 22 2c 22 33 32 4b  |"32T","32t","32K|
000005d0  22 2c 22 33 32 6b 22 3a  3d 34 0d 03 0c 15 20 c9  |","32k":=4.... .|
000005e0  20 22 31 36 4d 22 2c 22  31 36 6d 22 3a 3d 35 0d  | "16M","16m":=5.|
000005f0  03 16 21 20 7f 3a 20 85  20 34 39 30 2c 22 42 61  |..! .: . 490,"Ba|
00000600  64 20 70 61 72 61 6d 65  74 65 72 20 22 2b 6e 24  |d parameter "+n$|
00000610  0d 03 20 05 cb 0d ff                              |.. ....|
00000617