The program draws two sets of concentric circles, with colour changing from circle to circle. This is done in lines 130-170.
The routine for drawing the circle is given in PROCcircle.
Once the circles are drawn out, the colours of the circles are quickly changed to give the impression of motion.
COMMANDS
Key in program and type RUN.
100 REM Program - Circles 110 MODE 6 120 PRINT TAB(10,10)"SETTING UP ."; 130 DIM sinp(63),cosp(63) 140 FOR I%=1 TO 63 150 sinp(I%)=SIN(I%*.1) 160 cosp(I%)=COS(I%*.1) 170 PRINT "."; 180 NEXT I% 190 MODE 5 200 VDU 5 210 FOR Y = 10 TO 1000 STEP 25 220 GCOL 0, Y MOD 3 +1 230 PROCcircle(Y,1) 240 PROCcircle(Y,2) 250 NEXT Y 260 K=0 270 REPEAT 280 FOR I=1 TO 3 290 VDU 19,I,(I+K) MOD 3+5;0; 300 NEXT I 310 K=(K+1) MOD 5 +1 320 FOR I=1 TO 10:NEXT I 330 UNTIL 0 340 END 350 DEF PROCcircle(R,C) 360 IF C=1 THEN VDU 29,428;512; ELSE VDU 29,856;512; 370 P=0:MOVE0,R 380 FOR I%=1 TO 63 390 DRAW R*sinp(I%),R*cosp(I%) 400 NEXT I% 410 ENDPROC
P46 Interference
This program generates an interference type pattern.
Once the pattern has been generated, the user can redefine the colours by pressing any key.
COMMANDS
Key in program and type RUN.
When pattern is generated press any key to change colours.
100 REM Program P46 - Interference 110 MODE 5 120 VDU 5 130 FOR Y=0 TO 1023 STEP 4 140 GCOL 3,Y MOD 3 150 MOVE 0,Y 160 DRAW 1279,1023-Y 170 NEXT Y 180 FOR X=1279 TO 0 STEP -8 190 GCOL 3,X MOD 3 200 MOVE X,0 210 DRAW 1279-X,1023 220 NEXT X 230 240 REPEAT 250 B=GET 260 FOR C=0 TO 3 270 VDU 19,C,RND(8)-1;0; 280 NEXT C 290 UNTIL 0
COMMANDS
Key in program and type RUN.
100 REM Program P47 - Picture 110 REPEAT 120 MODE 5 130 VDU 5 140 COL=1:SHADE=RND(8) 150 VDU 29,640;512; 160 MOVE 0,0 170 FOR A%=0 TO 500 180 GCOL 3,A% MOD 3 + 1 190 DRAW 800*SIN(A%/20),800*COS(A%/20) 200 MOVE 0,0 210 FOR J%=1 TO 3 220 VDU 19,J%,(COL+J%) MOD 3 + SHADE;0; 230 NEXT J% 240 COL=(COL+1) MOD 3 250 NEXT A% 260 UNTIL 0
P48 Picture Editor
This is a rather crude graphics editor. The program allows the user to draw squares, circles, triangles and lines on the screen.
The screen uses a text window at the bottom of the screen to allow the user to enter their picture elements.
The different parts of the picture are accessed via the function keys.
When a picture element is drawn, the user has the opportunity of undrawing it. Other commands could be designed as required.
COMMANDS
Key in program and type RUN.
Press | key 1 for square. |
key 2 for circle. | |
key 3 for triangle. | |
key 4 for line. | |
key 5 for end of program. |
100 REM Program P48 - Picture Editor 110 MODE 6 120 REM set up arrays for circle 130 DIM sinp(63),cosp(63) 140 PRINT "SETTING UP ."; 150 FOR I%=0 TO 63 160 sinp(I%)=SIN(I%*.1):cosp(I%)=COS(I%*.1) 170 PRINT "."; 180 NEXT I% 190 PRINT 200 PRINT "Use the program to develop pictures," 210 PRINT "the basic shapes that you have are:" 220 PRINT "square,circle,triangle,and line." 230 PRINT '"The program uses mode 5, you have 4" 240 PRINT "colours to choose from" 250 PRINT ''' 260 INPUT "Background (0 to 15)" bgrnd% 270 INPUT "Foreground 1 colour" f1 280 INPUT "Foreground 2 colour" f2 290 INPUT "Foreground 3 colour" f3 300 PRINT "The shapes are obtained by pressing" 310 PRINT "the appropriate key :" 320 PRINT "1=square, 2=circle" 330 PRINT "3=triangle, 4=line" 340 PRINT "5=END" 350 PRINT ''"Press any key to start" 360 Z=GET 370 MODE 5 380 VDU 19,0,bgrnd%;0; 390 VDU 19,1,f1;0; 400 VDU 19,2,f2;0; 410 VDU 19,3,f3;0; 420 REPEAT 430 VDU 28,0,31,19,31 440 X=GET:X=X-48 450 ON X GOSUB 490,690,940,1150 ELSE VDU12 460 UNTIL X=5 470 END 480 490 REM quare 500 PRINT "SQUARE"; 510 Z=INKEY(100) 520 INPUT '"Top left X=" X "Top left Y" Y "SIDE" S 530 INPUT "COLOUR" C 540 550 FOR I=1 TO 2 560 GCOL 0,C 570 MOVE X,Y 580 MOVE X+S,Y 590 PLOT 85,X+S,Y-S 600 MOVE X,Y 610 PLOT 85,X,Y-S 620 IF I=1 INPUT "Square ok" a$ 630 q=LEFT$(a$,1)="Y" OR LEFT$(a$,1)="y" 640 IF NOT q THEN C=0 ELSE I=2 650 NEXT I 660 PRINT 670 RETURN 680 690 REM Circle 700 PRINT "Circle"; 710 Z=INKEY(200) 720 INPUT '"X-CENTRE" X "Y-CENTRE" Y "RADIUS" R 730 INPUT "COLOUR" C 740 VDU 29,X;Y; 750 760 FOR I=1 TO 2 770 GCOL 0,C 780 MOVE 0,R 790 800 FOR P%=0 TO 63 810 MOVE 0,0 820 PLOT 85,R*sinp(P%),R*cosp(P%) 830 NEXT P% 850 IF I=1 INPUT "Circle ok" a$ 860 q=LEFT$(a$,1)="Y" OR LEFT$(a$,1)="y" 870 IF NOT q THEN C=0 ELSE I=2 880 NEXT I 890 900 VDU 29,0;0; 910 PRINT 920 RETURN 930 940 REM Triangle 950 PRINT "Triangle"; 960 Z=INKEY(200) 970 INPUT '"X1= " X1 "Y1= " Y1 980 INPUT "X2= " X2 "Y2= " Y2 990 INPUT "X3= " X3 "Y3= " Y3 1000 INPUT "Colour " C 1010 1020 FOR I=1 TO 2 1030 GCOL 0,C 1040 MOVE X1,Y1 1050 MOVE X2,Y2 1060 PLOT 85,X3,Y3 1070 IF I=1 INPUT "Triangle ok" a$ 1080 q=LEFT$(a$,1)="Y" OR LEFT$(a$,1)="Y" 1090 IF NOT q THEN C=0 ELSE I=2 1100 NEXT I 1110 1120 PRINT 1130 RETURN 1140 1150 REM Line 1160 PRINT "Line"; 1170 Z=INKEY(200) 1180 INPUT '"X1= " X1 "Y1= " Y1 1190 INPUT "X2= " X2 "Y2= " Y2 1200 INPUT "Colour " C 1210 1220 FOR I=1 TO 2 1230 GCOL 0,C 1240 MOVE X1,Y1 1250 DRAW X2,Y2 1260 IF I=1 INPUT "Line ok" a$ 1270 q=LEFT$(a$,1)="Y" OR LEFT$(a$,1)="y" 1280 IF NOT q THEN C=0 ELSE I=2 1290 NEXT I 1300 1310 PRINT 1320 RETURN
This program draws a cube and allows the user to zoom the cube into and out of the screen.
COMMANDS
Key in program and type RUN.
Press key I to zoom in.
Press Key O to zoom out.
100 REM Program P49 - Zoom 110 MODE 4 120 S=200 130 colour=1 140 not_colour=0 150 count=0 160 VDU 19,0,4;0;19,1,3;0; 170 VDU 29,640;512; 180 GCOL 0,1 190 PROCcube(S) 200 REPEAT 210 REPEAT 220 DS=INKEY(-38) - INKEY(-55) 230 DS=DS*10 240 UNTIL DS<>0 250 GCOL 0,not_colour 260 PROCcube(S) 270 GCOL 0,colour 280 PROCcube(S+DS) 290 S=S+DS 300 UNTIL 0 301 310 DEF PROCcube(S) 320 IF S<0 THEN ENDPROC 330 MOVE -S,S 340 DRAW S,S 350 DRAW S,-S 360 DRAW S+S/2,0 370 DRAW S+S/2,2*S 380 DRAW S/2-S,2*S 390 DRAW -S,S 400 DRAW -S,-S 410 DRAW S,-S 420 MOVE S,S 430 DRAW S+S/2,2*S 440 ENDPROC
P50 Worm
I like this program: it is used as an example of motion. When the program is RUNning a little worm slithers across the screen. The motion is fairly smooth since the next worm to be plotted is drawn in background first, and then colours are changed to shift from one position to the next.
COMMANDS
Key in program and type RUN.
100 REM Program P50 - Worm 110 MODE 5 120 S=0 130 count=0 140 colour=RND(7) 150 VDU 29,0;512; 160 VDU 19,3,colour;0;:REM Foreground colour 170 VDU 19,1,colour;0;:REM Drawing colour=colour 180 VDU 5 190 GCOL 0,1 200 PROCstraight(S) 210 DS=50 220 REPEAT 230 REPEAT 240 S=S+DS 250 count=count+1 260 plot_colour=count MOD 2 + 1 270 GCOL 1,plot_colour 280 PROCbent(S) 290 VDU 19,plot_colour,colour;0; 300 VDU 19,3-plot_colour,0;0; 310 GCOL 2,plot_colour 320 PROCstraight(S-DS) 330 REM do again moving worm 340 Z=INKEY(10):REM slow it down 350 S=S+DS 360 count=count+1 370 plot_colour=count MOD 2 + 1 380 GCOL 1,plot_colour 390 PROCstraight(S) 400 VDU 19,plot_colour,colour;0; 410 VDU 19,3-plot_colour,0;0; 420 GCOL 2,plot_colour 430 PROCbent(S-DS) 440 UNTIL S>1280 OR S<0 450 DS=-DS 460 UNTIL 0 470 END 480 490 DEF PROCstraight(S) 500 MOVE S,0 510 DRAW S+100,0 520 ENDPROC 530 540 DEF PROCbent(S) 550 MOVE S,0 560 DRAW S+20,0 570 DRAW S+40,20 580 DRAW S+60,0 590 DRAW S+100,0 600 ENDPROC
P51 Drawing
This program allows the user to doodle on the screen.
COMMANDS
Key in program and type RUN.
Press key | "W" to draw in white |
"B" to draw in black | |
"C" to clear the screen. |
100 REM Program P51 - Drawing 110 MODE 4 120 VDU 5 130 MOVE 639,511 140 REPEAT 150 IF INKEY(-83) THEN CLS:MOVE 639,511 160 IF INKEY(-101) THEN GCOL 0,0 170 IF INKEY(-34) THEN GCOL 0,1 180 X=INKEY(-26) - INKEY(-122) 190 Y=INKEY(-42) - INKEY(-58) 200 PLOT 1,X,Y 210 UNTIL 0
Try the effect of other functions in line 370 and 390.
COMMANDS
Key in and type RUN
100 REM Program P52 - Writing Text at the Graphics Cursor 110 MODE 5 120 VDU 19,0,3;0;19,3,4;0;19,2,2;0; 130 COLOUR 1 140 PRINT '"This program shows" 150 PRINT '"the interesting" 160 PRINT '"effect of writing" 170 PRINT '"text at the" 180 PRINT '"graphics cursor." 190 delay=INKEY(200) 200 COLOUR 2 210 PRINT ''"The program writes" 220 PRINT '"text in various" 230 PRINT '"colours." 240 delay=INKEY(200) 250 COLOUR 3 260 PRINT ''"Superimposed on" 270 PRINT '"the text are" 280 PRINT '"simple mathematical" 290 PRINT '"functions." 300 delay=INKEY(200) 310 320 REM and now writing at graphics 330 sin$="SIN ":cos$="COS " 340 VDU 5:REM write text at graphics 350 X=0:K=0 360 GCOL 4,0: REM Use GCOL statements to select colour for text written at graphics cursor 370 REPEAT 380 MOVE X,SIN(-PI+X*2*PI/1280)*200+800 390 PRINT MID$(sin$,K+1,1) 400 MOVE X,COS(-PI+X*2*PI/1280)*200+300 410 PRINT MID$(cos$,K+1,1) 420 430 X=X+40 440 K=((K+1) MOD 4) 450 UNTIL X>1278 460 GCOL 0,1 470 MOVE 0,32 480 PRINT "H O W Z A T !!!" 490 END