Programming for Alternate Controllers

Basic and Machine Language

Moderator: Moderators

User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Programming for Alternate Controllers

Post by Jeff-20 »

I've been working on a project in my head, I thought it would be fun to share it. Maybe it could be a shared project. I was thinking about all of the VIC-compatible controllers. I enjoy paddle and joystick games. What about other controllers? I would like to develop routines to read their input for new game applications.

- The Atari Keypad (identical to the Kid's Controller and the Video Touch Pad) could be fun to use.

- The Atari Driving Controller is similar to the paddles, but a game could make use of the 360 degree rotation.

- The XE Lightgun, in theory, should work on a VIC too.

-The 7800 joystick or pad would add an extra button.

-The Sega Master system 2 button pad or Genesis/Mega Drive 3 button and 6 button pad would make excellent games!

I think the Astrocade, TI-99, Tomy Tutor and other controller may actually damage the VIC because of the power pin. Anyone interested in exploring what POKEs and PEEKs work with these controllers? If so, I'd have fun making games to use 'em! :)
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Before PEEKing around, make sure the pinouts on these devices are safe. As far as I know, only the general six wires are common on all systems: up, down, left, right, fire, ground. The other three pins for POTX, POTY and 5V as you mention may have different use on the Ataris and most definitely on the Segas. At least I kind of remember the Atari version of the KoalaPad won't work on Commodore computers, and I think the Atari 2600 trackballs are neither compatible with Atari computers nor Commodore of course.
Anders Carlsson

Image Image Image Image Image
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Post by ral-clan »

Oh, Koala graphic pads. Amazing controllers, so sadly underused. Only need to program regular X,Y paddle controller code to implement one. I urge every Denial member to pick one up on eBay if you have the chance.

Okay, just slightly off topic....so, back to the topic at hand...

What about the special Atari 2600 Omega Race controller that came with the (CBS?) game? It was a hollow tube with a button on top that fit over the shaft of standard Atari 2600 joysticks and gave you and extra fire button (there was also an extra wire and a sort of dongle that went between your joystick's connector and the Atari's joystick socket.
Last edited by ral-clan on Fri Jan 23, 2009 6:46 am, edited 1 time in total.
User avatar
Schema
factor
Posts: 1430
Joined: Tue Mar 23, 2004 7:07 am
Website: http://www.jammingsignal.com
Location: Toronto, Ontario

Post by Schema »

It's not really a controller per se, but Protovision's 4-Player Interface for the C64 should work on the VIC as well:

http://www.protovision-online.de/catalo ... anguage=en

It would give you three players on the VIC, if a game was (re)written to support it.
User avatar
Pedro Lambrini
Vic 20 Scientist
Posts: 1132
Joined: Mon Dec 01, 2008 11:36 am

Post by Pedro Lambrini »

^
It could also mean 'proper' 2 player games. That is 2 joysticks at once. Could be interesting. :)
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

If I make a game, I would want to use a controller most VIC owners would be likely to have. So, I started with the Genesis and 7800. Tonight I had time to do early tests reading locations 37151 and 37152. I have no experience with inside of the Atari 2600. I hope someone who does could explain this strange observation:

The Atari 7800's two button controller reads just as the 2600 joystick; however, either button returns the same value in 37151! This is odd because using a 7800 controller on the 2600 will only acknowledge one button; the other is ignored. So there is a difference.

The Sega Genesis controller reads all four directions and the B button. However, start, A and C were not read. Perhaps they are similar to the 7800's additional fire button.
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

A wild guess: Several buttons could be connected to the same pin, just multiplexed and/or in pulses. The VIC VIA probably reads a pulse as a steady signal while the 2600 would not.

I'm still not sure it is a good idea to connect a Genesis gamepad and push just about any button. Perhaps as long as there is something in the way to draw power, one won't cause short circuit with the 5V line. But you're a brave man!

We could design an input device of our own, something that multiplexes on the general four lines up, left, right and down. It would allow 15 different moves, plus a fire button on top of that. If fire also was considered a direction, we could build a "keyboard" of 31 keys that can be read individually and would work on anything from the 2600 to Amiga.
Anders Carlsson

Image Image Image Image Image
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

Are you talking about actually building a new input device?

I checked the PIN read out first. The 7800 and GEN should be safe. I will defer to the hardware members of our forum on that assumption. I've noticed no problems yet.

Here's a 7800 PIN layout:
1 Up
2 Down
3 Left
4 Right
5 Button (R)ight (-)
6 Both buttons (+)
7 Not connected
8 Ground(-)
9 Button (L)eft (-)


I must be getting a read from PIN 6. So, PIN 5 and 9 should be submitting some kind of info to the VIC. Honestly, I was more interested in the GENESIS/MD control pad. I would be that more VIC owner have one more than any other VIC compatible controller.

Here's the GEN/MD pinout:

(Pin Name (Select=GND) Name (Select=+5V))
1 Up Up
2 Down Down
3 Gnd / Left
4 Gnd / Right
5 +5VDC +5VDC
6 Button A Button B
7 Select Select
8 Ground Ground
9 Start Button C

Please be patient with my lack of knowledge here. I think this means when Button A is pressed, both pin 6 and pin 7 are activated. If I am right, the secret is understanding how pin 7 is read by the VIC.

I don't know enough to understand this. Do you see any problem?
High Scores, Links, and Jeff's Basic Games page.
Richard James
Vic 20 Devotee
Posts: 269
Joined: Mon Feb 04, 2008 6:06 am

Post by Richard James »

NES controllers output in serial but does not use DB9.

Sega Genesis uses a 74HC157 Quad 2:1 multiplexer to map more buttons onto the DB9 connector. In order to read all the buttons you need to be able to both read and write to the DB9 port. Just change Select on 7 from high to low gives you two sets of input.
Change is inevitable except from a vending machine.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Jeff-20 wrote:Are you talking about actually building a new input device?
Yes, why not? An open design that some people also offer to build and sell ready-made units of. I have no idea what it would look like and what you would use it for though. Of course you can involve POTX and POTY too.
Anders Carlsson

Image Image Image Image Image
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Post by ral-clan »

carlsson wrote:
Jeff-20 wrote:Are you talking about actually building a new input device?
Yes, why not? An open design that some people also offer to build and sell ready-made units of. I have no idea what it would look like and what you would use it for though. Of course you can involve POTX and POTY too.
Carlsson's got a bit of a point. If anyone/anyhwere in the year 2009 wanted to set a new official controller "standard" for the VIC-20, it would be the people here. I assume it would get some sort of "respect" by the VIC-20 collecting community if endorsed and available through Denial.
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

if you made the 'joystick' big enough, and added say the vibration feature of many newer game devices, you could sell the device to sex shops ')
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

Richard James wrote:Sega Genesis uses a 74HC157 Quad 2:1 multiplexer to map more buttons onto the DB9 connector. In order to read all the buttons you need to be able to both read and write to the DB9 port. Just change Select on 7 from high to low gives you two sets of input.
I'm slow. Exactly how would I change 7 on the VIC from a programming point-of-view?
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

I get a feeling this topic has been up to discussion before...

Code: Select all

Pin  VIC    7800   Gen GND  Gen +5V
------------------------------------
 1   Up     Up     Up       Up
 2   Down   Down   Down     Down
 3   Left   Left   Left     ??
 4   Right  Right  Right    ??
 5   POT Y  But R  +5V      +5V
 6   Fire   Both   But A    But B
 7   +5V    N/C    Select   Select
 8   GND    GND    GND      GND
 9   POT X  But L  Start    But C
I don't know if you can read the 7800's both buttons with PEEK(36872) and 36873. Those are analog inputs, while a button press should be digital.

Are pins 7 and 8 normally connected on the Genesis pad, but once you press either of buttons B or C it wires pins 5 and 7? I remember I asked the question if it is safe to connect +5V from the VIC directly to ground, but certainly inside the pad there is some electronics in the way. Since you could read button B, I suppose you manage to wire pins 5 (POT Y) and 7 (+5V).

I am afraid that even if none of this will hurt your VIC, it may be difficult to get any use of those controllers anyway.
Anders Carlsson

Image Image Image Image Image
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

carlsson wrote:I get a feeling this topic has been up to discussion before...
I have the worse memory ever. We discussed this in 2005. Several Denialers use a Genesis pad with their VICs. However, we never came up with answers. Every now and then I consider projects that would benefit from the extra buttons, but then I realize the keyboard is good enough for extra functions and drop the topic. I guess I am a purist. It it couldn't have been played in 1984, I don't want to play it. :p
High Scores, Links, and Jeff's Basic Games page.
Post Reply