;##########################
;# Example 1.3 - Joystick #
;##########################
;By Steven Matty

;This program will print up joystick movements for specified joystick
;ports (1=Joystick 1, 2=Mouse Port, 3=4-Player(Port1) 4=4-Player(Port2)
;To quit, press the fire button on all specified joysticks

NPrint "Enter DECIMAL value For joysticks To test (15=All)"
bitpattern.b=Edit(15,4)
Repeat
  For n=1 To 4
    If bitpattern BitTst (n-1)
      If JFire(n) Then NPrint "Player ",n," pressed fire!"
      If JHoriz(n)=-1 Then NPrint "Player ",n," pressed left!"
      If JHoriz(n)=1 Then NPrint "Player ",n," pressed right!"
      If  JVert(n)=-1 Then NPrint "Player ",n," pressed up!"
      If JVert(n)=1 Then NPrint "Player ",n," pressed down!"
    End If
  Next n
Until AllFire(bitpattern)=bitpattern  ; Until JFire(1) and JFire(2) = PRESSED!
End
