10 REM PROGRAM TO PRODUCE 3D PLOTS ON RADIO SHACK
20 REM CGP-115 PLOTTERS.  ASSUMES PLOTTER IS ON
30 REM SERIAL PORT. TRY VALUES OF 50,50,900 AND
40 REM 1.05 FOR X,Y STEPS, CUTOFF AND MULTILPIER
50 REM FOR INITIAL RUNS.  ANSWER "Y" TO OTHER 
60 REM QUESTIONS....FUNCTION PLOTTER IS IN LINES
70 REM 500 TO 530 AND MAY BE CHANGED FOR OTHER SHAPES
80 REM  Bob Scott May 83
90 DIM Y(2401)
100 PRINT "PRESS RETURN WHEN PLOTTER READY":INPUT AZ$
110 POKE 3,(PEEK(3) AND 63) OR 64
120 K1=180/3.1415927#
130 C1=COS(30/K1):C2=SIN(30/K1):C3=COS(150/K1):C4=SIN(150/K1)
140 LPRINT CHR$(18):LPRINT "M240,-240"
150 LPRINT "I"
160 PRINT CHR$(26);"ENTER X,Y STEPS,Y-CUTOFF,Y-AXIS MULTIPLIER: "
170 INPUT F,G,J,H
180 PRINT "TOP VIEW (Y/N)" ;
190 INPUT A$:IF A$="N" THEN W=1 ELSE W=-1
200 PRINT "BLANKING (Y/N) ";
210 INPUT A$:IF A$="N" THEN V=-1 ELSE V=1
220 FOR A=1 TO 2401:Y(A)=-1200*V:NEXT
230 FOR Z=-600 TO 600 STEP G
240   C=1
250   FOR X=-600 TO 600 STEP G
260     GOSUB 500
270     GOSUB 550
280     C=2
290     IF S>=0 THEN 310
300     C=-2
310   NEXT X
320 NEXT Z
330 FOR A=1 TO 2401:Y(A)=-1200*V:NEXT
340 FOR X=-600 TO 600 STEP G
350   C=1
360   FOR Z=-600 TO 600 STEP F
370     GOSUB 500
380     GOSUB 550
390     C=2
400     IF S>=0 THEN 420
410     C=-2
420   NEXT Z
430 NEXT X
440 LPRINT "M-240,-200"
450 LPRINT CHR$(17)
460 LLIST 500-520
470 PRINT:PRINT:PRINT "DONE"
480 POKE 3,(PEEK(3) AND 63) OR 128
490 STOP
500 R=SQR(X*X+Z*Z)
510 DR=R/K1
520 Y1=SIN(DR)/DR*600*H
530 IF Y1>J THEN Y1=J
540 RETURN
550 A=0:B=0:S=1
560 A=C1*X+A
570 B=C2*X+B
580 A=C3*Z+A
590 B=C4*Z+B
600 B=Y1+B
610 A=INT(A)
620 B=INT(B)
630 IF A<-1200 OR B<-1200 OR A>1200 OR B>1200 THEN 850
640 IF I<0 THEN 740
650 IF Y(A+1201)<=B THEN 730
660 C=1
670 S=-1
680 RETURN
690 IF Y(A+1201)=>B THEN 730
700 C=1
710 S=-1
720 RETURN
730 Y(A+1201)=B
740 IF C=1 OR C=-2  THEN 790
750 XX=A/5:YY=B/5
760 PRINT USING "X = ####.##     Y = ####.##";XX,YY
770 LPRINT  "D";XX;",";YY
780 RETURN
790 XX=A/5:YY=B/5
800 PRINT CHR$(&H1B);CHR$(&H29);
810 PRINT USING "X = ####.##     Y = ####.##";XX,YY;
820 PRINT CHR$(&H1B);CHR$(&H28)
830 LPRINT  "M";XX;",";YY
840 RETURN
850 C=1
860 S=-1
870 RETURN
   Y = ####.##";XX,YY;
820 PRINT CHR$(&H1B);CHR$(&H28)
830 LPRINT  "M";