Check if the AppleII Joystick is working using AppleSoft Basic

Apple II Joystick, aka Paddles

  • Although we call them Joysticks, back in the 70’s they were called paddles.

Accessing the Analog Joystick direction

  • The paddle data can be accessed from Applesoft BASIC using the PDL function.
  • Pass the paddle number to the function and it will return the value from the paddle.
  • The paddle number matches the direction of switch:
    • X = 0
    • Y = 1

Accessing the Button status

  • There are two buttons.
  • The status of the joypad buttons can be read using a PEEK and their memory locations:

    • **PEEK(49249) — Read Paddle Button #0
    • **PEEK(49250) — Read Paddle Button #1

    • **PEEK(49251) — Read Paddle Button #2
    • **PEEK(49248) — Read Paddle Button #3

Simple Version

10 PRINT PDL(0), PDL(1)
20 GOTO 10

Advanced Version #1

10 X=PDL(0): FOR I=1 TO 10: NEXT: Y=PDL(1)
20 PRINT X " " Y " " PEEK(49249) , PEEK (49250)
30 GOTO 10

Advanced Version #2

10 A =  PDL (0)
20 B =  PDL (1)
30 C =  PEEK (49249)
40 D =  PEEK (49250)
50  PRINT "X:";A;" Y:";B;
60  IF C > 127 THEN  PRINT " 0";
70  IF D > 127 THEN  PRINT " 1";
80  PRINT
90  GOTO 10
categories: appleii | joystick | AppleSoftBASIC | retrocomputing |