Demonstration of plotting.
Appears on
Library tape of the Indiana Sinclair Timex User’s Group.
Source Code
10 CLS : DEF FN Y(X)=SIN (Y/F)*(X-Y)*(X-Y)/150: GO TO VAL "410" 20 REM *PLOTTING 30 LET Y=YL 40 FOR X=XL TO XR 50 LET XB=INT (XO+X*CF-Y*CP+.5) 60 LET Z=FN Y(X): IF Z>H THEN LET Z=H 70 LET YB=INT (YO-X*SF-Y*SP-Z+.5) 80 IF YB<H(XB) THEN LET H(XB)=YB 90 NEXT X 100 FOR X=XL TO XR STEP T 110 LET U=XO+X*CF: LET V=YO-X*SF 120 FOR Y=YL TO YR 130 LET XB=INT (U-Y*CP+.5) 140 LET Z=FN Y(X): IF Z>H THEN LET Z=H 150 LET YB=INT (V-Y*SP-Z+.5) 160 IF YB<H(XB) THEN LET H(XB)=YB 170 NEXT Y 180 FOR K=INT (U-YR*CP+.5) TO INT (U-YL*CP+.5)-1 190 PLOT K,175-(H(K)): DRAW (K+1)-K,(175-(H(K+1)))-(175-(H(K))) 200 NEXT k: NEXT x: RETURN 210 REM *PLOTTING CROSSHATCH 220 LET X=XL 230 FOR Y=YL TO YR 240 LET XB=INT (XO+X*CF-Y*CP+.5) 250 LET Z=FN Y(X): IF Z>H THEN LET Z=H 260 LET YB=INT (YO-X*SF-Y*SP-Z+.5) 270 IF YB<H(XB) THEN LET H(XB)=YB 280 NEXT Y 290 FOR Y=YL TO YR STEP T 300 LET U=XO-Y*CP: LET V=YO-Y*SP 310 FOR X=XL TO XR 320 LET XB=INT (U+X*CF+.5) 330 LET Z=FN Y(X): IF Z>H THEN LET Z=H 340 LET YB=INT (V-X*SF-Z+.5) 350 IF YB<H(XB) THEN LET H(XB)=YB 360 NEXT X 370 FOR K=INT (U+XL*CF+.5) TO INT (U+XR*CF)-1 380 PLOT K,175-(H(K)): DRAW (K+1)-K,(175-(H(K+1)))-(175-(H(K))) 390 NEXT k: NEXT x: RETURN 400 REM MAIN PROGRAM 410 DIM H(280) 420 LET XO=100: LET YO=170 430 LET PHI=.5: LET PSI=.4 440 LET XL=0: LET XR=YO 450 LET YL=XL: LET YR=XO 460 LET T=5 470 REM PLOT FUNCTION 480 LET F=10 490 REM ABBREVIATIONS AND CUTTING THE TOP 500 LET CF=COS PHI: LET SF=SIN PHI: LET CP=COS PSI: LET SP=SIN PSI 510 LET H=YO-XR*SF-YR*SP-2 520 INPUT "DO YOU DESIRE CROSSHATCHING? Y/N";T$ 530 LET CH=1 540 IF T$="Y" OR T$="y" THEN LET CH=2 550 INPUT "DO YOU WISH TO VIEW THE AXES? (Y/N)";T$ 560 IF T$="N" OR T$="n" THEN GO TO 610 570 LET A=XO+XL*CF: LET B=175-(YO-XL*SF): LET C=XO+XR*CF: LET D=175-(YO-XR*SF) 580 PLOT A,B: DRAW C-A,D-B 590 LET A=XO-YL*CP: LET B=175-(YO-YL*SP): LET C=XO-YR*CP: LET D=175-(YO-YR*SP) 600 PLOT A,B: DRAW C-A,D-B 610 PLOT 0,0: DRAW 0,175: DRAW 255,0: DRAW 0,-175: DRAW -255,0 620 FOR R=1 TO CH 630 FOR I=1 TO 280: LET H(I)=189: NEXT I 640 PRINT #0;"WORKING" 650 IF R=1 THEN GO SUB 20 660 IF R=2 THEN GO SUB 210 670 NEXT R: STOP 680 REM CONVERTED FROM APPLE II TO TS-2068 BY T.A.KNYSZEK 690 REM DOWN LOADED FROM BYTE MAGAZINE'S BBS