[vcf-midatlantic] What's wrong with my program experiment?

Evan Koblentz evan at snarc.net
Wed Apr 5 14:21:35 EDT 2017

A month-ish ago I posted about my Applesoft learning experiment in which 
I figured out how to make a point (in lo-res and hi-res alike) move 
around the screen with the joystick.

At the time I couldn't figure out how to keep other images stationary 
(vs. redrawing themselves every time the joystick-checking code looped). 
Last night I solved that by (duh!) drawing a stationary point first and 
then looping back only as far as the joystick code. At first it left a 
trail, but then I added a line to immediately re-draw the same 
coordinates in black.

20 PLOT 10,10
30 X=PDL(0):Y=PDL(1)
40 X=X/6.4:Y=Y/6.4
50 X=X+0.5:Y=Y+0.5
60 X=INT(X):Y=INT(Y)
70 IF X>39 THEN X=39:IF Y>39 THEN Y=39 (because at one point I got an 
illegal quantity error when I moved the stick to the right)
90 FOR W=1 TO 50: NEXT W
110 GOTO 30

This works: the point at 10,10 remains solid while only the 
stick-controlled point moves. (I don't want to hear any snobby insults 
about "spaghetti code". This is not the actual application I'm working 
on. It's just a code snippet for the learning experiment.)

(The results are the same if I eliminate lines 50 and 60. Those lines 
only exist to round up the numbers on .5, because INT only rounds down, 
and to eliminate remainders when it prints the coordinates.)

However there may be a problem with the joystick or maybe a bug that I'm 
not seeing.

All four corners are reporting the correct values: 0,0; 0,39; 39,0; and 
39,39. When the stick centers I get 21,12. :(  But if I adjust the trim 
wheels then the corners aren't right.

Is this a joystick problem or a software bug?

More information about the vcf-midatlantic mailing list