VOGONS


First post, by awgamer

User metadata
Rank Oldbie
Rank
Oldbie

Game port has eight bits and one reference says polling a port can be done in a microsecond: http://www.faqs.org/docs/Linux-mini/IO-Port-Programming.html which would make the theoretical max 976KB/s, but what's actual usage given memory access, like on the original PC/XT?

Last edited by awgamer on 2014-08-19, 05:13. Edited 1 time in total.

Reply 2 of 14, by awgamer

User metadata
Rank Oldbie
Rank
Oldbie

Buttons are digital, axis are analog but simple to treat like digital. zero = zero, not zero = 1. Gravis gamepads and Atari to PC adapters are digital, they give set ohm values for the four directions.

Reply 3 of 14, by Jepael

User metadata
Rank Oldbie
Rank
Oldbie
awgamer wrote:

Game port has eight bits and one reference says polling a port can be done in a microsecond: http://www.faqs.org/docs/Linux-mini/IO-Port-Programming.html which would make the theoretical max 976KB/s, but what's actual usage given memory access, like on the original PC/XT?

Original XT clocked in at about 4.77Mhz and reading a port will take at least 8 clock cycles (possible IO wait states add more and you have to fetch executable instructions and maybe store the data somewhere and the memory needs refresh cycles as well) so it will take more than 1.6us to access the port or you can do up to 596K theoretical reads per second from the port.

What you are going to use it for (i.e. why do you ask) ?
I have used the joystick port for reading different digital and analog sensors in addition to just joysticks, so I may be able to provide a better answer with more specific question.

And no the gameport is not "analog" per se. Buttons are just digital on/off bits and can be used as digital inputs directly. Also the "analog" measurement bits are just digital bits. What user code must do is measure from the bits how long it takes for a fixed capacitor to charge through the variable resistance. You start the measurement by writing anything to port 201h and then you read the "analog" bits until they flip to show if the capacitor is still charging or has charged enough.

Reply 4 of 14, by awgamer

User metadata
Rank Oldbie
Rank
Oldbie

I'm interested in how many joysticks could be connected using a protocol like the sidewinder, target would be 22 controllers so that it'd be possible to field two teams of sports games. Going by this: http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/specs.txt it should be possible with the sidewinder protocol as is, takes 150 or 250 us to transmit a 15 bit gamepad packet, so 3300 us for 22 controllers, allowing for a possible 300 hz or 150 hz update rate. At 200 hz like the max ps/2 rate, could connect 33 controllers at 150us, or to keep 33 controllers at the 250 us t-rate, only update at 100hz. Would just need a breakout box with 22/33 connecters that hooks up to the game port. If I understand correctly, the protocol is only using four bits to transfer so could double max # of controllers if using all eight. Reminds me of the big deal made out of the Atari 800 able to do four controllers, when the PC was technically able to do this from the get go. Composite out to a 1980s big screen TV and you'd have 320x200 15 colors?, 22 controllers for group play. Worthwhile sound still lacking and anemic CPU speed, but if a game was simplified, might have been able to pull off such a group game back in the day. Just need to get trixter of 8088 demo fame to whip something up:) That reminds me, what IBM should have done with CGA is have integrated composite video onto some pins like game ports did for midi, and have the CGA monitors able to do composite when switched to composite mode, and could still have a separate connector for output to a TV. That would have negated the four color misery of early PC games. I could even picture pitching it to the big wigs as a business feature for presentations, presenter typing at the pc while it simultaneously outputs his screen to tv out connected to a big screen.

Reply 5 of 14, by awgamer

User metadata
Rank Oldbie
Rank
Oldbie

One thing that url doesn't describe is identifying which controller. Says can send serially on bit 0 or with three bits in "triple mode." The packet bits are all controller state info along with a parity bit, and that it only needs to be connected to half the joystick port. I guess the fourth game port bit would serially transmit the controller ID. Triple mode sends three 5 bit streams, so if really quad with the forth 5 bits being ID, that's 32 IDs, which works out perfectly. Meh, my skip reading is failing me, it works by appending the ID to the end of a stream. I wonder why they went with odd three bits instead of using the available four, they're limited to 100/50 Hz update rate for 32 controllers.

Reply 6 of 14, by Jepael

User metadata
Rank Oldbie
Rank
Oldbie

Interesting idea.

Don't over-specify things, the CPU will be using 100% of its time when it is polling the data stream from joystick port so don't make the stream too long or don't poll too often. Logitech Wingman Extreme Digital had a way to sense the reading of analog pins so it will only send out the data packet when PC requests it by triggering analog read, so no time is wasted waiting for the data burst.

The display refresh rate is 60 Hz for CGA and 50 Hz for MDA/Hercules for example (normal VGA modes with 200/400 lines are up to 70Hz), so the PC cannot utilize larger refresh rate.
Of course it helps if the controllers are outputting their data continuously so the PC can just start listening and it will figure out where stream starts so it does not have to listen to more than 1 full transmission.

Also for this you can't utilize more than 4 digital button bit inputs of the joystick port, the 4 analog stick inputs cannot be read so fast. If you trigger an analog read, and you have 0 ohms short circuit between analog input and VCC, it typically takes about 22us to charge the capacitor (assuming "standard" timing values set by IBM joystick adapter card), and up to more than 33us when component tolerances are accounted for. Basically, when you start analog read, you know after about 40us if there was a shortcut or open circuit.

Now, since this is not going to be compatible with normal joystick games anyway, why limit yourself to the joystick port? Why not use the parallel port, serial port or keyboard port to receive data?

If you use parallel port, you could easily read hardware resembling NES controllers (at least five if not nine at the same time) without any glue logic and could multiplex many more with just some off-the-shelf 74xx series glue logic chips.

If you use a microcontroller as an interface between PC and joysticks, you could use the serial port (only limitation being bit rate of 9600 BPS I guess) or keyboard port (to simulate pushing/releasing of keyboard buttons), although you could also use the printer port in this case.

Reply 7 of 14, by awgamer

User metadata
Rank Oldbie
Rank
Oldbie

Responding to your points in turn..

Trying to work out the maximum isn't over specifying and the target of 22 controllers is lower than max.

I'm not sure what you're thinking of, game port isn't tied to video refresh rate.

40us is well under the sampling rate the 150/250us rates used by the sidewinder that I've been basing my calculations on.

Why the joystick port, using the port as intended, more elegant , it's capable for the task, other ports would be occupied, parallel port would be busy with a printer and covox speech thing, com ports, mouse and modem. Thrust master is the only one I know of who tried a non game port solution with a keyboard/game port combo, a kludge. Everyone eventually hit on doing digital transfers off the game port which works.

9600bps.. 22 controllers, 15 bits for state, 5 bits for id, at 50/100/200hz is 22000/44000/88000bps, which isn't even the maximum.

Now, back to the sidewinder gamepad, found more info about it, original has a game port connector built into the controller for daisy chaining four controllers, this means the id bits they append to the state data is only two bits or they're only using two bits. If it's just them stopping at id'ing four in their software, then you could keep chaining using your own code to parse. If they only designed for four controllers in hardware, there is a solution that would allow to use more than four sidewinder gamepads as is, create the ids in the breakout box. If one made use of the chaining, would only need six ports, id each port and layer and parse that data on top of what comes from the gamepads. I'd make use of the unused fourth bit for that purpose, or simpler, use the five unused bits, would statically set values, no need to make a stream.

Oh yeah, without doing anything, you could use 24 sidewinder gamepads by having six game ports, done with a sound card + a multi-io card /w a game port + dual port game card. Oops, make that two dual port game cards.

Last edited by awgamer on 2014-08-20, 14:09. Edited 3 times in total.

Reply 10 of 14, by Jepael

User metadata
Rank Oldbie
Rank
Oldbie

No they just split the single 4-button and 4-pot interface into two ports so you can use two regular 2-button and 2-pot joysticks without a separate Y cable.
The whole 4-bit/4-pot interface may or may not be available on the "main" joystick port for those joysticks that have more buttons/axes/hat/throttle/whatever.

I haven't seen an adapter that could be set to other than 201h, if you have any info please post a link/picture. What games would support these?

Reply 11 of 14, by awgamer

User metadata
Rank Oldbie
Rank
Oldbie

No, they are full game ports at separate addresses as far as I know. Settable game port address was common, for example:
http://www.sccs.swarthmore.edu/users/07/garth … c/46/readme.txt
http://www.cs.fsu.edu/~baker/devices/lxr/http … ameport/ns558.c
http://contents.driverguide.com/content.php?i … %2FCHMANUAL.TXT

Second link I referenced goes over setting game port addresses.
http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/specs.txt

Edit: Yes, full game ports on separate addresses.
http://www.flyfoxy.com/ThrustmasterFAQ.html

What games? Likely some flight and other type sims, given thrustmaster standardization. Game port was allocated 200-20f from the get go, so ability was always there, which gets back to it's actually possible to do a 22 player game even on the original PC, game just needed to be written to do it.

Reply 12 of 14, by awgamer

User metadata
Rank Oldbie
Rank
Oldbie

After mulling it over realize max speed should be .5MB/s using the button bits(axis bits are tied to the 558 which has a minimum of 24.2us to set) and the cycle charts( http://zsmith.co/intel_i.html#in ) tells how many MHz needed to do it: 8088 @ 12 MHz, 8086 @ 8 MHz, 286 @ 5 MHz, 386 @ 27 MHz in v86 mode, 13 MHz real mode, 7 MHz in protected mode, 486 @ 27 MHz in v86 mode, 14 MHz in real mode, 8 MHz in protected mode. AT was 6 MHz, slowest 386 & 486 were 16 MHz and from what I found, clones with 8086 @ 8 MHz came out in 1983, though people could have chipped their machines earlier. Yay, useless trivia:) Even at 4.77 MHz it was the fastest port available. Maybe the keyboard could match speed? but all it does is key codes. I figure an 8-12 MHz 286 would be able run the game port at full speed and still have enough cycles/time left over to do something. Game port holds the speed crown until the EPP parallel port @ 2 MB/s is released in 1991.

Reply 13 of 14, by Jepael

User metadata
Rank Oldbie
Rank
Oldbie

I also did some digging and found out the ThrustMaster ACM card is definitely a dual port card (for quad normal joysticks), the other port sits at 201h as usual and other at 209h and they can be changed with jumpers.

PNP cards will try to resolve the address conflict themselves so that is the main reason to change the port away from 201h if there are multiple cards. As PNP cards are supported by Windows so the games do not use the port directly but through Windows drivers so the actual port does not matter any more on Windows. Still, if there is a legacy non-PNP card in the system, the PNP does not know about it and two ports could be at 201h unless manually changing is possible (through PNP or the non-PNP card).

Yeah the whole 200h-20Fh is reserved for the joystick adapter, but my guess is IBM engineers first allocated the ports before designing hardware which ended up using only 1 address.
I found out a single joystick adapter could respond to all addresses between 200h-207h or 200h-20Fh to ease the address decoding logic.

Reply 14 of 14, by awgamer

User metadata
Rank Oldbie
Rank
Oldbie

Thought was nagging me that the buttons might be tied to the 558's delay, but this link ( http://www.epanorama.net/documents/joystick/pc_joystick.html ) confirms they directly hook up to the ISA data lines, so their speed is how fast one can read the port. It is indeed 500KB/s with a fast enough CPU.