10 REM DRAW.BAS  -  MALEN AUF DEM BILDSCHIRM MIT DEM JOYSTICK IN PIO2 PORT A.
16 REM
18 REM A.HERRMANN	27.11.83
20 REM
50 DIM SCREEN%(80,24)
80 CTRLZ$=CHR$(&H1A)
84 ESC$=CHR$(&H1B)
88 CALL INIJOY
90 PRINT CTRLZ$;ESC$;"A";CHR$(&H22)	: REM CLEAR SCREEN, CURSOR ON
92 INPUT "DELAY FAKTOR (>=1  0=ENDE) = ";D
94 IF D=0 GOTO 500
95 D=1./D : B%=13
96 INPUT "RESTORE SCREEN ? (Y/N) ",C$
100 XMIN%=0 : YMIN%=0 : XMAX%=159 : YMAX%=95
102 PON%=1 : POFF%=0
104 ERA%=0 : DRAW%=0 : OLD%=0 : PB%=0
106 REM
107 PRINT CTRLZ$;ESC$;"A "		:REM CLEAR SCREEN, CURSOR OFF
108 IF C$="Y" GOTO 130
110 CALL WINDOW(XMIN%,YMIN%,XMAX%,YMAX%)
112 CALL LINETO(XMIN%,YMAX%,PON%)
114 CALL LINETO(XMAX%,YMAX%,PON%)
116 CALL LINETO(XMAX%,YMIN%,PON%)
118 CALL LINETO(XMIN%,YMIN%,PON%)
120 GOTO 140
130 GOSUB 650				:REM RESTORE SCREEN
140 X=(XMAX%-XMIN%)/2 : Y=(YMAX%-YMIN%)/2
142 X%=INT(X) : Y%=INT(Y)
150 I%=0
160 C$=INPUT$(2) : R%=VAL(C$)
162 IF R%=0 GOTO 90
170 CALL CIRCLE(X%,Y%,R%,PON%)
180 GOTO 160
190 REM
200 CALL PUTP(X%,Y%,PON%)
202 X0%=X% : Y0%=Y%
210 C%=INP(05) : IF C%=B% GOTO 220
212 B%=C% : I%=B%-&H30
214 IF I%<=0 OR I%>9 GOTO 90	
216 D=1./I%			:REM NEUER DELAY FAKTOR
220 CALL JOYA(I%)
222 IF I%=0 GOTO 210
224 IF I%=15 GOTO 400
230 ON I% GOSUB 300,310,340,320,380,350,380,330,370,390,390,360,380,390
240 X1%=INT(X) : Y1%=INT(Y)
242 IF X1%=X% AND Y1%=Y% GOTO 210
250 IF ERA% GOTO 258
252 IF DRAW% OR OLD% GOTO 260
258 CALL PUTP(X0%,Y0%,POFF%)
260 CALL GETP(X1%,Y1%,OLD%)
262 X%=X1% : Y%=Y1%
270 PRINT ESC$;"V";		:REM CURSOR HOME
272 PRINT USING "### ";X%;Y%
280 GOTO 200
290 REM
300 IF Y%<YMAX% THEN Y=Y+D : REM NORTH
302 GOTO 378
310 IF X%<XMAX% THEN X=X+D : REM EAST
312 GOTO 378
320 IF Y%>YMIN% THEN Y=Y-D : REM SOUTH
322 GOTO 378
330 IF X%>XMIN% THEN X=X-D : REM WEST
332 GOTO 378
340 GOSUB 300 : GOSUB 310 : GOTO 378 : REM NE
350 GOSUB 320 : GOSUB 310 : GOTO 378 : REM SE
360 GOSUB 320 : GOSUB 330 : GOTO 378 : REM SW
370 GOSUB 300 : GOSUB 330 : GOTO 378 : REM NW
378 PB%=0 : RETURN
380 IF PB% THEN RETURN
381 DRAW%=-1-DRAW%	: REM PB LEFT
382 ERA%=0 : PB%=-1
384 RETURN
390 IF PB% THEN RETURN
391 ERA% =-1-ERA%	: REM PB RIGHT
392 DRAW%=0 : PB%=-1
394 RETURN
400 GOSUB 600		: REM PB L+R	SAVE SCREEN
410 GOTO 90
500 END
600 CALL GETWIN(SCREEN%(0,0))
602 RETURN
650 CALL PUTWIN(SCREEN%(0,0))
652 RETURN
690 REM



