Jump to content
IGNORED

Keypad + Joystick Together; Is it Possible?


Gemini

Recommended Posts

I've been reading through the Stella programming guide and one thing that puzzles me is if it's possible to read both one keypad and one joystick at the same time. (One of my game ideas hinges on the answer to this question.)

 

From what I've read, in order to make such a concept work, the keypad would have to be plugged into the left P0 port, the joystick would go into the right P1 port, and before any game loops are entered, $F0 (11110000) would be written to SWACNT so that the keypad is set for output on the SWACNT I/O port and the joystick is set for input.

 

Then, reading the keypad should be easy enough, if annoying. Write the D7 bit to SWCHA, wait seven scanlines (400 us = 6.288 scanlines, gotta round up), read the INPT0, INPT1 and INPT4 values from the TIA, then repeat for D6, D5 and D4 to get the whole keypad. To read the joystick, just read bits D3 through D0 from SWCHA and INPT5 for the fire button state.

 

So my simple question is, will this work?

Edited by Gemini
Link to comment
Share on other sites

I've been reading through the Stella programming guide and one thing that puzzles me is if it's possible to read both one keypad and one joystick at the same time. (One of my game ideas hinges on the answer to this question.)

Yes, you can use a keypad and a joystick together-- e.g., "Star Raiders" did just that.

 

From what I've read, in order to make such a concept work, the keypad would have to be plugged into the left P0 port, the joystick would go into the right P1 port, and before any game loops are entered, $F0 (11110000) would be written to SWACNT so that the keypad is set for output on the SWACNT I/O port and the joystick is set for input.

You could also plug the keypad into the right P1 port, and plug the joystick into the left P0 port. Or you can have a keypad plugged into each port (i.e., two keypads).

 

Be warned that the "Stella Programmer's Guide" doesn't give a very complete explanation of programming for the keypad controllers. The left keypad is read using INPT0, INPT1, and INPT4, as mentioned in the guide. But what it doesn't tell you is that the right keypad is read using INPT2, INPT3, and INPT5. That might be why you apparently haven't been able to get it to work with the keypad plugged into the right P1 port.

 

Then, reading the keypad should be easy enough, if annoying. Write the D7 bit to SWCHA, wait seven scanlines (400 us = 6.288 scanlines, gotta round up), read the INPT0, INPT1 and INPT4 values from the TIA, then repeat for D6, D5 and D4 to get the whole keypad. To read the joystick, just read bits D3 through D0 from SWCHA and INPT5 for the fire button state.

 

So my simple question is, will this work?

 

--- Kris Asick (Gemini)

--- http://www.pixelships.com

Michael Rideout

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...