Home » Personal collection » Acorn hard disk » files » BASIC » Spirograph

Spirograph

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 » Acorn hard disk » files » BASIC
Filename: Spirograph
Read OK:
File size: 1F14 bytes
Load address: 0000
Exec address: 0000
Duplicates

There are 2 duplicate copies of this file in the archive:

File contents
    1REM >Spirograph
    2REM BY Andy Pillidge
    3REM
    4REM
    5
    6MODE 15
    7OFF
    8@%=4
    9
   10DIM icons%(4,8),linedata%(50,5)
   11PROCCDraw_initialise("Spirograph",1,&32000)
   12PROCreadicondata
   13ORIGIN 512,512
   14VDU 28,64,31,79,0
   15MOUSE ON
   16toothsize%=12
   17teeth1%=192:teeth2%=80:colour%=7:hole%=3:starttooth%=0
   18lines%=0
   19file=FALSE
   20rings%=FALSE
   21GCOL 0 TINT 192
   22
   23CLS:OFF
   24PROCsetupmenu
   25
   26REPEAT
   27TIME=0:REPEAT:UNTIL TIME>=20
   28REPEAT
   29MOUSE x%,y%,b%
   30IF x%>=512 AND NOT rings% THEN PROCdrawrings:rings%=TRUE
   31IF x%<512 AND rings% THEN PROCdrawrings:rings%=FALSE
   32UNTIL (b% AND 5)<>0
   33IF rings% THEN PROCdrawrings:rings%=FALSE
   34
   35choice%=0
   36FOR yy%=1 TO 8
   37IF x%>=icons%(1,yy%) AND x%<=icons%(1,yy%)+48 AND y%>=icons%(2,yy%) AND y%<=icons%(2,yy%)+32 THEN choice%=yy%
   38NEXT
   39
   40IF x%>=512 AND x%<=640 AND y%>=392 AND y%<=424 THEN choice%=9
   41IF x%>=512 AND x%<=768 AND y%>=-512 AND y%<=-256 THEN choice%=10
   42IF x%>=512 AND x%<=768 AND y%>=328 AND y%<=360 THEN choice%=11
   43IF x%>=512 AND x%<=640 AND y%>=456 AND y%<=488 THEN choice%=12
   44IF INKEY(-1) OR (b% AND 1)<>0 THEN shift%=5 ELSE shift%=1
   45
   46CASE choice% OF
   47WHEN 5:PROCring(shift%)
   48WHEN 1:PROCring(-shift%)
   49WHEN 6:PROCwheel(shift%)
   50WHEN 2:PROCwheel(-shift%)
   51WHEN 7:PROChole(shift%)
   52WHEN 3:PROChole(-shift%)
   53WHEN 8:PROCstart(shift%)
   54WHEN 4:PROCstart(-shift%)
   55WHEN 9:PROCdrawline
   56WHEN 10:PROCcolsel
   57WHEN 11:PROCclear
   58WHEN 12:PROCdrawfile
   59ENDCASE
   60UNTIL FALSE
   61END
   62
   63DEF PROCdrawfile
   64IF lines%=0 THEN ENDPROC
   65VDU 4
   66INPUT TAB(0,21)"Make Drawfile:"'f$
   67OFF
   68PRINT TAB(0,21)STRING$(14,CHR$32),TAB(0,22)STRING$(14,CHR$32)
   69IF f$="" THEN ENDPROC
   70file=TRUE
   71GCOL 0,0 TINT 0
   72RECTANGLE FILL -512,-512,1024,1024
   73GCOL 0,0 TINT 192
   74FOR l%=1 TO lines%
   75teeth1%=linedata%(l%,1):teeth2%=linedata%(l%,2):starttooth%=linedata%(l%,3):hole%=linedata%(l%,4):colour%=linedata%(l%,5)
   76PROCdrawline
   77NEXT
   78PROCCDraw_savefile(f$)
   79file=FALSE
   80ENDPROC
   81
   82DEF PROCdrawline
   83GCOL 0,colour%
   84radius1=teeth1%*toothsize%/2/PI
   85radius2=teeth2%*toothsize%/2/PI
   86holeradius=radius2-hole%*8
   87repts%=FNcalcrepts(teeth1%,teeth2%)
   88tooth%=starttooth%
   89PROCspiro(tooth%,teeth1%,teeth2%,holeradius,colour%)
   90IF file THEN PROCCDraw_openpath(-1,colour%,0,0):PROCCDraw_extendpath("MOVE "+STR$(x2+512)+" "+STR$(y2+512))
   91GCOL 0,colour%:POINT x2,y2
   92
   93FOR loop%=1 TO repts%
   94FOR n%=1 TO teeth1%
   95tooth%+=1
   96PROCspiro(tooth%,teeth1%,teeth2%,holeradius,colour%)
   97GCOL 0,colour%:DRAW x2,y2
   98IF file THEN PROCCDraw_extendpath("DRAW "+STR$(x2+512)+" "+STR$(y2+512))
   99NEXT
  100NEXT
  101
  102IF file THEN PROCCDraw_extendpath("CLOSE"):PROCCDraw_closepath
  103lines%+=1
  104linedata%(lines%,1)=teeth1%:linedata%(lines%,2)=teeth2%:linedata%(lines%,3)=starttooth%:linedata%(lines%,4)=hole%::linedata%(lines%,5)=colour%
  105
  106ENDPROC
  107
  108DEF PROCspiro(tooth%,teeth1%,teeth2%,holeradius,colour%)
  109angle1=(tooth%+starttooth%)/teeth1%*360
  110angle2=tooth%/teeth2%*360
  111angle3=angle1-angle2
  112x1=radius1*SINRAD(angle1)*(1-radius2/radius1)
  113y1=radius1*COSRAD(angle1)*(1-radius2/radius1)
  114x2=x1+(radius2*SINRAD(angle3)*holeradius/radius2)
  115y2=y1+(radius2*COSRAD(angle3)*holeradius/radius2)
  116ENDPROC
  117
  118DEF PROCdrawrings
  119GCOL 3,63
  120radius1=teeth1%*toothsize%/2/PI
  121radius2=teeth2%*toothsize%/2/PI
  122CIRCLE 0,0,radius1
  123angle1=starttooth%/teeth1%*360
  124x1=radius1*SINRAD(angle1)*(1-radius2/radius1)
  125y1=radius1*COSRAD(angle1)*(1-radius2/radius1)
  126CIRCLE x1,y1,radius2
  127holeradius=radius2-hole%*8
  128x2=radius1*SINRAD(angle1)*(1-(radius2-holeradius)/radius1)
  129y2=radius1*COSRAD(angle1)*(1-(radius2-holeradius)/radius1)
  130CIRCLE x2,y2,4
  131ENDPROC
  132
  133DEF FNcalcrepts(teeth1%,teeth2%)
  134n%=0
  135REPEAT
  136n%+=1
  137UNTIL teeth1%*n%/teeth2%=INT(teeth1%*n%/teeth2%)
  138=n%
  139
  140DEF PROCring(d%)
  141teeth1%+=d%
  142PRINT TAB(4,8)teeth1%
  143PRINTTAB(4,20)teeth1%*FNcalcrepts(teeth1%,teeth2%) DIV teeth2%
  144ENDPROC
  145
  146DEFPROCwheel(d%)
  147teeth2%+=d%
  148PRINT TAB(4,11)teeth2%
  149PRINTTAB(4,20)teeth1%*FNcalcrepts(teeth1%,teeth2%) DIV teeth2%
  150ENDPROC
  151
  152DEFPROChole(d%)
  153hole%+=d%
  154PRINTTAB(4,14)hole%
  155PRINTTAB(4,20)teeth1%*FNcalcrepts(teeth1%,teeth2%) DIV teeth2%
  156ENDPROC
  157
  158DEF PROCstart(d%)
  159starttooth%+=d%
  160PRINTTAB(4,17)starttooth%
  161PRINTTAB(4,20)teeth1%*FNcalcrepts(teeth1%,teeth2%) DIV teeth2%
  162ENDPROC
  163
  164DEF PROCcolsel
  165xc%=x%-512
  166yc%=y%+512
  167GCOL 3,63:VDU 5:MOVE (colour% DIV 8)*32+512,(colour% MOD 8)*32-480:PRINT CHR$ 143
  168colour%=(xc% DIV 32)*8+(yc% DIV 32)
  169MOVE (colour% DIV 8)*32+512,(colour% MOD 8)*32-480:PRINT CHR$ 143
  170VDU 4:OFF
  171ENDPROC
  172
  173DEF PROCclear
  174GCOL 0,0 TINT 0
  175RECTANGLE FILL -512,-512,1024,1024
  176lines%=0
  177GCOL 0,0 TINT 192
  178PROCCDraw_reset
  179ENDPROC
  180
  181DEF PROCsetupmenu
  182PRINTTAB(0,7)"Ring size",TAB(4,8)teeth1%
  183PRINTTAB(0,10)"Wheel size",TAB(4,11)teeth2%
  184PRINTTAB(0,13)"Hole number",TAB(4,14)hole%
  185PRINTTAB(0,16)"Start tooth",TAB(4,17)starttooth%
  186PRINTTAB(0,19)"Points",TAB(4,20)teeth1%*FNcalcrepts(teeth1%,teeth2%) DIV teeth2%
  187VDU 5
  188GCOL 3,56
  189FOR y%=1 TO 8
  190RECTANGLE FILL icons%(1,y%),icons%(2,y%),48,28
  191MOVE icons%(1,y%)+16,icons%(2,y%)+31:PRINTCHR$(138+(y%-1)DIV4)
  192NEXT
  193VDU4
  194
  195GCOL 3,3
  196RECTANGLE FILL 512,392,128,32
  197VDU 5
  198MOVE 544,424:PRINT"Draw"
  199GCOL 3,12
  200RECTANGLE FILL 512,328,128,32
  201MOVE 544,360:PRINT"Clear"
  202GCOL 3,42
  203RECTANGLE FILL 512,456,128,32
  204MOVE 544,488:PRINT"File"
  205VDU 4:OFF
  206FOR x%=0 TO 7:FOR y%=0 TO 7
  207GCOL x%*8+y% TINT 192
  208RECTANGLE FILL (x%*32)+512,(y%*32)-512,24,24
  209NEXT:NEXT
  210GCOL 3,63:VDU 5:MOVE (colour% DIV 8)*32+512,(colour% MOD 8)*32-480:PRINT CHR$ 143:VDU 4:OFF
  211ENDPROC
  212
  213DEF PROCreadicondata
  214FOR Y%=1 TO 8
  215FOR X%=1 TO 2
  216READ icons%(X%,Y%)
  217NEXT:NEXT
  218ENDPROC
  219
  220DATA 512,224
  221DATA 512,128
  222DATA 512,32
  223DATA 512,-64
  224
  225DATA 672,224
  226DATA 672,128
  227DATA 672,32
  228DATA 672,-64
  229
  230DEFPROCCDraw_initialise(appl_name$, nfonts%, size%)
  231DIM _buffer% size%
  232_ptr%=_buffer%
  233$_ptr%=LEFT$("Draw"+CHR$201+STRING$(12,CHR$(0)),12)
  234_ptr%+=12
  235$_ptr%=LEFT$(appl_name$+STRING$(12," "),12)
  236DIM CDraw_font$(nfonts%+1), _colours% 20*4, _dash$(4)
  237SYS"Wimp_ReadPalette",,_colours%
  238_dash$(1)=STRING$(6,CHR$0+CHR$9+CHR$0+CHR$0)
  239_dash$(2)=STRING$(6,CHR$0+CHR$18+CHR$0+CHR$0)
  240_dash$(3)=STRING$(6,CHR$0+CHR$36+CHR$0+CHR$0)
  241_dash$(4)=CHR$0+CHR$36+CHR$0+CHR$0+STRING$(3,CHR$0+CHR$9+CHR$0+CHR$0)
  242_flags%=&20100042
  243PROCCDraw_reset
  244_flags%=&20100042
  245CDraw_nofill%=-1
  246CDraw%=TRUE
  247ENDPROC
  248
  249DEFPROCCDraw_reset
  250_ptr%=_buffer%+40
  251_olx%=1<<30:_oby%=1<<30
  252_orx%=0:_oty%=0
  253ENDPROC
  254
  255DEFPROCCDraw_savefile(f$)
  256IF CDraw% THEN
  257_buffer%!24=_olx%
  258_buffer%!28=_oby%
  259_buffer%!32=_orx%
  260_buffer%!36=_oty%
  261SYS"OS_File",10,f$,&AFF,,_buffer%,_ptr%
  262ENDIF
  263ENDPROC
  264
  265DEFFN_colour(c%)
  266IF c%>=0 THEN =((c%AND&03)*80+((c%>>2)AND&03)*80*&100+((c%>>4)AND&03)*80*&10000)<<8 ELSE =-1
  267REM  IF c%>=0 THEN =!(_colours%+c%*4) AND &FFFFFF00 ELSE =-1
  268
  269DEFPROC_checkspace(lx%,by%,rx%,ty%)
  270IF lx%<_olx% THEN _olx%=lx%
  271IF by%<_oby% THEN _oby%=by%
  272IF rx%>_orx% THEN _orx%=rx%
  273IF ty%>_oty% THEN _oty%=ty%
  274ENDPROC
  275
  276DEFPROC_putword(W%)
  277!_ptr%=W%
  278_ptr%+=4
  279ENDPROC
  280
  281DEFPROC_putwords(X%,Y%)
  282X%=X%<<8:Y%=Y%<<8
  283IF X%<_start%!8 THEN _start%!8 =X%
  284IF Y%<_start%!12 THEN _start%!12 =Y%
  285IF X%>_start%!16 THEN _start%!16 =X%
  286IF Y%>_start%!20 THEN _start%!20=Y%
  287PROC_putword(X%):PROC_putword(Y%)
  288ENDPROC
  289
  290DEFPROC_putcoords(_start%, lx%, by%, rx%, ty%)
  291_start%!0=lx%<<8
  292_start%!4=by%<<8
  293_start%!8=rx%<<8
  294_start%!12=ty%<<8
  295ENDPROC
  296
  297DEFPROCCDraw_pathobject(fill%, col%, thick%, dash%, path$)
  298PROCCDraw_openpath(fill%, col%, thick%, dash%)
  299PROCCDraw_extendpath(path$)
  300PROCCDraw_closepath
  301ENDPROC
  302
  303DEFPROCCDraw_openpath(fill%, col%, thick%, dash%)
  304IF CDraw% THEN
  305LOCAL pattern$,I%
  306_start%=_ptr%
  307PROC_putword(2)
  308_ptr%+=20
  309PROC_putcoords(_start%+8,1<<30,1<<30,0,0)
  310PROC_putword(FN_colour(fill%))
  311PROC_putword(FN_colour(col%))
  312PROC_putword(thick%<<8)
  313PROC_putword(_flags% OR &80*-(dash%<>0))
  314IF dash%>0 THEN
  315pattern$=_dash$(dash%)
  316PROC_putword(0)
  317PROC_putword(LENpattern$/4)
  318FOR I%=1 TO LENpattern$
  319?_ptr%=ASCMID$(pattern$,I%,1)
  320_ptr%+=1
  321NEXTI%
  322ENDIF
  323ENDIF
  324ENDPROC
  325
  326DEFPROCCDraw_extendpath(path$)
  327LOCAL _pathtype%,I%
  328WHILE path$<>""
  329CASE FN_nextchunk(path$) OF
  330WHEN "MOVE" :_pathtype%=2
  331WHEN "CGAP" :_pathtype%=4
  332WHEN "CLOSE" :_pathtype%=5
  333WHEN "CURVE" :_pathtype%=6
  334WHEN "GAP" :_pathtype%=7
  335WHEN "DRAW" :_pathtype%=8
  336ENDCASE
  337IF _pathtype%<>0 THEN
  338PROC_putword(_pathtype%)
  339CASE _pathtype% OF
  340WHEN 2,3,7,8:
  341PROC_putpair(path$)
  342WHEN 6:
  343FOR I%=1 TO 3
  344PROC_putpair(path$)
  345NEXT I%
  346ENDCASE
  347ENDIF
  348ENDWHILE
  349ENDPROC
  350
  351DEFPROCCDraw_closepath
  352PROC_putword(0)
  353_start%!4=_ptr%-_start%
  354PROC_checkspace(_start%!8, _start%!12, _start%!16, _start%!20)
  355ENDPROC
  356
  357DEFFN_nextchunk(RETURN path$)
  358LOCAL P%,chunk$
  359P%=INSTR(path$+" "," ")
  360chunk$=LEFT$(path$,INSTR(path$+" "," ")-1)
  361path$=MID$(path$,P%+1)
  362=chunk$
  363
  364DEFPROC_putpair(RETURN path$)
  365LOCAL X%,Y%
  366X%=VALFN_nextchunk(path$)
  367Y%=VALFN_nextchunk(path$)
  368PROC_putwords(X%,Y%)
  369ENDPROC
� >Spirograph
� BY Andy Pillidge
�
�

� 15
�
@%=4
	

!� icons%(4,8),linedata%(50,5)
,�CDraw_initialise("Spirograph",1,&32000)
�readicondata

ȑ 512,512
� 28,64,31,79,0
ȗ �
toothsize%=12
:teeth1%=192:teeth2%=80:colour%=7:hole%=3:starttooth%=0
lines%=0

file=�
rings%=�
� 0 Ȝ 192

�:�
�setupmenu

�
�=0:�:� �>=20
�
ȗ x%,y%,b%
.� x%>=512 � � rings% � �drawrings:rings%=�
+� x%<512 � rings% � �drawrings:rings%=�
 � (b% � 5)<>0
!"� rings% � �drawrings:rings%=�
"
#
choice%=0
$� yy%=1 � 8
%g� x%>=icons%(1,yy%) � x%<=icons%(1,yy%)+48 � y%>=icons%(2,yy%) � y%<=icons%(2,yy%)+32 � choice%=yy%
&�
'
(7� x%>=512 � x%<=640 � y%>=392 � y%<=424 � choice%=9
):� x%>=512 � x%<=768 � y%>=-512 � y%<=-256 � choice%=10
*8� x%>=512 � x%<=768 � y%>=328 � y%<=360 � choice%=11
+8� x%>=512 � x%<=640 � y%>=456 � y%<=488 � choice%=12
,/� �(-1) � (b% � 1)<>0 � shift%=5 � shift%=1
-
.Ȏ choice% �
/� 5:�ring(shift%)
0� 1:�ring(-shift%)
1� 6:�wheel(shift%)
2� 2:�wheel(-shift%)
3� 7:�hole(shift%)
4� 3:�hole(-shift%)
5� 8:�start(shift%)
6� 4:�start(-shift%)
7� 9:�drawline
8� 10:�colsel
9� 11:�clear
:� 12:�drawfile
;�
<� �
=�
>
?� �drawfile
@� lines%=0 � �
A� 4
B� �0,21)"Make Drawfile:"'f$
C�
D#� �0,21)�14,�32),�0,22)�14,�32)
E� f$="" � �
F
file=�
G� 0,0 Ȝ 0
Hȓ Ȑ -512,-512,1024,1024
I� 0,0 Ȝ 192
J� l%=1 � lines%
K}teeth1%=linedata%(l%,1):teeth2%=linedata%(l%,2):starttooth%=linedata%(l%,3):hole%=linedata%(l%,4):colour%=linedata%(l%,5)
L
�drawline
M�
N�CDraw_savefile(f$)
O
file=�
P�
Q
R� �drawline
S� 0,colour%
T"radius1=teeth1%*toothsize%/2/�
U"radius2=teeth2%*toothsize%/2/�
Vholeradius=radius2-hole%*8
W&repts%=�calcrepts(teeth1%,teeth2%)
Xtooth%=starttooth%
Y5�spiro(tooth%,teeth1%,teeth2%,holeradius,colour%)
Z_� file � �CDraw_openpath(-1,colour%,0,0):�CDraw_extendpath("MOVE "+�(x2+512)+" "+�(y2+512))
[� 0,colour%:Ȓ x2,y2
\
]� loop%=1 � repts%
^� n%=1 � teeth1%
_
tooth%+=1
`5�spiro(tooth%,teeth1%,teeth2%,holeradius,colour%)
a� 0,colour%:� x2,y2
b?� file � �CDraw_extendpath("DRAW "+�(x2+512)+" "+�(y2+512))
c�
d�
e
f8� file � �CDraw_extendpath("CLOSE"):�CDraw_closepath
g
lines%+=1
h�linedata%(lines%,1)=teeth1%:linedata%(lines%,2)=teeth2%:linedata%(lines%,3)=starttooth%:linedata%(lines%,4)=hole%::linedata%(lines%,5)=colour%
i
j�
k
l7� �spiro(tooth%,teeth1%,teeth2%,holeradius,colour%)
m+angle1=(tooth%+starttooth%)/teeth1%*360
nangle2=tooth%/teeth2%*360
oangle3=angle1-angle2
p-x1=radius1*��(angle1)*(1-radius2/radius1)
q-y1=radius1*��(angle1)*(1-radius2/radius1)
r1x2=x1+(radius2*��(angle3)*holeradius/radius2)
s1y2=y1+(radius2*��(angle3)*holeradius/radius2)
t�
u
v� �drawrings
w
� 3,63
x"radius1=teeth1%*toothsize%/2/�
y"radius2=teeth2%*toothsize%/2/�
zȏ 0,0,radius1
{"angle1=starttooth%/teeth1%*360
|-x1=radius1*��(angle1)*(1-radius2/radius1)
}-y1=radius1*��(angle1)*(1-radius2/radius1)
~ȏ x1,y1,radius2
holeradius=radius2-hole%*8
�:x2=radius1*��(angle1)*(1-(radius2-holeradius)/radius1)
�:y2=radius1*��(angle1)*(1-(radius2-holeradius)/radius1)
�ȏ x2,y2,4
��
�
�!� �calcrepts(teeth1%,teeth2%)
�n%=0
��
�	n%+=1
�.� teeth1%*n%/teeth2%=�(teeth1%*n%/teeth2%)
�=n%
�
�� �ring(d%)
�teeth1%+=d%
�� �4,8)teeth1%
�8�4,20)teeth1%*�calcrepts(teeth1%,teeth2%) � teeth2%
��
�
���wheel(d%)
�teeth2%+=d%
�� �4,11)teeth2%
�8�4,20)teeth1%*�calcrepts(teeth1%,teeth2%) � teeth2%
��
�
���hole(d%)
�
hole%+=d%
��4,14)hole%
�8�4,20)teeth1%*�calcrepts(teeth1%,teeth2%) � teeth2%
��
�
�� �start(d%)
�starttooth%+=d%
��4,17)starttooth%
�8�4,20)teeth1%*�calcrepts(teeth1%,teeth2%) � teeth2%
��
�
�
� �colsel
�xc%=x%-512
�yc%=y%+512
�B� 3,63:� 5:� (colour% � 8)*32+512,(colour% � 8)*32-480:� � 143
�#colour%=(xc% � 32)*8+(yc% � 32)
�7� (colour% � 8)*32+512,(colour% � 8)*32-480:� � 143
�	� 4:�
��
�
�� �clear
�� 0,0 Ȝ 0
�ȓ Ȑ -512,-512,1024,1024
�lines%=0
�� 0,0 Ȝ 192
��CDraw_reset
��
�
�� �setupmenu
�"�0,7)"Ring size",�4,8)teeth1%
�%�0,10)"Wheel size",�4,11)teeth2%
�$�0,13)"Hole number",�4,14)hole%
�*�0,16)"Start tooth",�4,17)starttooth%
�G�0,19)"Points",�4,20)teeth1%*�calcrepts(teeth1%,teeth2%) � teeth2%
�� 5
�
� 3,56
�� y%=1 � 8
�)ȓ Ȑ icons%(1,y%),icons%(2,y%),48,28
�6� icons%(1,y%)+16,icons%(2,y%)+31:�(138+(y%-1)�4)
��
��4
�
�	� 3,3
�ȓ Ȑ 512,392,128,32
�� 5
�� 544,424:�"Draw"
�
� 3,12
�ȓ Ȑ 512,328,128,32
�� 544,360:�"Clear"
�
� 3,42
�ȓ Ȑ 512,456,128,32
�� 544,488:�"File"
�	� 4:�
�� x%=0 � 7:� y%=0 � 7
�� x%*8+y% Ȝ 192
�'ȓ Ȑ (x%*32)+512,(y%*32)-512,24,24
��:�
�H� 3,63:� 5:� (colour% � 8)*32+512,(colour% � 8)*32-480:� � 143:� 4:�
��
�
�� �readicondata
�� Y%=1 � 8
�� X%=1 � 2
�� icons%(X%,Y%)
��:�
��
�
�
� 512,224
�
� 512,128
�� 512,32
�
� 512,-64
�
�
� 672,224
�
� 672,128
�� 672,32
�
� 672,-64
�
�2��CDraw_initialise(appl_name$, nfonts%, size%)
�� _buffer% size%
�_ptr%=_buffer%
�%$_ptr%=�"Draw"+�201+�12,�(0)),12)
�
_ptr%+=12
�#$_ptr%=�appl_name$+�12," "),12)
�7� CDraw_font$(nfonts%+1), _colours% 20*4, _dash$(4)
�#ș"Wimp_ReadPalette",,_colours%
�_dash$(1)=�6,�0+�9+�0+�0)
�_dash$(2)=�6,�0+�18+�0+�0)
�_dash$(3)=�6,�0+�36+�0+�0)
�*_dash$(4)=�0+�36+�0+�0+�3,�0+�9+�0+�0)
�_flags%=&20100042
��CDraw_reset
�_flags%=&20100042
�CDraw_nofill%=-1
�CDraw%=�
��
�
���CDraw_reset
�_ptr%=_buffer%+40
�_olx%=1<<30:_oby%=1<<30
�_orx%=0:_oty%=0
��
�
���CDraw_savefile(f$)
� CDraw% �
_buffer%!24=_olx%
_buffer%!28=_oby%
_buffer%!32=_orx%
_buffer%!36=_oty%
*ș"OS_File",10,f$,&AFF,,_buffer%,_ptr%
�
�

	ݤ_colour(c%)

S� c%>=0 � =((c%�&03)*80+((c%>>2)�&03)*80*&100+((c%>>4)�&03)*80*&10000)<<8 � =-1
>�  IF c%>=0 THEN =!(_colours%+c%*4) AND &FFFFFF00 ELSE =-1


"��_checkspace(lx%,by%,rx%,ty%)
� lx%<_olx% � _olx%=lx%
� by%<_oby% � _oby%=by%
� rx%>_orx% � _orx%=rx%
� ty%>_oty% � _oty%=ty%
�

��_putword(W%)

!_ptr%=W%
_ptr%+=4
�

��_putwords(X%,Y%)
X%=X%<<8:Y%=Y%<<8
"� X%<_start%!8 � _start%!8 =X%
$� Y%<_start%!12 � _start%!12 =Y%
$� X%>_start%!16 � _start%!16 =X%
#� Y%>_start%!20 � _start%!20=Y%
�_putword(X%):�_putword(Y%)
 �
!
"-��_putcoords(_start%, lx%, by%, rx%, ty%)
#_start%!0=lx%<<8
$_start%!4=by%<<8
%_start%!8=rx%<<8
&_start%!12=ty%<<8
'�
(
)9��CDraw_pathobject(fill%, col%, thick%, dash%, path$)
*/�CDraw_openpath(fill%, col%, thick%, dash%)
+�CDraw_extendpath(path$)
,�CDraw_closepath
-�
.
/0��CDraw_openpath(fill%, col%, thick%, dash%)
0� CDraw% �
1� pattern$,I%
2_start%=_ptr%
3�_putword(2)
4
_ptr%+=20
5*�_putcoords(_start%+8,1<<30,1<<30,0,0)
6�_putword(�_colour(fill%))
7�_putword(�_colour(col%))
8�_putword(thick%<<8)
9(�_putword(_flags% � &80*-(dash%<>0))
:� dash%>0 �
;pattern$=_dash$(dash%)
<�_putword(0)
=�_putword(�pattern$/4)
>� I%=1 � �pattern$
??_ptr%=��pattern$,I%,1)
@_ptr%+=1
A�I%
B�
C�
D�
E
F��CDraw_extendpath(path$)
G� _pathtype%,I%
Hȕ path$<>""
IȎ �_nextchunk(path$) �
J� "MOVE" :_pathtype%=2
K� "CGAP" :_pathtype%=4
L� "CLOSE" :_pathtype%=5
M� "CURVE" :_pathtype%=6
N� "GAP" :_pathtype%=7
O� "DRAW" :_pathtype%=8
P�
Q� _pathtype%<>0 �
R�_putword(_pathtype%)
SȎ _pathtype% �
T� 2,3,7,8:
U�_putpair(path$)
V� 6:
W� I%=1 � 3
X�_putpair(path$)
Y� I%
Z�
[�
\�
]�
^
_��CDraw_closepath
`�_putword(0)
a_start%!4=_ptr%-_start%
b?�_checkspace(_start%!8, _start%!12, _start%!16, _start%!20)
c�
d
eݤ_nextchunk(� path$)
f� P%,chunk$
gP%=�path$+" "," ")
h$chunk$=�path$,�path$+" "," ")-1)
ipath$=�path$,P%+1)
j=chunk$
k
l��_putpair(� path$)
m� X%,Y%
nX%=��_nextchunk(path$)
oY%=��_nextchunk(path$)
p�_putwords(X%,Y%)
q�
�
00000000  0d 00 01 11 f4 20 3e 53  70 69 72 6f 67 72 61 70  |..... >Spirograp|
00000010  68 0d 00 02 16 f4 20 42  59 20 41 6e 64 79 20 50  |h..... BY Andy P|
00000020  69 6c 6c 69 64 67 65 0d  00 03 05 f4 0d 00 04 05  |illidge.........|
00000030  f4 0d 00 05 04 0d 00 06  08 eb 20 31 35 0d 00 07  |.......... 15...|
00000040  05 87 0d 00 08 08 40 25  3d 34 0d 00 09 04 0d 00  |......@%=4......|
00000050  0a 21 de 20 69 63 6f 6e  73 25 28 34 2c 38 29 2c  |.!. icons%(4,8),|
00000060  6c 69 6e 65 64 61 74 61  25 28 35 30 2c 35 29 0d  |linedata%(50,5).|
00000070  00 0b 2c f2 43 44 72 61  77 5f 69 6e 69 74 69 61  |..,.CDraw_initia|
00000080  6c 69 73 65 28 22 53 70  69 72 6f 67 72 61 70 68  |lise("Spirograph|
00000090  22 2c 31 2c 26 33 32 30  30 30 29 0d 00 0c 11 f2  |",1,&32000).....|
000000a0  72 65 61 64 69 63 6f 6e  64 61 74 61 0d 00 0d 0e  |readicondata....|
000000b0  c8 91 20 35 31 32 2c 35  31 32 0d 00 0e 13 ef 20  |.. 512,512..... |
000000c0  32 38 2c 36 34 2c 33 31  2c 37 39 2c 30 0d 00 0f  |28,64,31,79,0...|
000000d0  08 c8 97 20 ee 0d 00 10  11 74 6f 6f 74 68 73 69  |... .....toothsi|
000000e0  7a 65 25 3d 31 32 0d 00  11 3a 74 65 65 74 68 31  |ze%=12...:teeth1|
000000f0  25 3d 31 39 32 3a 74 65  65 74 68 32 25 3d 38 30  |%=192:teeth2%=80|
00000100  3a 63 6f 6c 6f 75 72 25  3d 37 3a 68 6f 6c 65 25  |:colour%=7:hole%|
00000110  3d 33 3a 73 74 61 72 74  74 6f 6f 74 68 25 3d 30  |=3:starttooth%=0|
00000120  0d 00 12 0c 6c 69 6e 65  73 25 3d 30 0d 00 13 0a  |....lines%=0....|
00000130  66 69 6c 65 3d a3 0d 00  14 0c 72 69 6e 67 73 25  |file=.....rings%|
00000140  3d a3 0d 00 15 0e e6 20  30 20 c8 9c 20 31 39 32  |=...... 0 .. 192|
00000150  0d 00 16 04 0d 00 17 07  db 3a 87 0d 00 18 0e f2  |.........:......|
00000160  73 65 74 75 70 6d 65 6e  75 0d 00 19 04 0d 00 1a  |setupmenu.......|
00000170  05 f5 0d 00 1b 11 d1 3d  30 3a f5 3a fd 20 91 3e  |.......=0:.:. .>|
00000180  3d 32 30 0d 00 1c 05 f5  0d 00 1d 0f c8 97 20 78  |=20........... x|
00000190  25 2c 79 25 2c 62 25 0d  00 1e 2e e7 20 78 25 3e  |%,y%,b%..... x%>|
000001a0  3d 35 31 32 20 80 20 ac  20 72 69 6e 67 73 25 20  |=512 . . rings% |
000001b0  8c 20 f2 64 72 61 77 72  69 6e 67 73 3a 72 69 6e  |. .drawrings:rin|
000001c0  67 73 25 3d b9 0d 00 1f  2b e7 20 78 25 3c 35 31  |gs%=....+. x%<51|
000001d0  32 20 80 20 72 69 6e 67  73 25 20 8c 20 f2 64 72  |2 . rings% . .dr|
000001e0  61 77 72 69 6e 67 73 3a  72 69 6e 67 73 25 3d a3  |awrings:rings%=.|
000001f0  0d 00 20 11 fd 20 28 62  25 20 80 20 35 29 3c 3e  |.. .. (b% . 5)<>|
00000200  30 0d 00 21 22 e7 20 72  69 6e 67 73 25 20 8c 20  |0..!". rings% . |
00000210  f2 64 72 61 77 72 69 6e  67 73 3a 72 69 6e 67 73  |.drawrings:rings|
00000220  25 3d a3 0d 00 22 04 0d  00 23 0d 63 68 6f 69 63  |%=..."...#.choic|
00000230  65 25 3d 30 0d 00 24 0f  e3 20 79 79 25 3d 31 20  |e%=0..$.. yy%=1 |
00000240  b8 20 38 0d 00 25 67 e7  20 78 25 3e 3d 69 63 6f  |. 8..%g. x%>=ico|
00000250  6e 73 25 28 31 2c 79 79  25 29 20 80 20 78 25 3c  |ns%(1,yy%) . x%<|
00000260  3d 69 63 6f 6e 73 25 28  31 2c 79 79 25 29 2b 34  |=icons%(1,yy%)+4|
00000270  38 20 80 20 79 25 3e 3d  69 63 6f 6e 73 25 28 32  |8 . y%>=icons%(2|
00000280  2c 79 79 25 29 20 80 20  79 25 3c 3d 69 63 6f 6e  |,yy%) . y%<=icon|
00000290  73 25 28 32 2c 79 79 25  29 2b 33 32 20 8c 20 63  |s%(2,yy%)+32 . c|
000002a0  68 6f 69 63 65 25 3d 79  79 25 0d 00 26 05 ed 0d  |hoice%=yy%..&...|
000002b0  00 27 04 0d 00 28 37 e7  20 78 25 3e 3d 35 31 32  |.'...(7. x%>=512|
000002c0  20 80 20 78 25 3c 3d 36  34 30 20 80 20 79 25 3e  | . x%<=640 . y%>|
000002d0  3d 33 39 32 20 80 20 79  25 3c 3d 34 32 34 20 8c  |=392 . y%<=424 .|
000002e0  20 63 68 6f 69 63 65 25  3d 39 0d 00 29 3a e7 20  | choice%=9..):. |
000002f0  78 25 3e 3d 35 31 32 20  80 20 78 25 3c 3d 37 36  |x%>=512 . x%<=76|
00000300  38 20 80 20 79 25 3e 3d  2d 35 31 32 20 80 20 79  |8 . y%>=-512 . y|
00000310  25 3c 3d 2d 32 35 36 20  8c 20 63 68 6f 69 63 65  |%<=-256 . choice|
00000320  25 3d 31 30 0d 00 2a 38  e7 20 78 25 3e 3d 35 31  |%=10..*8. x%>=51|
00000330  32 20 80 20 78 25 3c 3d  37 36 38 20 80 20 79 25  |2 . x%<=768 . y%|
00000340  3e 3d 33 32 38 20 80 20  79 25 3c 3d 33 36 30 20  |>=328 . y%<=360 |
00000350  8c 20 63 68 6f 69 63 65  25 3d 31 31 0d 00 2b 38  |. choice%=11..+8|
00000360  e7 20 78 25 3e 3d 35 31  32 20 80 20 78 25 3c 3d  |. x%>=512 . x%<=|
00000370  36 34 30 20 80 20 79 25  3e 3d 34 35 36 20 80 20  |640 . y%>=456 . |
00000380  79 25 3c 3d 34 38 38 20  8c 20 63 68 6f 69 63 65  |y%<=488 . choice|
00000390  25 3d 31 32 0d 00 2c 2f  e7 20 a6 28 2d 31 29 20  |%=12..,/. .(-1) |
000003a0  84 20 28 62 25 20 80 20  31 29 3c 3e 30 20 8c 20  |. (b% . 1)<>0 . |
000003b0  73 68 69 66 74 25 3d 35  20 8b 20 73 68 69 66 74  |shift%=5 . shift|
000003c0  25 3d 31 0d 00 2d 04 0d  00 2e 10 c8 8e 20 63 68  |%=1..-....... ch|
000003d0  6f 69 63 65 25 20 ca 0d  00 2f 15 c9 20 35 3a f2  |oice% .../.. 5:.|
000003e0  72 69 6e 67 28 73 68 69  66 74 25 29 0d 00 30 16  |ring(shift%)..0.|
000003f0  c9 20 31 3a f2 72 69 6e  67 28 2d 73 68 69 66 74  |. 1:.ring(-shift|
00000400  25 29 0d 00 31 16 c9 20  36 3a f2 77 68 65 65 6c  |%)..1.. 6:.wheel|
00000410  28 73 68 69 66 74 25 29  0d 00 32 17 c9 20 32 3a  |(shift%)..2.. 2:|
00000420  f2 77 68 65 65 6c 28 2d  73 68 69 66 74 25 29 0d  |.wheel(-shift%).|
00000430  00 33 15 c9 20 37 3a f2  68 6f 6c 65 28 73 68 69  |.3.. 7:.hole(shi|
00000440  66 74 25 29 0d 00 34 16  c9 20 33 3a f2 68 6f 6c  |ft%)..4.. 3:.hol|
00000450  65 28 2d 73 68 69 66 74  25 29 0d 00 35 16 c9 20  |e(-shift%)..5.. |
00000460  38 3a f2 73 74 61 72 74  28 73 68 69 66 74 25 29  |8:.start(shift%)|
00000470  0d 00 36 17 c9 20 34 3a  f2 73 74 61 72 74 28 2d  |..6.. 4:.start(-|
00000480  73 68 69 66 74 25 29 0d  00 37 11 c9 20 39 3a f2  |shift%)..7.. 9:.|
00000490  64 72 61 77 6c 69 6e 65  0d 00 38 10 c9 20 31 30  |drawline..8.. 10|
000004a0  3a f2 63 6f 6c 73 65 6c  0d 00 39 0f c9 20 31 31  |:.colsel..9.. 11|
000004b0  3a f2 63 6c 65 61 72 0d  00 3a 12 c9 20 31 32 3a  |:.clear..:.. 12:|
000004c0  f2 64 72 61 77 66 69 6c  65 0d 00 3b 05 cb 0d 00  |.drawfile..;....|
000004d0  3c 07 fd 20 a3 0d 00 3d  05 e0 0d 00 3e 04 0d 00  |<.. ...=....>...|
000004e0  3f 0f dd 20 f2 64 72 61  77 66 69 6c 65 0d 00 40  |?.. .drawfile..@|
000004f0  12 e7 20 6c 69 6e 65 73  25 3d 30 20 8c 20 e1 0d  |.. lines%=0 . ..|
00000500  00 41 07 ef 20 34 0d 00  42 1f e8 20 8a 30 2c 32  |.A.. 4..B.. .0,2|
00000510  31 29 22 4d 61 6b 65 20  44 72 61 77 66 69 6c 65  |1)"Make Drawfile|
00000520  3a 22 27 66 24 0d 00 43  05 87 0d 00 44 23 f1 20  |:"'f$..C....D#. |
00000530  8a 30 2c 32 31 29 c4 31  34 2c bd 33 32 29 2c 8a  |.0,21).14,.32),.|
00000540  30 2c 32 32 29 c4 31 34  2c bd 33 32 29 0d 00 45  |0,22).14,.32)..E|
00000550  0f e7 20 66 24 3d 22 22  20 8c 20 e1 0d 00 46 0a  |.. f$="" . ...F.|
00000560  66 69 6c 65 3d b9 0d 00  47 0e e6 20 30 2c 30 20  |file=...G.. 0,0 |
00000570  c8 9c 20 30 0d 00 48 1d  c8 93 20 c8 90 20 2d 35  |.. 0..H... .. -5|
00000580  31 32 2c 2d 35 31 32 2c  31 30 32 34 2c 31 30 32  |12,-512,1024,102|
00000590  34 0d 00 49 10 e6 20 30  2c 30 20 c8 9c 20 31 39  |4..I.. 0,0 .. 19|
000005a0  32 0d 00 4a 13 e3 20 6c  25 3d 31 20 b8 20 6c 69  |2..J.. l%=1 . li|
000005b0  6e 65 73 25 0d 00 4b 7d  74 65 65 74 68 31 25 3d  |nes%..K}teeth1%=|
000005c0  6c 69 6e 65 64 61 74 61  25 28 6c 25 2c 31 29 3a  |linedata%(l%,1):|
000005d0  74 65 65 74 68 32 25 3d  6c 69 6e 65 64 61 74 61  |teeth2%=linedata|
000005e0  25 28 6c 25 2c 32 29 3a  73 74 61 72 74 74 6f 6f  |%(l%,2):starttoo|
000005f0  74 68 25 3d 6c 69 6e 65  64 61 74 61 25 28 6c 25  |th%=linedata%(l%|
00000600  2c 33 29 3a 68 6f 6c 65  25 3d 6c 69 6e 65 64 61  |,3):hole%=lineda|
00000610  74 61 25 28 6c 25 2c 34  29 3a 63 6f 6c 6f 75 72  |ta%(l%,4):colour|
00000620  25 3d 6c 69 6e 65 64 61  74 61 25 28 6c 25 2c 35  |%=linedata%(l%,5|
00000630  29 0d 00 4c 0d f2 64 72  61 77 6c 69 6e 65 0d 00  |)..L..drawline..|
00000640  4d 05 ed 0d 00 4e 17 f2  43 44 72 61 77 5f 73 61  |M....N..CDraw_sa|
00000650  76 65 66 69 6c 65 28 66  24 29 0d 00 4f 0a 66 69  |vefile(f$)..O.fi|
00000660  6c 65 3d a3 0d 00 50 05  e1 0d 00 51 04 0d 00 52  |le=...P....Q...R|
00000670  0f dd 20 f2 64 72 61 77  6c 69 6e 65 0d 00 53 0f  |.. .drawline..S.|
00000680  e6 20 30 2c 63 6f 6c 6f  75 72 25 0d 00 54 22 72  |. 0,colour%..T"r|
00000690  61 64 69 75 73 31 3d 74  65 65 74 68 31 25 2a 74  |adius1=teeth1%*t|
000006a0  6f 6f 74 68 73 69 7a 65  25 2f 32 2f af 0d 00 55  |oothsize%/2/...U|
000006b0  22 72 61 64 69 75 73 32  3d 74 65 65 74 68 32 25  |"radius2=teeth2%|
000006c0  2a 74 6f 6f 74 68 73 69  7a 65 25 2f 32 2f af 0d  |*toothsize%/2/..|
000006d0  00 56 1e 68 6f 6c 65 72  61 64 69 75 73 3d 72 61  |.V.holeradius=ra|
000006e0  64 69 75 73 32 2d 68 6f  6c 65 25 2a 38 0d 00 57  |dius2-hole%*8..W|
000006f0  26 72 65 70 74 73 25 3d  a4 63 61 6c 63 72 65 70  |&repts%=.calcrep|
00000700  74 73 28 74 65 65 74 68  31 25 2c 74 65 65 74 68  |ts(teeth1%,teeth|
00000710  32 25 29 0d 00 58 16 74  6f 6f 74 68 25 3d 73 74  |2%)..X.tooth%=st|
00000720  61 72 74 74 6f 6f 74 68  25 0d 00 59 35 f2 73 70  |arttooth%..Y5.sp|
00000730  69 72 6f 28 74 6f 6f 74  68 25 2c 74 65 65 74 68  |iro(tooth%,teeth|
00000740  31 25 2c 74 65 65 74 68  32 25 2c 68 6f 6c 65 72  |1%,teeth2%,holer|
00000750  61 64 69 75 73 2c 63 6f  6c 6f 75 72 25 29 0d 00  |adius,colour%)..|
00000760  5a 5f e7 20 66 69 6c 65  20 8c 20 f2 43 44 72 61  |Z_. file . .CDra|
00000770  77 5f 6f 70 65 6e 70 61  74 68 28 2d 31 2c 63 6f  |w_openpath(-1,co|
00000780  6c 6f 75 72 25 2c 30 2c  30 29 3a f2 43 44 72 61  |lour%,0,0):.CDra|
00000790  77 5f 65 78 74 65 6e 64  70 61 74 68 28 22 4d 4f  |w_extendpath("MO|
000007a0  56 45 20 22 2b c3 28 78  32 2b 35 31 32 29 2b 22  |VE "+.(x2+512)+"|
000007b0  20 22 2b c3 28 79 32 2b  35 31 32 29 29 0d 00 5b  | "+.(y2+512))..[|
000007c0  18 e6 20 30 2c 63 6f 6c  6f 75 72 25 3a c8 92 20  |.. 0,colour%:.. |
000007d0  78 32 2c 79 32 0d 00 5c  04 0d 00 5d 16 e3 20 6c  |x2,y2..\...].. l|
000007e0  6f 6f 70 25 3d 31 20 b8  20 72 65 70 74 73 25 0d  |oop%=1 . repts%.|
000007f0  00 5e 14 e3 20 6e 25 3d  31 20 b8 20 74 65 65 74  |.^.. n%=1 . teet|
00000800  68 31 25 0d 00 5f 0d 74  6f 6f 74 68 25 2b 3d 31  |h1%.._.tooth%+=1|
00000810  0d 00 60 35 f2 73 70 69  72 6f 28 74 6f 6f 74 68  |..`5.spiro(tooth|
00000820  25 2c 74 65 65 74 68 31  25 2c 74 65 65 74 68 32  |%,teeth1%,teeth2|
00000830  25 2c 68 6f 6c 65 72 61  64 69 75 73 2c 63 6f 6c  |%,holeradius,col|
00000840  6f 75 72 25 29 0d 00 61  17 e6 20 30 2c 63 6f 6c  |our%)..a.. 0,col|
00000850  6f 75 72 25 3a df 20 78  32 2c 79 32 0d 00 62 3f  |our%:. x2,y2..b?|
00000860  e7 20 66 69 6c 65 20 8c  20 f2 43 44 72 61 77 5f  |. file . .CDraw_|
00000870  65 78 74 65 6e 64 70 61  74 68 28 22 44 52 41 57  |extendpath("DRAW|
00000880  20 22 2b c3 28 78 32 2b  35 31 32 29 2b 22 20 22  | "+.(x2+512)+" "|
00000890  2b c3 28 79 32 2b 35 31  32 29 29 0d 00 63 05 ed  |+.(y2+512))..c..|
000008a0  0d 00 64 05 ed 0d 00 65  04 0d 00 66 38 e7 20 66  |..d....e...f8. f|
000008b0  69 6c 65 20 8c 20 f2 43  44 72 61 77 5f 65 78 74  |ile . .CDraw_ext|
000008c0  65 6e 64 70 61 74 68 28  22 43 4c 4f 53 45 22 29  |endpath("CLOSE")|
000008d0  3a f2 43 44 72 61 77 5f  63 6c 6f 73 65 70 61 74  |:.CDraw_closepat|
000008e0  68 0d 00 67 0d 6c 69 6e  65 73 25 2b 3d 31 0d 00  |h..g.lines%+=1..|
000008f0  68 92 6c 69 6e 65 64 61  74 61 25 28 6c 69 6e 65  |h.linedata%(line|
00000900  73 25 2c 31 29 3d 74 65  65 74 68 31 25 3a 6c 69  |s%,1)=teeth1%:li|
00000910  6e 65 64 61 74 61 25 28  6c 69 6e 65 73 25 2c 32  |nedata%(lines%,2|
00000920  29 3d 74 65 65 74 68 32  25 3a 6c 69 6e 65 64 61  |)=teeth2%:lineda|
00000930  74 61 25 28 6c 69 6e 65  73 25 2c 33 29 3d 73 74  |ta%(lines%,3)=st|
00000940  61 72 74 74 6f 6f 74 68  25 3a 6c 69 6e 65 64 61  |arttooth%:lineda|
00000950  74 61 25 28 6c 69 6e 65  73 25 2c 34 29 3d 68 6f  |ta%(lines%,4)=ho|
00000960  6c 65 25 3a 3a 6c 69 6e  65 64 61 74 61 25 28 6c  |le%::linedata%(l|
00000970  69 6e 65 73 25 2c 35 29  3d 63 6f 6c 6f 75 72 25  |ines%,5)=colour%|
00000980  0d 00 69 04 0d 00 6a 05  e1 0d 00 6b 04 0d 00 6c  |..i...j....k...l|
00000990  37 dd 20 f2 73 70 69 72  6f 28 74 6f 6f 74 68 25  |7. .spiro(tooth%|
000009a0  2c 74 65 65 74 68 31 25  2c 74 65 65 74 68 32 25  |,teeth1%,teeth2%|
000009b0  2c 68 6f 6c 65 72 61 64  69 75 73 2c 63 6f 6c 6f  |,holeradius,colo|
000009c0  75 72 25 29 0d 00 6d 2b  61 6e 67 6c 65 31 3d 28  |ur%)..m+angle1=(|
000009d0  74 6f 6f 74 68 25 2b 73  74 61 72 74 74 6f 6f 74  |tooth%+starttoot|
000009e0  68 25 29 2f 74 65 65 74  68 31 25 2a 33 36 30 0d  |h%)/teeth1%*360.|
000009f0  00 6e 1d 61 6e 67 6c 65  32 3d 74 6f 6f 74 68 25  |.n.angle2=tooth%|
00000a00  2f 74 65 65 74 68 32 25  2a 33 36 30 0d 00 6f 18  |/teeth2%*360..o.|
00000a10  61 6e 67 6c 65 33 3d 61  6e 67 6c 65 31 2d 61 6e  |angle3=angle1-an|
00000a20  67 6c 65 32 0d 00 70 2d  78 31 3d 72 61 64 69 75  |gle2..p-x1=radiu|
00000a30  73 31 2a b5 b2 28 61 6e  67 6c 65 31 29 2a 28 31  |s1*..(angle1)*(1|
00000a40  2d 72 61 64 69 75 73 32  2f 72 61 64 69 75 73 31  |-radius2/radius1|
00000a50  29 0d 00 71 2d 79 31 3d  72 61 64 69 75 73 31 2a  |)..q-y1=radius1*|
00000a60  9b b2 28 61 6e 67 6c 65  31 29 2a 28 31 2d 72 61  |..(angle1)*(1-ra|
00000a70  64 69 75 73 32 2f 72 61  64 69 75 73 31 29 0d 00  |dius2/radius1)..|
00000a80  72 31 78 32 3d 78 31 2b  28 72 61 64 69 75 73 32  |r1x2=x1+(radius2|
00000a90  2a b5 b2 28 61 6e 67 6c  65 33 29 2a 68 6f 6c 65  |*..(angle3)*hole|
00000aa0  72 61 64 69 75 73 2f 72  61 64 69 75 73 32 29 0d  |radius/radius2).|
00000ab0  00 73 31 79 32 3d 79 31  2b 28 72 61 64 69 75 73  |.s1y2=y1+(radius|
00000ac0  32 2a 9b b2 28 61 6e 67  6c 65 33 29 2a 68 6f 6c  |2*..(angle3)*hol|
00000ad0  65 72 61 64 69 75 73 2f  72 61 64 69 75 73 32 29  |eradius/radius2)|
00000ae0  0d 00 74 05 e1 0d 00 75  04 0d 00 76 10 dd 20 f2  |..t....u...v.. .|
00000af0  64 72 61 77 72 69 6e 67  73 0d 00 77 0a e6 20 33  |drawrings..w.. 3|
00000b00  2c 36 33 0d 00 78 22 72  61 64 69 75 73 31 3d 74  |,63..x"radius1=t|
00000b10  65 65 74 68 31 25 2a 74  6f 6f 74 68 73 69 7a 65  |eeth1%*toothsize|
00000b20  25 2f 32 2f af 0d 00 79  22 72 61 64 69 75 73 32  |%/2/...y"radius2|
00000b30  3d 74 65 65 74 68 32 25  2a 74 6f 6f 74 68 73 69  |=teeth2%*toothsi|
00000b40  7a 65 25 2f 32 2f af 0d  00 7a 12 c8 8f 20 30 2c  |ze%/2/...z... 0,|
00000b50  30 2c 72 61 64 69 75 73  31 0d 00 7b 22 61 6e 67  |0,radius1..{"ang|
00000b60  6c 65 31 3d 73 74 61 72  74 74 6f 6f 74 68 25 2f  |le1=starttooth%/|
00000b70  74 65 65 74 68 31 25 2a  33 36 30 0d 00 7c 2d 78  |teeth1%*360..|-x|
00000b80  31 3d 72 61 64 69 75 73  31 2a b5 b2 28 61 6e 67  |1=radius1*..(ang|
00000b90  6c 65 31 29 2a 28 31 2d  72 61 64 69 75 73 32 2f  |le1)*(1-radius2/|
00000ba0  72 61 64 69 75 73 31 29  0d 00 7d 2d 79 31 3d 72  |radius1)..}-y1=r|
00000bb0  61 64 69 75 73 31 2a 9b  b2 28 61 6e 67 6c 65 31  |adius1*..(angle1|
00000bc0  29 2a 28 31 2d 72 61 64  69 75 73 32 2f 72 61 64  |)*(1-radius2/rad|
00000bd0  69 75 73 31 29 0d 00 7e  14 c8 8f 20 78 31 2c 79  |ius1)..~... x1,y|
00000be0  31 2c 72 61 64 69 75 73  32 0d 00 7f 1e 68 6f 6c  |1,radius2....hol|
00000bf0  65 72 61 64 69 75 73 3d  72 61 64 69 75 73 32 2d  |eradius=radius2-|
00000c00  68 6f 6c 65 25 2a 38 0d  00 80 3a 78 32 3d 72 61  |hole%*8...:x2=ra|
00000c10  64 69 75 73 31 2a b5 b2  28 61 6e 67 6c 65 31 29  |dius1*..(angle1)|
00000c20  2a 28 31 2d 28 72 61 64  69 75 73 32 2d 68 6f 6c  |*(1-(radius2-hol|
00000c30  65 72 61 64 69 75 73 29  2f 72 61 64 69 75 73 31  |eradius)/radius1|
00000c40  29 0d 00 81 3a 79 32 3d  72 61 64 69 75 73 31 2a  |)...:y2=radius1*|
00000c50  9b b2 28 61 6e 67 6c 65  31 29 2a 28 31 2d 28 72  |..(angle1)*(1-(r|
00000c60  61 64 69 75 73 32 2d 68  6f 6c 65 72 61 64 69 75  |adius2-holeradiu|
00000c70  73 29 2f 72 61 64 69 75  73 31 29 0d 00 82 0e c8  |s)/radius1).....|
00000c80  8f 20 78 32 2c 79 32 2c  34 0d 00 83 05 e1 0d 00  |. x2,y2,4.......|
00000c90  84 04 0d 00 85 21 dd 20  a4 63 61 6c 63 72 65 70  |.....!. .calcrep|
00000ca0  74 73 28 74 65 65 74 68  31 25 2c 74 65 65 74 68  |ts(teeth1%,teeth|
00000cb0  32 25 29 0d 00 86 08 6e  25 3d 30 0d 00 87 05 f5  |2%)....n%=0.....|
00000cc0  0d 00 88 09 6e 25 2b 3d  31 0d 00 89 2e fd 20 74  |....n%+=1..... t|
00000cd0  65 65 74 68 31 25 2a 6e  25 2f 74 65 65 74 68 32  |eeth1%*n%/teeth2|
00000ce0  25 3d a8 28 74 65 65 74  68 31 25 2a 6e 25 2f 74  |%=.(teeth1%*n%/t|
00000cf0  65 65 74 68 32 25 29 0d  00 8a 07 3d 6e 25 0d 00  |eeth2%)....=n%..|
00000d00  8b 04 0d 00 8c 0f dd 20  f2 72 69 6e 67 28 64 25  |....... .ring(d%|
00000d10  29 0d 00 8d 0f 74 65 65  74 68 31 25 2b 3d 64 25  |)....teeth1%+=d%|
00000d20  0d 00 8e 12 f1 20 8a 34  2c 38 29 74 65 65 74 68  |..... .4,8)teeth|
00000d30  31 25 0d 00 8f 38 f1 8a  34 2c 32 30 29 74 65 65  |1%...8..4,20)tee|
00000d40  74 68 31 25 2a a4 63 61  6c 63 72 65 70 74 73 28  |th1%*.calcrepts(|
00000d50  74 65 65 74 68 31 25 2c  74 65 65 74 68 32 25 29  |teeth1%,teeth2%)|
00000d60  20 81 20 74 65 65 74 68  32 25 0d 00 90 05 e1 0d  | . teeth2%......|
00000d70  00 91 04 0d 00 92 0f dd  f2 77 68 65 65 6c 28 64  |.........wheel(d|
00000d80  25 29 0d 00 93 0f 74 65  65 74 68 32 25 2b 3d 64  |%)....teeth2%+=d|
00000d90  25 0d 00 94 13 f1 20 8a  34 2c 31 31 29 74 65 65  |%..... .4,11)tee|
00000da0  74 68 32 25 0d 00 95 38  f1 8a 34 2c 32 30 29 74  |th2%...8..4,20)t|
00000db0  65 65 74 68 31 25 2a a4  63 61 6c 63 72 65 70 74  |eeth1%*.calcrept|
00000dc0  73 28 74 65 65 74 68 31  25 2c 74 65 65 74 68 32  |s(teeth1%,teeth2|
00000dd0  25 29 20 81 20 74 65 65  74 68 32 25 0d 00 96 05  |%) . teeth2%....|
00000de0  e1 0d 00 97 04 0d 00 98  0e dd f2 68 6f 6c 65 28  |...........hole(|
00000df0  64 25 29 0d 00 99 0d 68  6f 6c 65 25 2b 3d 64 25  |d%)....hole%+=d%|
00000e00  0d 00 9a 10 f1 8a 34 2c  31 34 29 68 6f 6c 65 25  |......4,14)hole%|
00000e10  0d 00 9b 38 f1 8a 34 2c  32 30 29 74 65 65 74 68  |...8..4,20)teeth|
00000e20  31 25 2a a4 63 61 6c 63  72 65 70 74 73 28 74 65  |1%*.calcrepts(te|
00000e30  65 74 68 31 25 2c 74 65  65 74 68 32 25 29 20 81  |eth1%,teeth2%) .|
00000e40  20 74 65 65 74 68 32 25  0d 00 9c 05 e1 0d 00 9d  | teeth2%........|
00000e50  04 0d 00 9e 10 dd 20 f2  73 74 61 72 74 28 64 25  |...... .start(d%|
00000e60  29 0d 00 9f 13 73 74 61  72 74 74 6f 6f 74 68 25  |)....starttooth%|
00000e70  2b 3d 64 25 0d 00 a0 16  f1 8a 34 2c 31 37 29 73  |+=d%......4,17)s|
00000e80  74 61 72 74 74 6f 6f 74  68 25 0d 00 a1 38 f1 8a  |tarttooth%...8..|
00000e90  34 2c 32 30 29 74 65 65  74 68 31 25 2a a4 63 61  |4,20)teeth1%*.ca|
00000ea0  6c 63 72 65 70 74 73 28  74 65 65 74 68 31 25 2c  |lcrepts(teeth1%,|
00000eb0  74 65 65 74 68 32 25 29  20 81 20 74 65 65 74 68  |teeth2%) . teeth|
00000ec0  32 25 0d 00 a2 05 e1 0d  00 a3 04 0d 00 a4 0d dd  |2%..............|
00000ed0  20 f2 63 6f 6c 73 65 6c  0d 00 a5 0e 78 63 25 3d  | .colsel....xc%=|
00000ee0  78 25 2d 35 31 32 0d 00  a6 0e 79 63 25 3d 79 25  |x%-512....yc%=y%|
00000ef0  2b 35 31 32 0d 00 a7 42  e6 20 33 2c 36 33 3a ef  |+512...B. 3,63:.|
00000f00  20 35 3a ec 20 28 63 6f  6c 6f 75 72 25 20 81 20  | 5:. (colour% . |
00000f10  38 29 2a 33 32 2b 35 31  32 2c 28 63 6f 6c 6f 75  |8)*32+512,(colou|
00000f20  72 25 20 83 20 38 29 2a  33 32 2d 34 38 30 3a f1  |r% . 8)*32-480:.|
00000f30  20 bd 20 31 34 33 0d 00  a8 23 63 6f 6c 6f 75 72  | . 143...#colour|
00000f40  25 3d 28 78 63 25 20 81  20 33 32 29 2a 38 2b 28  |%=(xc% . 32)*8+(|
00000f50  79 63 25 20 81 20 33 32  29 0d 00 a9 37 ec 20 28  |yc% . 32)...7. (|
00000f60  63 6f 6c 6f 75 72 25 20  81 20 38 29 2a 33 32 2b  |colour% . 8)*32+|
00000f70  35 31 32 2c 28 63 6f 6c  6f 75 72 25 20 83 20 38  |512,(colour% . 8|
00000f80  29 2a 33 32 2d 34 38 30  3a f1 20 bd 20 31 34 33  |)*32-480:. . 143|
00000f90  0d 00 aa 09 ef 20 34 3a  87 0d 00 ab 05 e1 0d 00  |..... 4:........|
00000fa0  ac 04 0d 00 ad 0c dd 20  f2 63 6c 65 61 72 0d 00  |....... .clear..|
00000fb0  ae 0e e6 20 30 2c 30 20  c8 9c 20 30 0d 00 af 1d  |... 0,0 .. 0....|
00000fc0  c8 93 20 c8 90 20 2d 35  31 32 2c 2d 35 31 32 2c  |.. .. -512,-512,|
00000fd0  31 30 32 34 2c 31 30 32  34 0d 00 b0 0c 6c 69 6e  |1024,1024....lin|
00000fe0  65 73 25 3d 30 0d 00 b1  10 e6 20 30 2c 30 20 c8  |es%=0..... 0,0 .|
00000ff0  9c 20 31 39 32 0d 00 b2  10 f2 43 44 72 61 77 5f  |. 192.....CDraw_|
00001000  72 65 73 65 74 0d 00 b3  05 e1 0d 00 b4 04 0d 00  |reset...........|
00001010  b5 10 dd 20 f2 73 65 74  75 70 6d 65 6e 75 0d 00  |... .setupmenu..|
00001020  b6 22 f1 8a 30 2c 37 29  22 52 69 6e 67 20 73 69  |."..0,7)"Ring si|
00001030  7a 65 22 2c 8a 34 2c 38  29 74 65 65 74 68 31 25  |ze",.4,8)teeth1%|
00001040  0d 00 b7 25 f1 8a 30 2c  31 30 29 22 57 68 65 65  |...%..0,10)"Whee|
00001050  6c 20 73 69 7a 65 22 2c  8a 34 2c 31 31 29 74 65  |l size",.4,11)te|
00001060  65 74 68 32 25 0d 00 b8  24 f1 8a 30 2c 31 33 29  |eth2%...$..0,13)|
00001070  22 48 6f 6c 65 20 6e 75  6d 62 65 72 22 2c 8a 34  |"Hole number",.4|
00001080  2c 31 34 29 68 6f 6c 65  25 0d 00 b9 2a f1 8a 30  |,14)hole%...*..0|
00001090  2c 31 36 29 22 53 74 61  72 74 20 74 6f 6f 74 68  |,16)"Start tooth|
000010a0  22 2c 8a 34 2c 31 37 29  73 74 61 72 74 74 6f 6f  |",.4,17)starttoo|
000010b0  74 68 25 0d 00 ba 47 f1  8a 30 2c 31 39 29 22 50  |th%...G..0,19)"P|
000010c0  6f 69 6e 74 73 22 2c 8a  34 2c 32 30 29 74 65 65  |oints",.4,20)tee|
000010d0  74 68 31 25 2a a4 63 61  6c 63 72 65 70 74 73 28  |th1%*.calcrepts(|
000010e0  74 65 65 74 68 31 25 2c  74 65 65 74 68 32 25 29  |teeth1%,teeth2%)|
000010f0  20 81 20 74 65 65 74 68  32 25 0d 00 bb 07 ef 20  | . teeth2%..... |
00001100  35 0d 00 bc 0a e6 20 33  2c 35 36 0d 00 bd 0e e3  |5..... 3,56.....|
00001110  20 79 25 3d 31 20 b8 20  38 0d 00 be 29 c8 93 20  | y%=1 . 8...).. |
00001120  c8 90 20 69 63 6f 6e 73  25 28 31 2c 79 25 29 2c  |.. icons%(1,y%),|
00001130  69 63 6f 6e 73 25 28 32  2c 79 25 29 2c 34 38 2c  |icons%(2,y%),48,|
00001140  32 38 0d 00 bf 36 ec 20  69 63 6f 6e 73 25 28 31  |28...6. icons%(1|
00001150  2c 79 25 29 2b 31 36 2c  69 63 6f 6e 73 25 28 32  |,y%)+16,icons%(2|
00001160  2c 79 25 29 2b 33 31 3a  f1 bd 28 31 33 38 2b 28  |,y%)+31:..(138+(|
00001170  79 25 2d 31 29 81 34 29  0d 00 c0 05 ed 0d 00 c1  |y%-1).4)........|
00001180  06 ef 34 0d 00 c2 04 0d  00 c3 09 e6 20 33 2c 33  |..4......... 3,3|
00001190  0d 00 c4 18 c8 93 20 c8  90 20 35 31 32 2c 33 39  |...... .. 512,39|
000011a0  32 2c 31 32 38 2c 33 32  0d 00 c5 07 ef 20 35 0d  |2,128,32..... 5.|
000011b0  00 c6 15 ec 20 35 34 34  2c 34 32 34 3a f1 22 44  |.... 544,424:."D|
000011c0  72 61 77 22 0d 00 c7 0a  e6 20 33 2c 31 32 0d 00  |raw"..... 3,12..|
000011d0  c8 18 c8 93 20 c8 90 20  35 31 32 2c 33 32 38 2c  |.... .. 512,328,|
000011e0  31 32 38 2c 33 32 0d 00  c9 16 ec 20 35 34 34 2c  |128,32..... 544,|
000011f0  33 36 30 3a f1 22 43 6c  65 61 72 22 0d 00 ca 0a  |360:."Clear"....|
00001200  e6 20 33 2c 34 32 0d 00  cb 18 c8 93 20 c8 90 20  |. 3,42...... .. |
00001210  35 31 32 2c 34 35 36 2c  31 32 38 2c 33 32 0d 00  |512,456,128,32..|
00001220  cc 15 ec 20 35 34 34 2c  34 38 38 3a f1 22 46 69  |... 544,488:."Fi|
00001230  6c 65 22 0d 00 cd 09 ef  20 34 3a 87 0d 00 ce 19  |le"..... 4:.....|
00001240  e3 20 78 25 3d 30 20 b8  20 37 3a e3 20 79 25 3d  |. x%=0 . 7:. y%=|
00001250  30 20 b8 20 37 0d 00 cf  14 e6 20 78 25 2a 38 2b  |0 . 7..... x%*8+|
00001260  79 25 20 c8 9c 20 31 39  32 0d 00 d0 27 c8 93 20  |y% .. 192...'.. |
00001270  c8 90 20 28 78 25 2a 33  32 29 2b 35 31 32 2c 28  |.. (x%*32)+512,(|
00001280  79 25 2a 33 32 29 2d 35  31 32 2c 32 34 2c 32 34  |y%*32)-512,24,24|
00001290  0d 00 d1 07 ed 3a ed 0d  00 d2 48 e6 20 33 2c 36  |.....:....H. 3,6|
000012a0  33 3a ef 20 35 3a ec 20  28 63 6f 6c 6f 75 72 25  |3:. 5:. (colour%|
000012b0  20 81 20 38 29 2a 33 32  2b 35 31 32 2c 28 63 6f  | . 8)*32+512,(co|
000012c0  6c 6f 75 72 25 20 83 20  38 29 2a 33 32 2d 34 38  |lour% . 8)*32-48|
000012d0  30 3a f1 20 bd 20 31 34  33 3a ef 20 34 3a 87 0d  |0:. . 143:. 4:..|
000012e0  00 d3 05 e1 0d 00 d4 04  0d 00 d5 13 dd 20 f2 72  |............. .r|
000012f0  65 61 64 69 63 6f 6e 64  61 74 61 0d 00 d6 0e e3  |eadicondata.....|
00001300  20 59 25 3d 31 20 b8 20  38 0d 00 d7 0e e3 20 58  | Y%=1 . 8..... X|
00001310  25 3d 31 20 b8 20 32 0d  00 d8 13 f3 20 69 63 6f  |%=1 . 2..... ico|
00001320  6e 73 25 28 58 25 2c 59  25 29 0d 00 d9 07 ed 3a  |ns%(X%,Y%).....:|
00001330  ed 0d 00 da 05 e1 0d 00  db 04 0d 00 dc 0d dc 20  |............... |
00001340  35 31 32 2c 32 32 34 0d  00 dd 0d dc 20 35 31 32  |512,224..... 512|
00001350  2c 31 32 38 0d 00 de 0c  dc 20 35 31 32 2c 33 32  |,128..... 512,32|
00001360  0d 00 df 0d dc 20 35 31  32 2c 2d 36 34 0d 00 e0  |..... 512,-64...|
00001370  04 0d 00 e1 0d dc 20 36  37 32 2c 32 32 34 0d 00  |...... 672,224..|
00001380  e2 0d dc 20 36 37 32 2c  31 32 38 0d 00 e3 0c dc  |... 672,128.....|
00001390  20 36 37 32 2c 33 32 0d  00 e4 0d dc 20 36 37 32  | 672,32..... 672|
000013a0  2c 2d 36 34 0d 00 e5 04  0d 00 e6 32 dd f2 43 44  |,-64.......2..CD|
000013b0  72 61 77 5f 69 6e 69 74  69 61 6c 69 73 65 28 61  |raw_initialise(a|
000013c0  70 70 6c 5f 6e 61 6d 65  24 2c 20 6e 66 6f 6e 74  |ppl_name$, nfont|
000013d0  73 25 2c 20 73 69 7a 65  25 29 0d 00 e7 14 de 20  |s%, size%)..... |
000013e0  5f 62 75 66 66 65 72 25  20 73 69 7a 65 25 0d 00  |_buffer% size%..|
000013f0  e8 12 5f 70 74 72 25 3d  5f 62 75 66 66 65 72 25  |.._ptr%=_buffer%|
00001400  0d 00 e9 25 24 5f 70 74  72 25 3d c0 22 44 72 61  |...%$_ptr%=."Dra|
00001410  77 22 2b bd 32 30 31 2b  c4 31 32 2c bd 28 30 29  |w"+.201+.12,.(0)|
00001420  29 2c 31 32 29 0d 00 ea  0d 5f 70 74 72 25 2b 3d  |),12)...._ptr%+=|
00001430  31 32 0d 00 eb 23 24 5f  70 74 72 25 3d c0 61 70  |12...#$_ptr%=.ap|
00001440  70 6c 5f 6e 61 6d 65 24  2b c4 31 32 2c 22 20 22  |pl_name$+.12," "|
00001450  29 2c 31 32 29 0d 00 ec  37 de 20 43 44 72 61 77  |),12)...7. CDraw|
00001460  5f 66 6f 6e 74 24 28 6e  66 6f 6e 74 73 25 2b 31  |_font$(nfonts%+1|
00001470  29 2c 20 5f 63 6f 6c 6f  75 72 73 25 20 32 30 2a  |), _colours% 20*|
00001480  34 2c 20 5f 64 61 73 68  24 28 34 29 0d 00 ed 23  |4, _dash$(4)...#|
00001490  c8 99 22 57 69 6d 70 5f  52 65 61 64 50 61 6c 65  |.."Wimp_ReadPale|
000014a0  74 74 65 22 2c 2c 5f 63  6f 6c 6f 75 72 73 25 0d  |tte",,_colours%.|
000014b0  00 ee 1d 5f 64 61 73 68  24 28 31 29 3d c4 36 2c  |..._dash$(1)=.6,|
000014c0  bd 30 2b bd 39 2b bd 30  2b bd 30 29 0d 00 ef 1e  |.0+.9+.0+.0)....|
000014d0  5f 64 61 73 68 24 28 32  29 3d c4 36 2c bd 30 2b  |_dash$(2)=.6,.0+|
000014e0  bd 31 38 2b bd 30 2b bd  30 29 0d 00 f0 1e 5f 64  |.18+.0+.0)...._d|
000014f0  61 73 68 24 28 33 29 3d  c4 36 2c bd 30 2b bd 33  |ash$(3)=.6,.0+.3|
00001500  36 2b bd 30 2b bd 30 29  0d 00 f1 2a 5f 64 61 73  |6+.0+.0)...*_das|
00001510  68 24 28 34 29 3d bd 30  2b bd 33 36 2b bd 30 2b  |h$(4)=.0+.36+.0+|
00001520  bd 30 2b c4 33 2c bd 30  2b bd 39 2b bd 30 2b bd  |.0+.3,.0+.9+.0+.|
00001530  30 29 0d 00 f2 15 5f 66  6c 61 67 73 25 3d 26 32  |0)...._flags%=&2|
00001540  30 31 30 30 30 34 32 0d  00 f3 10 f2 43 44 72 61  |0100042.....CDra|
00001550  77 5f 72 65 73 65 74 0d  00 f4 15 5f 66 6c 61 67  |w_reset...._flag|
00001560  73 25 3d 26 32 30 31 30  30 30 34 32 0d 00 f5 14  |s%=&20100042....|
00001570  43 44 72 61 77 5f 6e 6f  66 69 6c 6c 25 3d 2d 31  |CDraw_nofill%=-1|
00001580  0d 00 f6 0c 43 44 72 61  77 25 3d b9 0d 00 f7 05  |....CDraw%=.....|
00001590  e1 0d 00 f8 04 0d 00 f9  11 dd f2 43 44 72 61 77  |...........CDraw|
000015a0  5f 72 65 73 65 74 0d 00  fa 15 5f 70 74 72 25 3d  |_reset...._ptr%=|
000015b0  5f 62 75 66 66 65 72 25  2b 34 30 0d 00 fb 1b 5f  |_buffer%+40...._|
000015c0  6f 6c 78 25 3d 31 3c 3c  33 30 3a 5f 6f 62 79 25  |olx%=1<<30:_oby%|
000015d0  3d 31 3c 3c 33 30 0d 00  fc 13 5f 6f 72 78 25 3d  |=1<<30...._orx%=|
000015e0  30 3a 5f 6f 74 79 25 3d  30 0d 00 fd 05 e1 0d 00  |0:_oty%=0.......|
000015f0  fe 04 0d 00 ff 18 dd f2  43 44 72 61 77 5f 73 61  |........CDraw_sa|
00001600  76 65 66 69 6c 65 28 66  24 29 0d 01 00 0e e7 20  |vefile(f$)..... |
00001610  43 44 72 61 77 25 20 8c  0d 01 01 15 5f 62 75 66  |CDraw% ....._buf|
00001620  66 65 72 25 21 32 34 3d  5f 6f 6c 78 25 0d 01 02  |fer%!24=_olx%...|
00001630  15 5f 62 75 66 66 65 72  25 21 32 38 3d 5f 6f 62  |._buffer%!28=_ob|
00001640  79 25 0d 01 03 15 5f 62  75 66 66 65 72 25 21 33  |y%...._buffer%!3|
00001650  32 3d 5f 6f 72 78 25 0d  01 04 15 5f 62 75 66 66  |2=_orx%...._buff|
00001660  65 72 25 21 33 36 3d 5f  6f 74 79 25 0d 01 05 2a  |er%!36=_oty%...*|
00001670  c8 99 22 4f 53 5f 46 69  6c 65 22 2c 31 30 2c 66  |.."OS_File",10,f|
00001680  24 2c 26 41 46 46 2c 2c  5f 62 75 66 66 65 72 25  |$,&AFF,,_buffer%|
00001690  2c 5f 70 74 72 25 0d 01  06 05 cd 0d 01 07 05 e1  |,_ptr%..........|
000016a0  0d 01 08 04 0d 01 09 11  dd a4 5f 63 6f 6c 6f 75  |.........._colou|
000016b0  72 28 63 25 29 0d 01 0a  53 e7 20 63 25 3e 3d 30  |r(c%)...S. c%>=0|
000016c0  20 8c 20 3d 28 28 63 25  80 26 30 33 29 2a 38 30  | . =((c%.&03)*80|
000016d0  2b 28 28 63 25 3e 3e 32  29 80 26 30 33 29 2a 38  |+((c%>>2).&03)*8|
000016e0  30 2a 26 31 30 30 2b 28  28 63 25 3e 3e 34 29 80  |0*&100+((c%>>4).|
000016f0  26 30 33 29 2a 38 30 2a  26 31 30 30 30 30 29 3c  |&03)*80*&10000)<|
00001700  3c 38 20 8b 20 3d 2d 31  0d 01 0b 3e f4 20 20 49  |<8 . =-1...>.  I|
00001710  46 20 63 25 3e 3d 30 20  54 48 45 4e 20 3d 21 28  |F c%>=0 THEN =!(|
00001720  5f 63 6f 6c 6f 75 72 73  25 2b 63 25 2a 34 29 20  |_colours%+c%*4) |
00001730  41 4e 44 20 26 46 46 46  46 46 46 30 30 20 45 4c  |AND &FFFFFF00 EL|
00001740  53 45 20 3d 2d 31 0d 01  0c 04 0d 01 0d 22 dd f2  |SE =-1......."..|
00001750  5f 63 68 65 63 6b 73 70  61 63 65 28 6c 78 25 2c  |_checkspace(lx%,|
00001760  62 79 25 2c 72 78 25 2c  74 79 25 29 0d 01 0e 1b  |by%,rx%,ty%)....|
00001770  e7 20 6c 78 25 3c 5f 6f  6c 78 25 20 8c 20 5f 6f  |. lx%<_olx% . _o|
00001780  6c 78 25 3d 6c 78 25 0d  01 0f 1b e7 20 62 79 25  |lx%=lx%..... by%|
00001790  3c 5f 6f 62 79 25 20 8c  20 5f 6f 62 79 25 3d 62  |<_oby% . _oby%=b|
000017a0  79 25 0d 01 10 1b e7 20  72 78 25 3e 5f 6f 72 78  |y%..... rx%>_orx|
000017b0  25 20 8c 20 5f 6f 72 78  25 3d 72 78 25 0d 01 11  |% . _orx%=rx%...|
000017c0  1b e7 20 74 79 25 3e 5f  6f 74 79 25 20 8c 20 5f  |.. ty%>_oty% . _|
000017d0  6f 74 79 25 3d 74 79 25  0d 01 12 05 e1 0d 01 13  |oty%=ty%........|
000017e0  04 0d 01 14 12 dd f2 5f  70 75 74 77 6f 72 64 28  |......._putword(|
000017f0  57 25 29 0d 01 15 0d 21  5f 70 74 72 25 3d 57 25  |W%)....!_ptr%=W%|
00001800  0d 01 16 0c 5f 70 74 72  25 2b 3d 34 0d 01 17 05  |...._ptr%+=4....|
00001810  e1 0d 01 18 04 0d 01 19  16 dd f2 5f 70 75 74 77  |..........._putw|
00001820  6f 72 64 73 28 58 25 2c  59 25 29 0d 01 1a 15 58  |ords(X%,Y%)....X|
00001830  25 3d 58 25 3c 3c 38 3a  59 25 3d 59 25 3c 3c 38  |%=X%<<8:Y%=Y%<<8|
00001840  0d 01 1b 22 e7 20 58 25  3c 5f 73 74 61 72 74 25  |...". X%<_start%|
00001850  21 38 20 8c 20 5f 73 74  61 72 74 25 21 38 20 3d  |!8 . _start%!8 =|
00001860  58 25 0d 01 1c 24 e7 20  59 25 3c 5f 73 74 61 72  |X%...$. Y%<_star|
00001870  74 25 21 31 32 20 8c 20  5f 73 74 61 72 74 25 21  |t%!12 . _start%!|
00001880  31 32 20 3d 59 25 0d 01  1d 24 e7 20 58 25 3e 5f  |12 =Y%...$. X%>_|
00001890  73 74 61 72 74 25 21 31  36 20 8c 20 5f 73 74 61  |start%!16 . _sta|
000018a0  72 74 25 21 31 36 20 3d  58 25 0d 01 1e 23 e7 20  |rt%!16 =X%...#. |
000018b0  59 25 3e 5f 73 74 61 72  74 25 21 32 30 20 8c 20  |Y%>_start%!20 . |
000018c0  5f 73 74 61 72 74 25 21  32 30 3d 59 25 0d 01 1f  |_start%!20=Y%...|
000018d0  1f f2 5f 70 75 74 77 6f  72 64 28 58 25 29 3a f2  |.._putword(X%):.|
000018e0  5f 70 75 74 77 6f 72 64  28 59 25 29 0d 01 20 05  |_putword(Y%).. .|
000018f0  e1 0d 01 21 04 0d 01 22  2d dd f2 5f 70 75 74 63  |...!..."-.._putc|
00001900  6f 6f 72 64 73 28 5f 73  74 61 72 74 25 2c 20 6c  |oords(_start%, l|
00001910  78 25 2c 20 62 79 25 2c  20 72 78 25 2c 20 74 79  |x%, by%, rx%, ty|
00001920  25 29 0d 01 23 14 5f 73  74 61 72 74 25 21 30 3d  |%)..#._start%!0=|
00001930  6c 78 25 3c 3c 38 0d 01  24 14 5f 73 74 61 72 74  |lx%<<8..$._start|
00001940  25 21 34 3d 62 79 25 3c  3c 38 0d 01 25 14 5f 73  |%!4=by%<<8..%._s|
00001950  74 61 72 74 25 21 38 3d  72 78 25 3c 3c 38 0d 01  |tart%!8=rx%<<8..|
00001960  26 15 5f 73 74 61 72 74  25 21 31 32 3d 74 79 25  |&._start%!12=ty%|
00001970  3c 3c 38 0d 01 27 05 e1  0d 01 28 04 0d 01 29 39  |<<8..'....(...)9|
00001980  dd f2 43 44 72 61 77 5f  70 61 74 68 6f 62 6a 65  |..CDraw_pathobje|
00001990  63 74 28 66 69 6c 6c 25  2c 20 63 6f 6c 25 2c 20  |ct(fill%, col%, |
000019a0  74 68 69 63 6b 25 2c 20  64 61 73 68 25 2c 20 70  |thick%, dash%, p|
000019b0  61 74 68 24 29 0d 01 2a  2f f2 43 44 72 61 77 5f  |ath$)..*/.CDraw_|
000019c0  6f 70 65 6e 70 61 74 68  28 66 69 6c 6c 25 2c 20  |openpath(fill%, |
000019d0  63 6f 6c 25 2c 20 74 68  69 63 6b 25 2c 20 64 61  |col%, thick%, da|
000019e0  73 68 25 29 0d 01 2b 1c  f2 43 44 72 61 77 5f 65  |sh%)..+..CDraw_e|
000019f0  78 74 65 6e 64 70 61 74  68 28 70 61 74 68 24 29  |xtendpath(path$)|
00001a00  0d 01 2c 14 f2 43 44 72  61 77 5f 63 6c 6f 73 65  |..,..CDraw_close|
00001a10  70 61 74 68 0d 01 2d 05  e1 0d 01 2e 04 0d 01 2f  |path..-......../|
00001a20  30 dd f2 43 44 72 61 77  5f 6f 70 65 6e 70 61 74  |0..CDraw_openpat|
00001a30  68 28 66 69 6c 6c 25 2c  20 63 6f 6c 25 2c 20 74  |h(fill%, col%, t|
00001a40  68 69 63 6b 25 2c 20 64  61 73 68 25 29 0d 01 30  |hick%, dash%)..0|
00001a50  0e e7 20 43 44 72 61 77  25 20 8c 0d 01 31 11 ea  |.. CDraw% ...1..|
00001a60  20 70 61 74 74 65 72 6e  24 2c 49 25 0d 01 32 11  | pattern$,I%..2.|
00001a70  5f 73 74 61 72 74 25 3d  5f 70 74 72 25 0d 01 33  |_start%=_ptr%..3|
00001a80  10 f2 5f 70 75 74 77 6f  72 64 28 32 29 0d 01 34  |.._putword(2)..4|
00001a90  0d 5f 70 74 72 25 2b 3d  32 30 0d 01 35 2a f2 5f  |._ptr%+=20..5*._|
00001aa0  70 75 74 63 6f 6f 72 64  73 28 5f 73 74 61 72 74  |putcoords(_start|
00001ab0  25 2b 38 2c 31 3c 3c 33  30 2c 31 3c 3c 33 30 2c  |%+8,1<<30,1<<30,|
00001ac0  30 2c 30 29 0d 01 36 1e  f2 5f 70 75 74 77 6f 72  |0,0)..6.._putwor|
00001ad0  64 28 a4 5f 63 6f 6c 6f  75 72 28 66 69 6c 6c 25  |d(._colour(fill%|
00001ae0  29 29 0d 01 37 1d f2 5f  70 75 74 77 6f 72 64 28  |))..7.._putword(|
00001af0  a4 5f 63 6f 6c 6f 75 72  28 63 6f 6c 25 29 29 0d  |._colour(col%)).|
00001b00  01 38 18 f2 5f 70 75 74  77 6f 72 64 28 74 68 69  |.8.._putword(thi|
00001b10  63 6b 25 3c 3c 38 29 0d  01 39 28 f2 5f 70 75 74  |ck%<<8)..9(._put|
00001b20  77 6f 72 64 28 5f 66 6c  61 67 73 25 20 84 20 26  |word(_flags% . &|
00001b30  38 30 2a 2d 28 64 61 73  68 25 3c 3e 30 29 29 0d  |80*-(dash%<>0)).|
00001b40  01 3a 0f e7 20 64 61 73  68 25 3e 30 20 8c 0d 01  |.:.. dash%>0 ...|
00001b50  3b 1a 70 61 74 74 65 72  6e 24 3d 5f 64 61 73 68  |;.pattern$=_dash|
00001b60  24 28 64 61 73 68 25 29  0d 01 3c 10 f2 5f 70 75  |$(dash%)..<.._pu|
00001b70  74 77 6f 72 64 28 30 29  0d 01 3d 1a f2 5f 70 75  |tword(0)..=.._pu|
00001b80  74 77 6f 72 64 28 a9 70  61 74 74 65 72 6e 24 2f  |tword(.pattern$/|
00001b90  34 29 0d 01 3e 16 e3 20  49 25 3d 31 20 b8 20 a9  |4)..>.. I%=1 . .|
00001ba0  70 61 74 74 65 72 6e 24  0d 01 3f 1b 3f 5f 70 74  |pattern$..?.?_pt|
00001bb0  72 25 3d 97 c1 70 61 74  74 65 72 6e 24 2c 49 25  |r%=..pattern$,I%|
00001bc0  2c 31 29 0d 01 40 0c 5f  70 74 72 25 2b 3d 31 0d  |,1)..@._ptr%+=1.|
00001bd0  01 41 07 ed 49 25 0d 01  42 05 cd 0d 01 43 05 cd  |.A..I%..B....C..|
00001be0  0d 01 44 05 e1 0d 01 45  04 0d 01 46 1d dd f2 43  |..D....E...F...C|
00001bf0  44 72 61 77 5f 65 78 74  65 6e 64 70 61 74 68 28  |Draw_extendpath(|
00001c00  70 61 74 68 24 29 0d 01  47 13 ea 20 5f 70 61 74  |path$)..G.. _pat|
00001c10  68 74 79 70 65 25 2c 49  25 0d 01 48 10 c8 95 20  |htype%,I%..H... |
00001c20  70 61 74 68 24 3c 3e 22  22 0d 01 49 1b c8 8e 20  |path$<>""..I... |
00001c30  a4 5f 6e 65 78 74 63 68  75 6e 6b 28 70 61 74 68  |._nextchunk(path|
00001c40  24 29 20 ca 0d 01 4a 1a  c9 20 22 4d 4f 56 45 22  |$) ...J.. "MOVE"|
00001c50  20 3a 5f 70 61 74 68 74  79 70 65 25 3d 32 0d 01  | :_pathtype%=2..|
00001c60  4b 1a c9 20 22 43 47 41  50 22 20 3a 5f 70 61 74  |K.. "CGAP" :_pat|
00001c70  68 74 79 70 65 25 3d 34  0d 01 4c 1b c9 20 22 43  |htype%=4..L.. "C|
00001c80  4c 4f 53 45 22 20 3a 5f  70 61 74 68 74 79 70 65  |LOSE" :_pathtype|
00001c90  25 3d 35 0d 01 4d 1b c9  20 22 43 55 52 56 45 22  |%=5..M.. "CURVE"|
00001ca0  20 3a 5f 70 61 74 68 74  79 70 65 25 3d 36 0d 01  | :_pathtype%=6..|
00001cb0  4e 19 c9 20 22 47 41 50  22 20 3a 5f 70 61 74 68  |N.. "GAP" :_path|
00001cc0  74 79 70 65 25 3d 37 0d  01 4f 1a c9 20 22 44 52  |type%=7..O.. "DR|
00001cd0  41 57 22 20 3a 5f 70 61  74 68 74 79 70 65 25 3d  |AW" :_pathtype%=|
00001ce0  38 0d 01 50 05 cb 0d 01  51 15 e7 20 5f 70 61 74  |8..P....Q.. _pat|
00001cf0  68 74 79 70 65 25 3c 3e  30 20 8c 0d 01 52 19 f2  |htype%<>0 ...R..|
00001d00  5f 70 75 74 77 6f 72 64  28 5f 70 61 74 68 74 79  |_putword(_pathty|
00001d10  70 65 25 29 0d 01 53 13  c8 8e 20 5f 70 61 74 68  |pe%)..S... _path|
00001d20  74 79 70 65 25 20 ca 0d  01 54 0e c9 20 32 2c 33  |type% ...T.. 2,3|
00001d30  2c 37 2c 38 3a 0d 01 55  14 f2 5f 70 75 74 70 61  |,7,8:..U.._putpa|
00001d40  69 72 28 70 61 74 68 24  29 0d 01 56 08 c9 20 36  |ir(path$)..V.. 6|
00001d50  3a 0d 01 57 0e e3 20 49  25 3d 31 20 b8 20 33 0d  |:..W.. I%=1 . 3.|
00001d60  01 58 14 f2 5f 70 75 74  70 61 69 72 28 70 61 74  |.X.._putpair(pat|
00001d70  68 24 29 0d 01 59 08 ed  20 49 25 0d 01 5a 05 cb  |h$)..Y.. I%..Z..|
00001d80  0d 01 5b 05 cd 0d 01 5c  05 ce 0d 01 5d 05 e1 0d  |..[....\....]...|
00001d90  01 5e 04 0d 01 5f 15 dd  f2 43 44 72 61 77 5f 63  |.^..._...CDraw_c|
00001da0  6c 6f 73 65 70 61 74 68  0d 01 60 10 f2 5f 70 75  |losepath..`.._pu|
00001db0  74 77 6f 72 64 28 30 29  0d 01 61 1b 5f 73 74 61  |tword(0)..a._sta|
00001dc0  72 74 25 21 34 3d 5f 70  74 72 25 2d 5f 73 74 61  |rt%!4=_ptr%-_sta|
00001dd0  72 74 25 0d 01 62 3f f2  5f 63 68 65 63 6b 73 70  |rt%..b?._checksp|
00001de0  61 63 65 28 5f 73 74 61  72 74 25 21 38 2c 20 5f  |ace(_start%!8, _|
00001df0  73 74 61 72 74 25 21 31  32 2c 20 5f 73 74 61 72  |start%!12, _star|
00001e00  74 25 21 31 36 2c 20 5f  73 74 61 72 74 25 21 32  |t%!16, _start%!2|
00001e10  30 29 0d 01 63 05 e1 0d  01 64 04 0d 01 65 19 dd  |0)..c....d...e..|
00001e20  a4 5f 6e 65 78 74 63 68  75 6e 6b 28 f8 20 70 61  |._nextchunk(. pa|
00001e30  74 68 24 29 0d 01 66 0f  ea 20 50 25 2c 63 68 75  |th$)..f.. P%,chu|
00001e40  6e 6b 24 0d 01 67 16 50  25 3d a7 70 61 74 68 24  |nk$..g.P%=.path$|
00001e50  2b 22 20 22 2c 22 20 22  29 0d 01 68 24 63 68 75  |+" "," ")..h$chu|
00001e60  6e 6b 24 3d c0 70 61 74  68 24 2c a7 70 61 74 68  |nk$=.path$,.path|
00001e70  24 2b 22 20 22 2c 22 20  22 29 2d 31 29 0d 01 69  |$+" "," ")-1)..i|
00001e80  16 70 61 74 68 24 3d c1  70 61 74 68 24 2c 50 25  |.path$=.path$,P%|
00001e90  2b 31 29 0d 01 6a 0b 3d  63 68 75 6e 6b 24 0d 01  |+1)..j.=chunk$..|
00001ea0  6b 04 0d 01 6c 17 dd f2  5f 70 75 74 70 61 69 72  |k...l..._putpair|
00001eb0  28 f8 20 70 61 74 68 24  29 0d 01 6d 0b ea 20 58  |(. path$)..m.. X|
00001ec0  25 2c 59 25 0d 01 6e 1a  58 25 3d bb a4 5f 6e 65  |%,Y%..n.X%=.._ne|
00001ed0  78 74 63 68 75 6e 6b 28  70 61 74 68 24 29 0d 01  |xtchunk(path$)..|
00001ee0  6f 1a 59 25 3d bb a4 5f  6e 65 78 74 63 68 75 6e  |o.Y%=.._nextchun|
00001ef0  6b 28 70 61 74 68 24 29  0d 01 70 15 f2 5f 70 75  |k(path$)..p.._pu|
00001f00  74 77 6f 72 64 73 28 58  25 2c 59 25 29 0d 01 71  |twords(X%,Y%)..q|
00001f10  05 e1 0d ff                                       |....|
00001f14