Jump to content


How do I read input from controllers?

1 reply to this topic

#1 Pantomchap OFFLINE  


    Space Invader

  • 18 posts

Posted Fri May 19, 2017 12:30 AM

So I have a reference on the 2600's specs and I found these here. Are they for reading input from the controller? If so, how do I read it? If not, what do I use to read the input?



 38      INPT0   1.......  read pot port

 39      INPT1   1.......  read pot port
 3A      INPT2   1.......  read pot port
 3B      INPT3   1.......  read pot port
 3C      INPT4   1.......  read input
 3D      INPT5   1.......  read input


Thank you for reading this far.

#2 alex_79 OFFLINE  



  • 1,124 posts
  • Location:Italy

Posted Fri May 19, 2017 1:34 AM

If you haven't already, get the Stella Programmer's Guide" here. That's the official programming guide for the 2600.

The answer to your question depends on what controller you're trying to read (joystick, paddle, driving, trackball, keypad...).

For joystick, which is the most common case, the firebuttons are read from TIA registers INPT4 (left port) and INPT5 (right port).
Only bit 7 is used (bit7="0"-> button pressed; bit7="1"-> button released).

Joystick directions are read from RIOT register SWCHA. Bits 7 to 4 are for left port, bits 3 to 0 for the right one. See section 5.3 in the Stella guide.

Check the Collect tutorial to see example code. Each step include a fully commented source.

Edited by alex_79, Fri May 19, 2017 1:35 AM.

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users