Multiplayer link cable

Page 2/3
1 | | 3

By Danjovic

Champion (336)

Danjovic's picture

22-05-2023, 00:23

Quote:

Why not use RS232 protocol with RTS/CTS (Ready or Request to Send/Clear to Send).

That's feasible but it will require a new wiring and a mechanism to ensure that all all the terminals are ready to receive (like a "collective" CTS).

By cjs

Expert (111)

cjs's picture

22-05-2023, 01:57

sdsnatcher73 wrote:

Why not use RS232 protocol with RTS/CTS....

If you're talking about using a UART, then each station on the network has to go out and buy a serial cartridge, which kind of destroys the idea of cheap networking.

If you're talking about bit-banging async serial through the joystick ports, that eats up enormous amounts of CPU and is slow. A synchronous protocol runs as fast as the two computers can manage, and is also much more tolerant to delays and the like becuase you can pause reception even in the middle of a byte, whereas with async once a byte starts you need to be there for the whole thing (and any further bytes that arrive before the other end receives a flow control signal and decides to stop sending).

By cjs

Expert (111)

cjs's picture

22-05-2023, 03:05

Danjovic wrote:
Quote:

looking at the schematic I linked above, these can be safely wired together on a joystick port

Nope. Pin 8 is directly connected to a push pull output of the PSG. Wire them together may damage the pins during a bus contention.

Oh, right; you can't have two pins 8 tied together directly without co-ordination to make sure that there's never more than one in output mode at the same time, which is utterly impractical.

But you could simply put a resistor in series between pin 8 and the bus line, effectively making the input from the bus another pull-up. Or a diode with the anode on the pin and the cathode on the bus line, so long as you have a pull-up on the bus line. (Or perhaps you don't even need a pull-up on the bus line; the line would float, but if it's not actively pulling down pin 8, the MSX's pull-ups will keep IOB4/IOB5 high.)

Quote:

But this is a good point to consider to make a bidirectional line out of pin 8! A transistor will suit much better than a diode.

I'm not sure what you'd do with a transistor, but that seems to me as if you're now looking at using an active part, in which case why not just go with a proper 74LS06 or similar?

Quote:

No need to worry. The current on bidirectional pins (6,7) is sink by (the internal) LS06s which are rated to 40mA.

Yeah, I wasn't worried about those, just about pin 8.

By Danjovic

Champion (336)

Danjovic's picture

22-05-2023, 19:00

A transistor will act as a single gate open-collector inverter and it can be placed with ease within a sub-d shell

A diode will also do the job (simulate an open collector).

By Takamichi

Hero (641)

Takamichi's picture

24-05-2023, 17:49

F-nano 2 can be played by 4 players using this 4 turboR link cable, though I never saw one in action and there is no software instruction available.

By Jipe

Paragon (1614)

Jipe's picture

24-05-2023, 18:06

Zeeslag by MSX-CLUB WEST-FRIESLAND ( Naval Battle )
is a MSX2 game and use a link cable in port 2 with 3 wires
connect pins 6 to 6,7 to 7 and 9 to 9 of DB9

By aoineko

Paladin (1004)

aoineko's picture

25-05-2023, 14:58

Sorry to bring the conversation back, but I still don't understand the basis of how, in code, we send or receive data (even just 1 bit) with the generic port.
I see how to read the state of a joystick: Selection of port 1 or 2 via bit #6 of register #15 (with "11" on bits 0-1 or 2-3), then read the content of register #14.
As register #14 is read only, it cannot be used to send data. So concretely, how do we do that?
I guess we use only register #15 (again, I'm totally noob in electronics and I don't even know what is the "pull-up" you are always talking about ^^). I'm not asking for a course in electronics but I just need to understand the basic programming side. After that, I can handle everything else (including the network protocol).

By cjs

Expert (111)

cjs's picture

25-05-2023, 18:59

aoineko wrote:

Sorry to bring the conversation back...

No apologies are necessary; it's perfectly reasonable to ask questions when there's stuff you don't understand. And there's a lot of lowish-level electronics knowledge involved in this you probably haven't encountered, so yeah, a bunch of it is going to be mysterious at first.

Quote:

I see how to read the state of a joystick: Selection of port 1 or 2 via bit #6 of register #15 (with "11" on bits 0-1 or 2-3), then read the content of register #14.
As register #14 is read only, it cannot be used to send data. So concretely, how do we do that?

The short answer is (as you already guessed): you use register #15.

The key trick here is that there are two IO port lines hooked up to each bidirectional joystick trigger line (pins 6 and 7). One is used for input (on port #14), and one is used for output (on port #15).

You can see this by looking at the schematic, noting that when the lower '157 is set so that 1A connects to 1Y, IOA4 is reading the level on the pin 6 line, and IOB0 is simultaneously able to set the level on the pin 6 line.

Now, this is where it gets a bit hairy and the pull-ups and pull-downs come in, so while understanding the following paragraphs will be helpful, if it doesn't make sense yet maybe just leave it to come back to later, and just do your reading on port #14 and your writing on port #15.

Pin 6 has a "pull-up" on it, which is that resistor (the squiggly line leading to "+5V") attached to it. If nothing else is driving this line, it will be pulled high (to a "1" value) by this connection to the power supply.

Now the port reading this, IOA4, can't affect this: it only checks the level, never tries to change it. Whatever you read here is whatever the level of the line currently is. So per above, if nobody is actively driving this line low, it will always read high.

The port writing this, IOB0, is going through a gate (that triangle labeled "7407") with what's called an "open collector output." This is a very transistor-y name for a simple concept: when the input is high, it does nothing (not affecting the line on its output at all); when the input is low it pulls the line to ground.

So if you set IOB0 low, the line will go low; the 7407 overpowers the resistor trying to pull it high. But if you IOB0 high, the gate will have no effect on the line on its output and it will be high or low depending on what else is trying to affect it.

If nothing else is trying to affect it, the line will be high, because of the pull-up resistor. But maybe pin 8 is connected to pin 8 on another machine, and that one has set IOB0 low, so that would pull the line low (which you would read on IOA4). And of course the same works in reverse: if you have set your IOB0 low, that's going to pull the line low and everything connected to it, including the IOA4 on the other end, will sense that.

Phew, this was all a bit, and I'm not sure how much sense it made.

TLDR:

Assuming you're using a shared trigger line: set IOB0 high when you want to see what others are writing to the line, reading that on IOA4. Set IOB0 low when you want to signal others on the line.

For unidirectional lines, hook up either trigger or pin 8 to any of the input pins 1-4 on the other computer, and then do the usual read through port IOA and write through port IOB.

By aoineko

Paladin (1004)

aoineko's picture

27-05-2023, 10:44

Thank you very much for trying to explain all this to me in detail.
Reading your explanation with the diagram next to it allowed me to understand a few things, but not enough to imagine how to translate it into programming.
I'll leave this subject aside for the moment and come back to it later. Maybe starting from existing codes will help me make the link between electronics and programming.
Thank you,

By Danjovic

Champion (336)

Danjovic's picture

27-05-2023, 14:20

You can fiddle with the following circuit and experience the reaction of the logic levels at register 14 while you click on the H /L labels on the register 15 to change logic levels.

The circuit is not the same as the MSX port but the behavior is equal.

Quote:

Maybe starting from existing codes will help me make the link between electronics and programming.
Thank you,

You can take a look at this implementation of an I2C driver on the joystick port that was used to read the Wii Nunchuck controller.

https://github.com/Danjovic/MSX/blob/master/J2C/NunJ2C.asm

Page 2/3
1 | | 3