start tok64 d64-cagr7y 100 REM ************************ 110 REM ** ** 120 REM ** function plotter ** 130 REM ** ** 140 REM ************************ 150 REM 160 REM 170 REM def fn - routine: 180 REM ***************** 190 REM 200 RESTORE:DIM a$(25):PRINT CHR$(147) 210 PRINT "enter the function to graph":PRINT:PRINT:PRINT 220 GOSUB 500 : REM input routine 230 ad=2684-20:REM poke start 240 FOR x=1 TO 25:READ a$(x):NEXT x:REM read data 250 FORx=1TOLEN(a$):ad=ad+1 260 q=x:FORy=1TO25:b$=a$(y):FORz=1TOLEN(b$):c$=MID$(a$,x,1) 270 IFc$=" "THENad=ad-1:NEXTx:GOTO310 280 IFc$=MID$(b$,z,1)THENx=x+1:NEXTz:POKEad,y+169:x=x-1:NEXTx:GOTO310 290 x=q:NEXTy 300 POKEad,ASC(c$):NEXTx 310 POKEad+1,58:POKEad+2,143 340 REM place holders: 350 DEFFNf(x)=00000000000000000000000000000000000000000000000000000000000000000000 400 REM 25 functions: 410 DATA+,-,*,/,{^},and,or,<,=,>,sgn,int,abs,usr,fre,pos,sqr,rnd,log,exp 420 DATAcos,sin,tan,atn,peek 430 GOTO600:REM continue 500 INPUT"f(x)=";a$:RETURN:REM input routine (for construction) 540 REM 550 REM ***************** 560 REM **** graphics routines **** 570 REM ***************** 580 REM 600 in=51200:of=51203 610 gc=51206:sc=51209 620 pc=51212:pl=51215 630 up=51218:sl=51221 640 cl=51224:gl=51227 650 gs=51230:hc=51233 660 REM 670 REM ************ 680 REM **** main program **** 690 REM ************ 700 REM 710 PRINT"{down}{right}enter the following parameters:{down*2} 715 IFf1>.THENPRINT"f1 (xscale){space*2}?"f1"{up} 720 INPUT"f1 (xscale){space*2}";f1 725 IFf2>.THENPRINT"f2 (yscale){space*2}?"f2"{up} 730 INPUT"f2 (yscale){space*2}";f2 735 a=a-160*(a=.):PRINT"a{space*2}(x offset)?"a"{up} 740 INPUT"a{space*2}(x offset)";a 745 b=b-100*(b=.):PRINT"b{space*2}(y offset)?"b"{up} 750 INPUT"b{space*2}(y offset)";b 1000 SYSin:SYSsc,16*1+5:REM initialize 1005 SYSgc:REM clear graphics screen 1010 REM 1020 REM draw axes: 1030 REM ********** 1040 IFa>=.ANDa<320THENSYSsl,a,.,a,199:REM x-axis 1050 IFb>=.ANDb<200THENSYSsl,.,b,319,b:REM y-axis 1060 REM 1070 REM draw routine: 1080 REM ************* 1210 fl%=1:REM outside-flag 1220 FORx=1TO319 1230 y=-f2*FNf((x-a)/f1)+b 1240 IFy<.ORy>199THENfl%=1:NEXT:GOTO1275 1250 IFfl%=.THENSYSsl,x1,y1,x,y 1260 fl%=. 1270 x1=x:y1=y:NEXT:REM save last coord. 1275 SYSsc,1*16+14:REM change colors 1280 POKE198,.:WAIT198,255:GETa$:SYSof:REM graphics off 1290 REM ***** menu: ***** 1300 PRINT"{down}{right} select one:{down} 1310 PRINT"{down}{right}(1) other parameters 1320 PRINT"{down}{right}(2) another function 1340 PRINT"{down}{right}(3) save graphics 1350 PRINT"{down}{right}(4) load graphics 1360 PRINT"{down}{right}(5) hardcopy 1370 PRINT"{down}{right}(6) exit 1450 WAIT198,1:GETa$ 1460 ONVAL(a$)GOTO700,1480,1510,1600,1650,1500 1470 GOTO1450:REM input error 1480 RUN:aNOTher functiON 1500 END:exit 1510 REM 1520 REM save graphics: 1530 REM 1540 INPUT"filename,dev";fi$,da 1550 SYSgs,fi$,da:REM save 1560 PRINT"ok":GOTO1450 1570 REM 1580 REM load graphics: 1590 REM 1600 INPUT"filename,dev";fi$,da 1610 SYSg:,fi$,da:REM load 1620 SYSiDIM:SYSsc,16*1+5:GOTO1280 1630 REM 1640 REM hardcopy: 1645 REM 1650 PRINT"{down}{right}ready printer and press a key":POKE198,0:WAIT198,1 1660 OPEN1,4:SYShc,1:CLOSE1:REM hardcopy 1670 PRINT"{down}{right}ok":GOTO1450 2000 FORi=.TO999:POKE49152+i,PEEK(1024+i):NEXT:SYSof:FORi=.TO999 2010 POKE1024+i,PEEK(49152+i):NEXT stop tok64 (bastext 1.0)