Up one graphics.bas. By Lee Davison. Up to top

Download zipped Download zip file.

Introduction

This program demonstrates some of the graphics commands available in the EASy68K version of EhBASIC. It isn't an exhastive demo but shows all the major commands.

graphics.bas


: EhBASIC 68k for EASy68K simulator graphics demo program		
: (c) Lee Davison 2003/4 http://forum.6502.org/viewtopic.php?f=5&t=3024
:
: http://www.themotionstore.com/leeedavison/index.html
: http://members.lycos.co.uk/leeedavison/index.html

10 RECT $FFFFFF,0 : CLS : SIZE 1 : MODE 4

15 DIM COLR(7)
20 COLR(0)=$000000 : REM Black
21 COLR(1)=$FF0000 : REM Blue
22 COLR(2)=$0000FF : REM Red
23 COLR(3)=$FF00FF : REM Magenta
24 COLR(4)=$00FF00 : REM Green
25 COLR(5)=$FFFF00 : REM Cyan
26 COLR(6)=$00FFFF : REM Yellow
27 COLR(7)=$FFFFFF : REM White
28 DIM DMOD$(15)
30 DMOD$(0)="0 False         "
31 DMOD$(1)="1 True          "
32 DMOD$(2)="2 Null          "
33 DMOD$(3)="3 Inverse       "
34 DMOD$(4)="4 Colour        "
35 DMOD$(5)="5 Inverse colour"
36 DMOD$(6)="6 Inverse OR    "
37 DMOD$(7)="7 Inverse AND   "
38 DMOD$(8)="8 OR Inverse    "
39 DMOD$(9)="9 AND Inverse   "
40 DMOD$(10)="10 OR           "
41 DMOD$(11)="11 NOR          "
42 DMOD$(12)="12 AND          "
43 DMOD$(13)="13 NAND         "
44 DMOD$(14)="14 EOR          "
45 DMOD$(15)="15 ENOR         "

50 ENT$=CHR$(13) : ESC$=CHR$(27)
60 CURSOR 32,14 : PRINT "Graphics demo"
70 CURSOR 30,15 : PRINT "Hit ENTER to start"
80 P$="Hit ENTER to continue, ESC to exit - "
90 DO : GET Q$ : LOOP UNTIL Q$=ENT$

100 CLS
110 PRINT P$;"CURSOR X,Y"
120 DO
125 Y=INT(RND(0)*31)+1
130 XX=74+(Y>9)
135 X=INT(RND(0)*XX)
140 CURSOR X,Y
145 X$=STR$(X) : Y$=STR$(Y)
150 GET Q$
160 PRINT "*(";RIGHT$(X$,LEN(X$)-1);",";RIGHT$(Y$,LEN(Y$)-1);")";
170 LOOP UNTIL Q$=ENT$ OR Q$=ESC$
175 IF Q$=ESC$ THEN 9999

180 CLS
190 PRINT P$;"POINT X,Y,colour"
200 DO : GET Q$
210 X=INT(RND(0)*640)
220 Y=INT(RND(0)*465)+15
230 POINT X,Y,(RND(0)*$1000000)
240 LOOP UNTIL Q$=ENT$ OR Q$=ESC$
245 IF Q$=ESC$ THEN 9999

250 CLS
260 PRINT P$;"LINE X1,Y1,X2,Y2,colour"
270 DO : GET Q$
280 X1=INT(RND(0)*640)
290 Y1=INT(RND(0)*465)+15
300 X2=INT(RND(0)*640)
310 Y2=INT(RND(0)*465)+15
320 LINE X1,Y1,X2,Y2,(RND(0)*$1000000)
330 LOOP UNTIL Q$=ENT$ OR Q$=ESC$
335 IF Q$=ESC$ THEN 9999

340 CLS
350 PRINT P$;"LINE X,Y,colour"
355 MOVE INT(RND(0)*640),INT(RND(0)*465)+15
360 DO : GET Q$
370 X=INT(RND(0)*640)
380 Y=INT(RND(0)*465)+15
390 LINE X,Y,(RND(0)*$1000000)
400 LOOP UNTIL Q$=ENT$ OR Q$=ESC$
405 IF Q$=ESC$ THEN 9999

410 CLS
420 PRINT P$;"RECT X1,Y1,X2,Y2,line_colour"
430 DO : GET Q$
440 X1=INT(RND(0)*640)
450 Y1=INT(RND(0)*465)+15
460 X2=INT(RND(0)*640)
470 Y2=INT(RND(0)*465)+15
480 RECT X1,Y1,X2,Y2,(RND(0)*$1000000)
490 LOOP UNTIL Q$=ENT$ OR Q$=ESC$
500 IF Q$=ESC$ THEN 9999

505 RECT $FFFFFF,0
510 CLS
520 PRINT P$;"ELLIPSE X1,Y1,X2,Y2,line_colour"
530 DO : GET Q$
540 X1=INT(RND(0)*640)
550 Y1=INT(RND(0)*465)+15
560 X2=INT(RND(0)*640)
570 Y2=INT(RND(0)*465)+15
580 ELLIPSE X1,Y1,X2,Y2,(RND(0)*$1000000)
590 LOOP UNTIL Q$=ENT$ OR Q$=ESC$
600 IF Q$=ESC$ THEN 9999

605 RECT $FFFFFF,0
610 CLS
620 PRINT P$;"RECTF X1,Y1,X2,Y2,0,fill_colour"
630 DO : GET Q$
640 X1=INT(RND(0)*640)
650 Y1=INT(RND(0)*465)+15
660 X2=INT(RND(0)*640)
670 Y2=INT(RND(0)*465)+15
680 RECTF X1,Y1,X2,Y2,$0,(RND(0)*$1000000)
690 LOOP UNTIL Q$=ENT$ OR Q$=ESC$
700 IF Q$=ESC$ THEN 9999

705 RECT $FFFFFF,0
710 CLS
720 PRINT P$;"ELLIPSEF X1,Y1,X2,Y2,0,fill_colour"
730 DO : GET Q$
740 X1=INT(RND(0)*640)
750 Y1=INT(RND(0)*465)+15
760 X2=INT(RND(0)*640)
770 Y2=INT(RND(0)*465)+15
780 ELLIPSEF X1,Y1,X2,Y2,$0,(RND(0)*$1000000)
790 LOOP UNTIL Q$=ENT$ OR Q$=ESC$
800 IF Q$=ESC$ THEN 9999

805 RECT $FFFFFF,0
810 CLS
820 PRINT P$;"SIZE S"
830 S=255 : Y1=240 : Y2=Y1
840 DO : GET Q$
850 SIZE S:DEC S,S
860 X1=320-S-40
870 X2=320+S+40
880 LINE X1,Y1,X2,Y2,(RND(0)*$1000000)
890 LOOP UNTIL (Q$=ENT$ OR Q$=ESC$) OR (S<0)
895 IF Q$=ESC$ THEN 9999
900 IF S<0 THEN 830

905 CLS : SIZE 1
910 PRINT P$;"SPACE to step - MODE"
915 M=0
920 DO
925 RECT $FFFFFF,0
930 CURSOR LEN(P$)+21,0
935 PRINT DMOD$(M)
940 MODE 4
941 RECTF 0,16,639,479,COLR(0),COLR(0)
942 RECTF 80,16,159,479,COLR(1),COLR(1)
943 RECTF 160,16,239,479,COLR(2),COLR(2)
944 RECTF 240,16,319,479,COLR(3),COLR(3)
945 RECTF 320,16,399,479,COLR(4),COLR(4)
946 RECTF 400,16,479,479,COLR(5),COLR(5)
947 RECTF 480,16,559,479,COLR(6),COLR(6)
948 RECTF 560,16,639,479,COLR(7),COLR(7)
949 MODE M
950 RECTF 0,16,639,73,COLR(0),COLR(0)
951 RECTF 0,74,639,131,COLR(1),COLR(1)
952 RECTF 0,132,639,189,COLR(2),COLR(2)
953 RECTF 0,190,639,247,COLR(3),COLR(3)
954 RECTF 0,248,639,305,COLR(4),COLR(4)
955 RECTF 0,306,639,363,COLR(5),COLR(5)
956 RECTF 0,364,639,421,COLR(6),COLR(6)
957 RECTF 0,422,639,479,COLR(7),COLR(7)
960 DO : GET Q$ : LOOP WHILE Q$=""
965 INC M
970 LOOP UNTIL (Q$=ENT$) OR (Q$=ESC$) OR (M=16)
975 IF Q$=ESC$ THEN 9999
980 RECT $FFFFFF,0 : MODE 4
985 IF M=16 THEN 905

1100 CLS
1110 PRINT P$;"Moire patterns"
1120 DO
1130 MODE 4 : RECTF 0,15,639,479,0,0 : MODE 14
1140 X1=INT(RND(0)*560)+40
1150 Y1=INT(RND(0)*400)+40
1160 CO=RND(0)*$1000000
1170 DX=1:DY=0
1180 X2=0:Y2=16
1190 DO : GET Q$
1200 LINE X1,Y1,X2,Y2,CO
1210 X2=X2+DX:Y2=Y2+DY
1220 IF X2=640 THEN SWAP DX,DY:X2=639:Y2=17
1230 IF Y2=480 THEN SWAP DX,DY:DX=-DX:Y2=479:X2=638
1240 IF X2=-1 THEN SWAP DX,DY:X2=0:Y2=478
1250 IF Y2=15 THEN Y2=0
1260 LOOP WHILE (X2 OR Y2) AND Q$=""
1270 LOOP UNTIL Q$=ENT$ OR Q$=ESC$
1280 IF Q$=ESC$ THEN 9999
1290 MODE 4

9990 GOTO 100
9999 RECT $FFFFFF,0 : SIZE1 : CLS : END


Last page update: 26th May, 2004. e-mail me e-mail