Game controllers

Joystick

Direction values


There are nine possible decimal values (representing 45 degree incrememts) read by each joystick register (using the STICK command in Atari BASIC), depending on the position of the stick:

             Decimal              Binary

               14                  1110
                |                    |
            10  | 6            1010  | 0110
              \ |/                 \ |/
          11-- 15 ---7      1011-- 1111 --0111
              / |\                 / |\
             9  | 5            1001  | 0101
                |                    |
               13                  1101
      

15 (1111) equals stick in the upright (neutral) position.

Memory address map


SHADOW REGISTER
DECIMAL (HEXADECIMAL)
HARDWARE REGISTER
DECIMAL (HEXADECIMAL)
LABEL DESCRIPTION
632 ($278) 54016 ($D300) STICK0 The value of joystick 0
633 ($279) 54017 ($D301) STICK1 The value of joystick 1
644 ($284) 53264 ($D010) STRIG0 Stick trigger 0
645 ($285) 53265 ($D011) STRIG1 Stick trigger 1

Paddles

Paddles are also called pots, short for potentiometer. PEEK 624 returns a number between zero and 228 ($E4), increasing as the knob is turned counter-clockwise. When used to move a player or cursor (i.e., PLOT PADDLE(0),0), test your screen first. Many sets will not display locations less than 48 ($30) or greater than 208 ($D0), and in many GRAPHICS modes you will get an ERROR 141 -- cursor out of range. Paddles are paired in the controller jacks, so paddle 0 and paddle 1 both use jack one.

 Memory address map

SHADOW REGISTER
DECIMAL (HEXADECIMAL)
HARDWARE REGISTER
DECIMAL (HEXADECIMAL)
LABEL DESCRIPTION
624 ($270) 53760 ($D200) PADDL0 The value of paddle 0
625 ($271) 53761 ($D201) PADDL1 The value of paddle 1
626 ($272) 53762 ($D202) PADDL2 The value of paddle 2
627 ($273) 53763 ($D203) PADDL3 The value of paddle 3
628 ($274) 53764 ($D204) PADDL4 The value of paddle 4
629 ($275) 53765 ($D205) PADDL5 The value of paddle 5
630 ($276) 53766 ($D206) PADDL6 The value of paddle 6
631 ($277) 53767 ($D207) PADDL7 The value of paddle 7
636 ($27C) 54016 ($D300) PTRIG0 Paddle trigger 0.

Used to determine if the trigger or button on paddle 0 is pressed (zero is returned) or not (one is returned). Since these are the same lines as the joystick left/right switches, you can use PTRIG for horizontal movement. PTRIG(1) - PTRIG(0) returns -1 (left), 0 (center), + 1 (right).
637 ($27D) 54016 ($D300) PTRIG1 Paddle trigger 1
638 ($27E) 54016 ($D300) PTRIG2 Paddle trigger 2
639 ($27F) 54016 ($D300) PTRIG3 Paddle trigger 3
640 ($280) 54017 ($D301) PTRIG4 Paddle trigger 4
641 ($281) 54017 ($D301) PTRIG5 Paddle trigger 5
642 ($282) 54017 ($D301) PTRIG6 Paddle trigger 6
643 ($283) 54017 ($D301) PTRIG7 Paddle trigger 7

Trakball

Thanks to George for information below on trakball functionality!

Trak-Ball has a switch for mode selection with two positions named "JS" and "TB"

References


Book Mapping The Atari - Revised Edition (article Memory Map)