Draws one cycle of a sine curve made of small boxes, each box drawn with DRAW from a point PLOTted on the curve, so the overlapping boxes form a broad ribbon, and prints SIN FUNCTION WITH A BOX at the bottom. As REM 20 says, it ends with the report B Integer out of range, 1000:1 when the last box runs off the right edge of the screen.
The program sets PAPER 0 and INK 7 but does not clear the screen, so on the first RUN after loading the curve is drawn in white on the white screen and only the caption shows; RUN it a second time (or type CLS first after setting PAPER 0) to see it white on black. A printer COPY prints it either way.
Published in The Plotter February 1993 (Using DRAW with PLOT).
Source Code
10 REM PLOT A SIN CURVE WITH A BOX
20 REM PRESS BREAK WHEN FINISHED TO DELETE MESSAGE "B INTEGER OUT OF RANGE 1000:1"
30 REM numbers .05 in LINE 130, 251 in LINE 140, and 12 in LINE 900 are important for overlapping vertical lines
120 PAPER 0: INK 7: BORDER 0
130 FOR x=0 TO 2*3.14159 STEP .05
135 IF x>6.1 THEN PRINT AT 21,0;"SIN FUNCTION WITH A BOX"
140 PLOT x/(2*3.14159)*251,SIN (x)*75+100
145 GO SUB 900
150 NEXT x
160 GO TO 160
900 LET A=12
1000 DRAW A,0
1010 DRAW 0,-22
1020 DRAW -A,0
1030 DRAW 0,22
2000 RETURNNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.


