Compucolor.org – Virtual Media

Listing of file='DRAW.BAS;01' on disk='vmedia/chip_128-sector.ccvf'

10 REM  DRAW   C BELL/SEPT 79
12 GOSUB 5000
15 PLOT 27,24:REM  SET PAGE MODE
17 XC= 63:YC= 63:REM  START IN CENTER PAGE
20 PLOT 12
30 GOSUB 50000:REM  GET ONE CHARACTER FROM THE SCREEN
40 IF CH$= "E"THEN OUT 8,255:PLOT 27,75:END :GOTO 30
50 IF CH= 12THEN XC= 63:YC= 63:GOTO 30
60 IF CH$= "L"THEN GOTO 1000:REM  LOAD ROUTINE
70 IF CH$= "S"THEN GOTO 2000:REM  SAVE ROUTINE
72 IF CH$= "R"THEN GOTO 4000:REM  RULER ROUTINE
73 IF CH$= "C"OR CH$= "B"THEN GOTO 6000:REM  COMPASS/BALL RTN
75 IF CH$= "X"OR CH$= "Y"OR CH$= "M"THEN GOTO 3000:REM  MOVE RTN
80 IF CH$< "1"OR CH$> "9"THEN GOTO 30
90 ON CH- 48GOTO 110,120,130,140,150,160,170,180,190
95 GOTO 30
100 GOTO 30
110 XC= XC- 1:YC= YC- 1:GOTO 200
120 YC= YC- 1:GOTO 200
130 XC= XC+ 1:YC= YC- 1:GOTO 200
140 XC= XC- 1:GOTO 200
150 GOTO 200
160 XC= XC+ 1:GOTO 200
170 XC= XC- 1:YC= YC+ 1:GOTO 200
180 YC= YC+ 1:GOTO 200
190 XC= XC+ 1:YC= YC+ 1:GOTO 200
200 IF XC< 0THEN XC= 127
205 IF XC> 127THEN XC= 0
210 IF YC< 0THEN YC= 127
215 IF YC> 127THEN YC= 0
220 PLOT 2,XC,YC,255
230 GOTO 30
1000 REM  LOAD PICTURE ROUTINE
1005 OUT 8,255
1010 PLOT 3,0,31:INPUT "ENTER PICTURE NAME:";PC$
1015 OUT 8,247
1020 PLOT 27,4
1030 PRINT "LOAD ";PC$;".PIC":PLOT 27,27
1040 GOTO 30
2000 REM  SAVE ROUTINE
2005 OUT 8,255
2010 PLOT 3,0,31:INPUT "ENTER PICTURE NAME:";PC$
2015 OUT 8,247
2017 PLOT 3,0,31,11
2020 PLOT 27,4
2030 PRINT "SAVE ";PC$;".PIC 7000 1000":PLOT 27,27
2040 GOTO 30
3000 REM  MOVE PLOT POINT ROUTINE
3010 OUT 8,255
3020 PLOT 3,0,31:INPUT "ENTER X,Y: ";XC,YC
3025 PLOT 3,0,31,11:OUT 8,247
3030 GOTO 30
4000 REM  RULER ROUTINE TO DRAW A LINE
4010 OUT 8,255
4020 PLOT 3,0,31:INPUT "ENTER X1,Y1,X2,Y2: ";X1,Y1,X2,Y2
4025 PLOT 3,0,31,11
4030 OUT 8,247
4040 PLOT 2,X1,Y1,242,X2,Y2,255
4050 GOTO 30
5000 PLOT 12
5010 PRINT "DRAW ROUTINE FOR THE COMPUCOLOR II."
5020 PRINT :PRINT "INSTRUCTIONS:"
5030 PRINT "   WHEN IN DRAW MODE, THE CURSOR WILL BE PLACED"
5040 PRINT "   IN THE LOWER LEFT HAND CORNER OF THE SCREEN."
5050 PRINT "   YOU MAY PLOT, USING THE COMPUCOLOR BLOCK PLOTTING"
5060 PRINT "   SCHEME BY USING THE NUMERIC KEYPAD OR THE NUMBERS"
5070 PRINT "   1 THRU 9.  BY MOVING THE CURSOR, YOU WILL PLACE"
5080 PRINT "   THE PROGRAM IN TEXT ENTRY MODE.  EACH CHARACTER"
5090 PRINT "   WILL APPEAR AS TYPED ADVANCING THE CURSOR ONE "
5100 PRINT "   POSITION EACH KEYSTROKE.  TEXT MODE IS TERMINATED"
5110 PRINT "   BY DEPRESSING THE RETURN KEY.  ENTER THE CHARACTER"
5120 PRINT "   S TO SIGNAL INTENT TO SAVE THE SCREEN IMAGE.  YOU"
5130 PRINT "   WILL BE PROMPTED FOR A 1 TO 6 CHARACTER PICTURE NAME"
5140 PRINT "   --ENTER L TO LIKEWISE LOAD A PICTURE BY NAME.  ENTER"
5150 PRINT "   R TO USE THE RULER MODE AND DRAW A LINE--SPECIFY"
5151 PRINT "   THE X1,Y1 AND X2,Y2 ENDPOINTS OF THE LINE TO DRAW."
5152 PRINT "   NOTE THAT RULER VERB DOES NOT MOVE CURRENT ORIGIN."
5155 PRINT "   M, X, OR Y SIGNALS INTENT TO MOVE THE ORIGIN POINT."
5156 PRINT "   ENTER E TO EXIT THE PROGRAM AND RETURN TO BASIC."
5160 PRINT "   CAUTION:  TO MOVE THE CURSOR DOWN--YOU MUST PRESS"
5170 PRINT "   THE SHIFT KEY AS WELL AS THE DOWN-ARROW.  TO FAIL TO"
5175 PRINT "   DO SO WILL EXIT THE BASIC PROGRAM.  SHOULD YOU DO"
5176 PRINT "   THIS BY ACCIDENT--SIMPLY TYPE CONT.  ALSO NOTE--"
5180 PRINT "   THAT ERASE PAGE, ERASE LINE, REPEAT, AND COLOR CHANGE"
5190 PRINT "   KEYS EXHIBIT AN ENTIRELY APPROPRIATE FUNTION BUT"
5200 PRINT "   MAY DIFFER SLIGHTLY FROM THEIR USE IN A STANDARD"
5201 PRINT "   BASIC PROGRAM."
5205 PRINT :PRINT "PRESS RETURN KEY TO ENTER DRAW MODE:"
5210 INPUT "";AN$
5220 RETURN
6000 REM  COMPASS ROUTINE TO DRAW A CIRCLE
6010 OUT 8,255
6020 PLOT 3,0,31:INPUT "ENTER RADIUS: ";R
6025 PLOT 3,0,31,11
6030 OUT 8,247
6040 A= XC:B= YC:REM  ESTABLISH CENTER
6045 X2= 0:Y2= 0:Y3= 0
6050 FOR X= A- RTO A+ R
6060 RT= SQR ((R^ 2)- ((X- A)^ 2))
6061 Y= INT (RT+ B+ .5)
6062 YP= INT (- RT+ B+ .5)
6070 IF X2= 0THEN PLOT 2,X,Y,255:GOTO 6075
6071 PLOT 2,X2,Y2,242,X,Y,255
6072 PLOT 2,X2,Y3,242,X,YP,255
6073 IF CH$= "C"THEN GOTO 6075
6074 PLOT 2,X,Y,242,X,YP,255
6075 X2= X:Y2= Y:Y3= YP
6079 REM  END OF LOOP
6080 NEXT X
6090 GOTO 30
50000 REM  SUBROUTINE TO GET A SINGLE CHARACTER FROM
50001 REM  THE KEYBOARD.
50002 REM  FORMAT OF INTERFACE.
50003 REM     OUT 8,255:REM ENABLE FOR INTERRUPT FROM KEYBOARD
50004 REM     CH=CALL(0):REM GET THE CHARACTER
50005 REM     OUT 8,247:REM REDISABLE FOR BASIC
50006 ZX= 40704
50010 IF ZZ> 0THEN GOTO 50100:REM  MACHINE CODE IS LOADED
50020 FOR ZZ= 1TO 13
50030 READ ZY:POKE ZX,ZY
50040 ZX= ZX+ 1
50050 NEXT ZZ
50060 DATA 205,36,0,194,0,159,22,0,58,254,129,95,201
50080 POKE 33283,0:POKE 33284,159
50100 OUT 8,255
50103 PLOT 3,0,31
50110 CH= CALL (0)
50111 IF CH= 25OR CH= 26OR CH= 28THEN SW= 1:GOTO 50110
50112 IF SW= 1AND CH< > 13THEN GOTO 50110
50113 SW= 0
50115 CH$= CHR$ (CH)
50120 OUT 8,247
50150 RETURN