Enhanced paddle concept
Atari paddles jitter. This is a consequence of a design which makes the wiper resistance part of the measurement. There's another way to read a potentiometer which works better: put a fixed voltage on the pot and measure the voltage at the wiper. Although severe grunge can still cause slight jitter, it will generally be on the order of 2-3 degrees--far less than in the normal design.In addition to the jitter problem, Atari paddles are time-consuming to read. Because measurements take many milliseconds, they must be polled repeatedly during a large part of the game kernel. This severely limits the types of displays the kernel can produce.I would like to offer a solution to both these problems.The paddle enhancement mod would involve opening up each paddle in a pair and rewiring it to include a small 8-pin microcontroller ($3.15 quantity 1, or about $2 in quantity 25) and two capacitors. A perboard could be used, but it may be just as easy to simply glue the part in place. Although one microcontroller could handle both paddles, doing things that way would require replacing the cabling; using a separate micro in each controller avoids that hassle.The micro would supports two methods of reading:-1- Dump the load capacitor on the paddle bin using the appropriate bit in VBLANK, then wait for the appropriate TIA input to switch (as is done with current software).-2- Output a special code sequence using the paddle's fire button "input" pin and read pack the paddle position serially over the course of 2-3 scan lines.The former approach would work with current software, and with future homebrews that are designed for standard paddles. The latter approach would be usable by new homebrew software that was written to use the enhanced paddles. While I would guess many authors would prefer to be compatible with old paddles, the CPU load they impose would make some games impossible to program. Further, adding paddle support to existing games would be much easier with the latter approach than the former.Proposed format details Output a low pulse on the fire button "input" that lasts at least 32us, then float the pin for 20 cycles, output low for 4, float for 15 or 21 (see below), then output low for 4, float for 9, and then read nine bits of data (position + button) at a rate of 13 cycles/bit.The data would be output in a somewhat unusual sequence depending upon the time between the last two falling edges. If it was 19 cycles (4+15), the data would be output in the sequence (0, 2, 4, 6, 1, 3, 5, 7). If 25 cycles (4+21), the sequence would be (4, 6, 0, 2, 5, 7, 1, 3). In either case, bits 0, 1, 4, and 5 would be inverted and the other bits not.Note that if the AtariVox EEPROM is being used during a paddle read, it may be necessary to adjust the code to set up SWCHA/SWACTL to avoid disrupting it.Note that the code to read the pots starts by reading the data from the two pots intermixed, and then fixes them.
6507 code: lda #$00 sta SWCHA lda #$C0 sta SWACTL ; Do whatever you like here, so long as it takes at least 32us. ldx #$00 stx SWACTL ; Float the pins SLEEP 14 lda #$C0 sta SWACTL stx SWACTL SLEEP 11 sta SWACTL stx SWACTL SLEEP 5 lda SWCHA ; Bit 0 lsr lsr nop nop 0 eor SWCHA ; Bit 2 lsr lsr lsr sta pot1 lda SWCHA ; Bit 4 lsr lsr lsr pot1 eor SWCHA ; Bit 6 eor pot1 and #$F0 eor.w pot1 ldx SWCHA ; Bit 1 sta pot1 txa lsr lsr eor SWCHA ; Bit 3 lsr lsr lsr sta pot2 lda SWCHA ; Bit 5 lsr lsr lsr pot2 eor SWCHA ; Bit 7 eor pot2 and #$F0 eor.w pot2 ldx SWCHA stx potbuttons sta pot2 asl eor pot1 and #$AA eor pot1 tax lda pot1 lsr eor pot2 and #$55 eor pot2 sta pot1 stx pot2
A somewhat nasty bit of code, perhaps, but it should take less than 3 scan lines to execute. Much nicer than having to kill 8 cycles/loop within the kernel.If all four pots must be read, the above code would be used to read the first two and similar code would read the second, but some of the shifts would be reversed and the initial trigger sequence would be 6 cycles longer (causing the micro to resequence the bits).Does all that seem practical?
4 Comments
Recommended Comments