[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

THE GAME PORTS

The Commodore 64 has two 9-pin Game Ports which allow the use of joysticks, paddies, or a light pen. Each port will accept either one joy- stick or one paddle pair. A light pen can be plugged into Port A (only) for special graphic control, etc. This section gives you examples of how to use the joysticks and paddies from both BASIC and machine language.

The digital joystick is connected to CIA #1 (MOS 6526 Complex Interface Adapter). This input/output device also handles the paddle fire buttons and keyboard scanning. The 6526 CIA chip has 16 registers which are in memory locations 56320 through 56335 inclusive ($DC00 to $DC0F). Port A data appears at location 56320 (DC00) and Port B data is found at location 56321 ($DC01).

A digital joystick has five distinct switches, four of the switches are used for direction and one of the switches is used for the fire button. The joystick switches are arranged as shown:

                                   (Top)
               FIRE
            (Switch 4)
                                    UP
                                (Switch 0)
                                     |
                                     |
                                     |
                        LEFT         |         RIGHT
                              -------+-------
                     (Switch 2)      |       (Switch 3)
                                     |
                                     |
                                     |
                                   DOWN
                                (Switch 1)

These switches correspond to the lower 5 bits of the data in location 56320 or 56321. Normally the bit is set to a one if a direction is NOT chosen or the fire button is NOT pressed. When the fire button is


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated May 20, 1998.