•  Back 
  •  Hardware 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  %About 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The ATARI Compendium
Author      : Scott Sanders / JAY Software
Version     : 1.25 (20/6/2003)
Subject     : Documentation
Nodes       : 1117
Index Size  : 32614
HCP-Version : 6
Compiled on : Atari
@charset    : UTF-8
@lang       : en
@default    : 
@help       : %About
@options    : +g -i -t4 +y +z
@width      : 100
View Ref-File<invalid destination page 1581>

                              Game Controllers


The Atari 1040STe and Falcon030 support new enhanced joystick controls as
well as older style CX-40 controls. For the usage and polling of the older
style controls, refer to the following section which discusses the IKBD
controller. This section will focus specifically on the newer style of
controllers.

Joysticks

Enhanced joysticks are read by a two-step process. The WORD at address
0xFF9202 is written to using a mask which determines which values may
subsequently be read from the WORDs at address 0xFF9200 and 0xFF9202.
Valid mask values and the keys that may be read follow:

Read Controller 0 at 0x00FF9200

Write Mask    Bit 0 Clear    Bit 1 Clear

  0xFFFE         Pause          Fire 0

  0xFFFD           -            Fire 1

  0xFFFB           -            Fire 2

  0xFFF7           -            Option

Read Controller 1 at 0x00FF9200

Write Mask    Bit 2 Clear    Bit 3 Clear

  0xFFEF         Pause          Fire 0

  0xFFDF           -            Fire 1

  0xFFBF           -            Fire 2

  0xFF7F           -            Option

Read Controller 0 at 0x00FF9202

Write Mask  Bit 8 Clear   Bit 9 Clear   Bit 10 Clear   Bit 11 Clear

  0xFFFE        Up            Down          Left          Right

  0xFFFD       Key *          Key 7         Key 4         Key 1

  0xFFFB       Key 0          Key 8         Key 5         Key 2

  0xFFF7       Key #          Key 9         Key 6         Key 3

Read Controller 1 at 0x00FF9202

Write Mask  Bit 8 Clear   Bit 9 Clear   Bit 10 Clear   Bit 11 Clear

  0xFFEF        Up            Down          Left          Right

  0xFFDF       Key *          Key 7         Key 4         Key 1

  0xFFBF       Key 0          Key 8         Key 5         Key 2

  0xFF7F       Key #          Key 9         Key 6         Key 3

To read the joystick, write a mask value corresponding to the row of
keys/positions you wish to interrogate to 0x00FF9202. Next, read back
a WORD from either 0x00FF9200 or 0x00FF9202. As indicated in the table,
cleared bits mean that a key is being pressed or a joystick is moved
in that direction.

Paddles

Two paddles may be plugged into each joystick port. Each paddle returns
an 8-bit value indicating its position ( 0 = full counter-clockwise, 255 =
full clockwise) at the addresses shown below. Unlike joysticks, paddle
positions are returned automatically with no need to write to an address
prior to a read. Paddle fire buttons, however, are mapped and read in the
same manner as the joysticks. See the discussion of joysticks above for an
explanation.

Byte Address         Paddle

  0x00FF9211       X Paddle 0

  0x00FF9213       Y Paddle 0

  0x00FF9215       X Paddle 1

  0x00FF9217       Y Paddle 1

Light Gun/Pen

Joystick port 0 supports a light gun or pen. The position that the gun is
pointing to is returned in the WORD registers at 0x00FF9220 (X position)
and 0x00FF9222 (Y position). Only the lower 10 bits are significant giving
a range of values from 0 - 1023.