4 rem *** DRAWING AREA SETUP *** 5 scnclr 10 input "enter screen x coord of origin (default 320): ",xs 20 input "enter screen y coord of origin (default 200): ",ys 30 input "enter zoom (default 1): ",z 31 if z<=0 then print "": print "zoom must be >0, please enter the correct value": goto 30 32 xp=-30000 : rem dummy previous X value 33 yp=-30000 : rem dummy previous X value 34 xr=320/z : rem RANGE defined as nominal X resolution divided by zoom 39 rem *** DRAWING AREA IS BEING DRAWN *** 40 graphic clr 50 screen def 1,1,1,4: rem screen def 1,0,0,4 60 screen open 1 70 palette 1,0,0,0,0 : rem black 80 palette 1,1,15,0,0 : rem red 90 palette 1,2,0,0,15 : rem blue 100 palette 1,3,0,15,0 : rem green 110 palette 1,4,15,11,0 : rem orange 120 palette 1,5,0,11,15 : rem dark cyan 121 palette 1,6,15,15,15 : rem white 122 palette 1,7,15,15,0 : rem yellow 123 palette 1,8,7,7,7 : rem medium gray 130 screen set 1,1 140 scnclr 2 150 border 2 270 rem *** CARTESIAN AXES ARE BEING DRAWN (FROM -3000 TO 3000) *** 280 pen 0,6 285 rem *** VERTICAL (Y) AXIS 290 x=0: y=0-3000: gosub 1000 300 x0=x: y0=y: x=0: y=3000: gosub 1000 310 x1=x: y1=y: line x0,y0,x1,y1 315 rem *** HORIZONTAL (X) AXIS *** 320 x=0-3000: y=0: gosub 1000 330 x0=x: y0=y: x=3000: y=0: gosub 1000 340 x1=x: y1=y: line x0,y0,x1,y1 341 pen 0,7 420 gosub 2000 500 gosub 5090 1000 rem CARTESIAN COORDINATES TO SCREEN COORDINATES 1001 x=x*z 1002 y=y*z 1010 x=x+xs 1020 y=ys-y 1030 return 2000 rem PLOT THE FUNCTION 2001 st=1/z : rem the STEP is the inverse of the zoom 2010 for x0=-xs to xs step st 2020 y0=sin(x0) 2021 y1=tan(x0) 2022 y0=y0*y1 : rem y0=sin(x0)*tan(x0) 2030 x=x0 2031 y=y0 2040 gosub 1000 2050 rem draw x,y 2051 rem print x,y 2055 line xp,yp,x,y 2056 xp=x: yp=y 2060 next x0 5090 get a$ 5100 if a$ = "" then goto 5090 5110 screen close 1 5120 palette restore 5130 border 6