On the 8-bit, the paddles are read by storing to POTGO ($D20B) then waiting for POKEY to generate the value.
According to the HW manual, capacitor dump transistors charge, and return a value from 0 to 227.
This is useful to us, since whilst generating a POTx value, the registers count up from 0 at the rate of 1 per scanline (exactly). In Fast Scan mode, the scan takes 2 scanlines - which equates to 228 machine cycles.
So, instead of tight timing loops which are affected by DMA and Refresh we can set fast pot scan and just wait until POTx reaches the delay value required.
Or, in standard mode, we can get delays by x scanlines - which is more precise than ANTIC's VCOUNT as it only has 2 line resolution.
This method has distinct advantages over POKEY timers as they are more involved to setup and monitor, plus it costs you a sound channel. The other advantage is that you don't need wasteful delay loops - you just periodically check the counter value.
The downside, though, is that you can't have a paddle plugged into that port because the POTn register might not count as high as you want it to.
Although, on the XL/XE, POT4-7 are not connected so are free to use. On 400/800 you just have to trust the user not to have paddles plugged into Port 4.
Downside #2 is that Atari800Win doesn't seem to emulate fast scan mode at all - the countup is instant.
Here's an example using POT7 for speech timing. Binary load file - press START or SELECT once it loads. Note that it won't work properly on the emulator:
potdemo.zip 12.81K
57 downloads (warning - contains profanities)Below is a visual representation of POT7 value as the screen is drawn. The glitches towards the right are where the value changes. Note how it stops at value 227 (brownish colour).
By storing into POTGO at a specific time, the counter can be reset. In this case, it is the OS VBI routine. But, it is quite fine to store again at a time of your own chosing, which starts the countup process again.
Edited by Rybags, Wed Jun 21, 2006 9:38 AM.













