Jump to content
IGNORED

Need explanation on how joystick ports work


Tickled_Pink

Recommended Posts

I'm trying to come up with a piece of hardware that connects to the joystick ports. However, I'm a little puzzled as to how they work.

 

When I tried the ports on my XL, I discovered that when set to input mode, the direction pins generate a voltage while they don't when set to output. :?

 

How exactly do the joystick ports work? How does the machine know what direction the joystick is moving in?

Link to comment
Share on other sites

Imagine if the I/O chip didn't output anything when it was in input mode, and the joystick had to send +5vdc on a line to pull it high when the player pushed it in a certain direction. That would work, but what about an adapter like the one that let's Colecovision users use Atari joysticks? It also lets you plug in a Coleco controller. What if you pushed "up" on both controllers at the same time? Both would be pushing +5vdc on the same line and the I/O chip would die in a puff of blue smoke.

 

Atari-style joystick ports are "open collector". In input mode, each line is pulled high (+5vdc) by a pull-up resistor inside the I/O chip, and the joystick connects a line to ground ("sinking" the current) when pushed in a direction. It seems backwards, but it's great because it doesn't matter if 1, 2, or even 20 devices are pulling the line to ground -- the I/O chip is only going to output so much current, and all of it gets grounded one way or another.

 

The interrupt line on the CPU works the same way, BTW. 8 devices can pull the line low at the same time. All the CPU knows is that the line is low. It then has to ask every device that could have caused an interrupt if it did.

 

Hope that helped!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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