!lm10
!rm76
Conquering Paddle Jitter...........................Brooke Boering

A well-known problem with the paddles supplied with the Apple (at least they USED to be supplied!) concerns their tendency to rock back and forth between two adjacent values.  "Jittering" like this can cause problems unless accuracy is unimportant, or unless the effect is somehow pleasing.

One solution to the jitter problem is to force the new paddle reading to move at least two increments from the prior reading.  This words, but at the price of lower resolution.  Also, it can have subtle side-effects.

A better solution is to keep track of the previous direction of movement, and enforcing the "rule of two" only if the direction is reversed.

The following program demonstrates my solution.  It is set up to work with Applesoft, but it would be rather simple to make it directly callable from your own assembly language routines.  To use from Applesoft, POKE the paddle number (0-3) at 768, CALL 770, and read the paddle value with PEEK(769).

I set up the following Applesoft program to test the routine, and to compare it with normal paddle readings:

     10 POKE 768,0:CALL 770:PRINT PEEK(769):GOTO10
     20 PRINT PDL(0):GOTO20

I typed RUN 20 and set the paddle to a jittery position.  Then I typed control-C and RUN 10 to test the smoothing subroutine.  The program really works!

