Paddle

From C64-Wiki
(Redirected from Paddles)
Jump to navigationJump to search

A paddle is a simple control device for use in games: It has a single potentiometer type knob (similar to the volume knob found on e.g. a stereo) which the player uses to move or control something in the game along a seemingly continuous range. The paddle is an alternative to the more common (then as well as now) joystick, and was often used in conjunction with early "TV game" systems, or "pongs" as they are commonly called today. The C-64 and especially the VIC-20 were competing against such systems, and thus included compatibility with their control devices so "pong"-style games could be easily implemented on Commodore's offerings.

Each joystick port has two analog inputs, so in some cases paddles come in pairs, each with their own lead, but both leads going into a single DB9f connector that mathces the joystick port connector.

How paddles work[edit | edit source]

Diagram of a dual paddle

The SID sound chip in the C-64 has two analog inputs, which are connected to the joystick ports through analog multiplexing (allowing a total of four paddles to connect cia the two inputs at the SID). The analog parts (excluding fire buttons etc) of a (dual) paddle is shown in the diagram at right: The potentiometers P1 and P2 are coupled as variable resistors, which supplies a charge current to the capacitors C1 and C2. The SID times this charging process, and discharges the capacitors for the next measurement, and uses the results to report the "position" of the paddle knob.

Note that the SID's analog inputs do not act like ordinary voltage-to-binary-style A/D converters, and thus cannot be used in this way. Trying to do so yields a highly unlinear characteristic that is hardly usable for much of what one would use a "regular" A/D converter. Consider the SID's analog inputs ohmmeters rather than voltmeters.

The Atari paddle controller uses a 1 megohm potentiometer. One controller measures 791 kilohms with the knob turned fully counterclockwise, and 125 ohms (0.125 kΩ) with the knob turned fully clockwise.

Programming for paddles[edit | edit source]

In theory, reading the "position" of paddles is as easy as reading byte values from the SID registers at 54297-54298, but to allow for a total of four paddle knobs/potentiometers, the C-64 hardware uses a multiplexer to "switch" between the two control ports. And this complicates matters a bit.

The two most significant bit lines in port A of CIA-1 are used to "tell" the multiplexer which of the joystick ports to connect with. At the same time, these lines are involved in the scanning of the keyboard matrix, and so gets manipulated constantly as the computer scans for keypresses. So reliably reading the paddles implies temporarily disabling the keyboard scan as the reading takes place.

The SID measures the two analog inputs once per 512 machine cycles, or about 1950 times a second, independent of (and thus asynchronous with) the timing of the program the CPU is running, i.e. when the program commands the multiplexer to switch to the other port. So the programmer has to "assume" that the keyboard scan and/or other activities have recently caused the multiplexer to switch ports, set up the multiplexer and disable anything that may interfere with it, then wait for 512 machine cycles to allow the SID to do a full reading, before finally reading the analog input register.

Register of paddle in the C64[edit | edit source]

Decimal value Hex value $ Specification Status
56320 $DC00 Control-Port 1 selected bit7=0 and bit6=1
56320 $DC00 Control-Port 2 selected bit7=1 and bit6=0
54297 $D419 Paddle X value 0..255
54298 $D41A Paddle Y value 0..255
56321 $DC01 Paddle A, X-Firebutton Bit2 (0=Firebutton pushed ; 1=Firebutton not pushed)
56321 $DC01 Paddle A, Y-Firebutton Bit3 (0=Firebutton pushed ; 1=Firebutton not pushed)
56320 $DC00 Paddle B, X-Firebutton Bit2 (0=Firebutton pushed ; 1=Firebutton not pushed)
56320 $DC00 Paddle B, Y-Firebutton Bit3 (0=Firebutton pushed ; 1=Firebutton not pushed)

paddle A = paddle in Port 1, paddle B = paddle in port 2

Example in BASIC[edit | edit source]

1 REM This program views the X/Y-values of the paddles. (Control-Port1)
10 POKE 56322, 224 :REM Keyboard deactivated
20 PRINT "Paddle port1 X-value =" ; PEEK(54297) :REM read value X
30 PRINT "Paddle port1 Y-value =" ; PEEK(54298) :REM read value Y
40 POKE 56322, 255 :REM Keyboard activated

Starting with the Commodore 128 (BASIC v7), the multiplexing aspect no longer functioned- bytes 54297 and 54298 would always return the value of port 1, regardless of bits 6 and 7 of byte 56320. This only occurred in C128 mode- C64 mode behaved normally. However, the C128 introduced the POT command, which allowed for retrieving the values of the paddles without PEEK statements.

Others[edit | edit source]

Application area[edit | edit source]

  • Hardware Controller
  • Control input for games

Advantage obverse joystick[edit | edit source]

  • Accurate inputs with potentiometers
  • A control port supported two paddles, with two control ports can be played 4 players.

Disadvantages obverse joystick[edit | edit source]

  • Only a few games supported paddles
  • Movement only left and right

Games using paddle[edit | edit source]

Links[edit | edit source]

WP-W11.png Wikipedia: Paddle