10 REM SPIROGFX program - Richard Cox 20 WIDTH 255: E$=CHR$(27): h$=E$+"H": DEFINT a-z: DEFSNG a,i: bytes=181: aplot=&HC000 30 IF HIMEM<(&HC000+bytes) THEN PRINT "Not enough memory": STOP ELSE MEMORY &HBFFF 40 RESTORE: READ x$: WHILE x$<>"*": POKE aplot+j,VAL("&H"+x$): j=j+1: READ x$: WEND 50 ls$=E$+"X"+CHR$(32)+CHR$(32)+CHR$(31+32)+CHR$(31+16): ss$=E$+"0": cls$=E$+"E"+h$ 60 r$=CHR$(13)+CHR$(10): PRINT ss$;E$;"u";E$;"q";cls$;lsS;h$;"Setting up..."; 70 acv=180/3.141592654#: t=0: h=1: r=96: w=64: x=0: f=-1: comp=1.1: q=6: xf-0: yf=0: m=-1 21DD 80 DIM S!(360),C!(360): FOR j=0 TO 359: a=j/acv: S!(j)=SlN(a): C!(j)=COS(a): NEXT 90 S!(360)=S!(0): C!(360)=C!(0): ayratio=-1.5: axratio=1.5*2.2: xorg=360+64: yorg=128 100 WHILE NOT x: pc$=cc$: GOSUB 400: INPUT "*",c$: can=0: cc$=c$: GOSUB 120: WEND 110 PRINT ss$: END 120 REM decode c$ 130 p=1: WHILE p<=LEN(c$): l$=UPPER$(MID$(c$,p,1)): p=p+1: x=l$="F": m=INSTR("DE",l$) 140 IF l$="R" THEN n=r: GOSUB 210: r=n ELSE IF l$="V" THEN n=w: GOSUB 210: w=n 150 IF l$="H" THEN n=h: GOSUB 210: h=n ELSE IF l$="T" THEN n=t: GOSUB 210: t=n 160 IF l$="Q" THEN n=q: GOSUB 210: q=n ELSE IF l$="X" THEN n=xf: GOSUB 210: xf=n 170 IF l$="Y" THEN n=yf: GOSUB 210: yf=n ELSE IF l$="A" THEN c$=pc$: cc$=c$: p=1 180 IF m<>0 THEN m=m-2: GOSUB 260 ELSE IF 1$="C" THEN PRINT ss$;cls$;ls$; 190 IF l$="M" THEN GOSUB 210: mc$=MID$(c$,p): multi=n: GOSUB 240 200 WEND: RETURN 210 REM get n 220 IF MID$(c$,p,1)="&" THEN p=p+1 ELSE n=0 230 n=n+VAL(MID$(c$,p)): p=p+LEN(STR$(n))-1: RETURN 240 REM multi 250 FOR mj=1 TO multi: c$=mc$: GOSUB 400: GOSUB 120: NEXT: multi=0: c$="": RETURN 260 REM draw loop 270 GOSUB 400: IF NOT ok THEN RETURN ELSE msg$=MID$("DrawingErasing",1+(m+1)*7,7) 280 IF multi>0 THEN PRINT "Multi draw: ": PRINT mj;"of":multi 290 FOR j1=1 TO l1 300 DIM xy((p1-1)*2): PRINT CHR$(13);msg$;":";l1-j1+1; 310 FOR j3=0 TO p1-1 STEP 2 320 xy(j3)= xo+r1*C!(ROUND(a1))*axratio+r2*C!(ROUND(a2))*axratio 330 xy(j3+1)= yo+r1*S!(ROUND(a1))*ayratio+r2*S!(ROUND(a2))*ayratio 340 a1=a1+i1: IF a1>360 THEN a1=a1-360 350 a2=a2-i2: IF a2<0 THEN a2=a2+360 360 NEXT: can=ASC(INKEY$+"#")=8 370 IF can THEN mj=multi: j1=l1: p=LEN(c$)+1 ELSE pts=(p1)/2: CALL aplot(pts,xy(0),m) 380 ERASE xy 390 NEXT: RETURN 400 REM print details & calc 410 ok=0: PRINT ss$;h$;E$;"l";CHR$(13);TAB(17);"*";cc$;ls$ 420 m$=cls$+"Ring ###"+r$+"Wheel ### min 5"+r$+"Hole ### max###Tooth ###"+r$+"Qalty " 430 M$=m$+"### min 1"+r$+"Xoff ###"+r$+"Yoff ###": PRINT USING m$;r;w;h;noh;t;q;xf;yf 440 IF q<=0 THEN PRINT "Quality too low": RETURN 450 IF w<5 THEN PRINT "Wheel < 5": RETURN 460 IF w>=r THEN PRINT "Wheel not < ring": RETURN 470 noh=4+w/4: IF h>noh THEN PRINT "Use lower hole": RETURN 480 a1=90-(360*t/r): a1=al+(360 AND al<0): a2=a1: xo=xorg+xf*axratio: yo=yorg+yf*ayratio 490 r1=(r/2)-(w/2): r2=CSNG(w/2)*(1+noh-h)/CSNG(noh) 500 i1=360/r*((w/r)^comp*10/q): i2=i1*(r/w-1): p1=720/i1 510 l1=w: l2=r: f=2: WHILE f