Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 00:28 17 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Atari Joystick test program

Author Message
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 386
Posted: 01:33pm 04 Jun 2021
Copy link to clipboard 
Print this post

Those of us who own one of Piotr's CMM2 Deluxe Editions, or who have or are planning to get a joystick interface for their CMM2 may be interested in this little joystick test program.

It isn't much: just lets you test the joystick 4-direction switches and the 'fire' button. For some of the new interfaces, you may need to change the digital I/O pins using the const values at the top of the program.

Enjoy!
-Bill

' Atari Joystick Test
' Only works on Deluxe CMM2 or with added joystick port
' Rev 1.0.0 William M Leue 6/3/2021

option default integer

const UP = 35
const DOWN = 36
const LEFT = 38
const RIGHT = 40
const FIRE = 32
const R = 10

cls
setpin UP, DIN, PULLUP
setpin DOWN, DIN, PULLUP
setpin LEFT, DIN, PULLUP
setpin RIGHT, DIN, PULLUP
setpin FIRE, DIN, PULLUP

dim x = MM.HRES\2
dim y = MM.VRES\2
dim ox = 0
dim oy = 0
dim c = RGB(BLUE)
dim fc = RGB(RED)
circle x, y, R,,, c, c
ox = x : oy = y

do
 if pin(UP) = 0 then
   if y > R then y = y-1
 end if
 if pin(DOWN) = 0 then
   if y < MM.VRES-R-3 then y = y+1
 end if
 if pin(LEFT) = 0 then
   if x > R then x = x-1
 end if
 if pin(RIGHT) = 0 then
   if x < MM.HRES-R-3 then x = x+1
 end if
 if pin(FIRE) = 0 then
   circle x, y, R,,, fc, fc
   pause 50
   circle x, y, R,,, c, c
 end if
 if x <> ox or y <> oy then
   circle ox, oy, R,,, RGB(BLACK), RGB(BLACK)
   circle x, y, R,,, c, c
   ox = x : oy = y
 end if
 pause 1
loop
end
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024