I/O port pinout
Mega Drive I/O port pinout
Master System peripherals use the same pinout, so you can plug them as-is and use them in your homebrew. Take into mind that often they aren't easy to automatically detect (when it's even possible), so consider supporting a Mega Drive counterpart when possible.
A lot of older systems (mostly computers) used joysticks over DE-9 ports. The pinout is usually not compatible with those, and you should look into an adapter to make sure you don't fry anything (in particular, the pins for VCC and GND are all over the place).
The TH and TR pins have 330Ω resistors (inherited from the Master System), as those are the two pins that are commonly used for outputs; however it may be wise to not make any assumptions as some clone consoles may lack them.
Mega Drive EXT port pinout
The direction of the EXT port on the back of the console (used by the Mega Modem) is reversed compared to the two controller ports, which in turn results in the pin numbers being mirrored. However the way the pins are used is not reversed (in other words, DATA0 is still to the left of the port, VCC still to the right, etc.).
Also unlike the controller ports, the 330Ω resistors on TH and TR are not present.
Saturn I/O port pinout
Saturn's I/O ports have the same lines as the Mega Drive ones, but the plugs have a different shape. You can make a passive adapter that simply rewires the connections in order to use Saturn peripherals in your Mega Drive homebrew (and vice versa). Note that Mega Drive and Saturn peripherals are not compatible with each other and you have to explicitly include code to handle them.
A lot of sites seem to give the pins names based on their use with a
Saturn controller rather than their I/O names, the following table
indicates the corresponding names (note that +5V refers to
the TL pin which is held high, not the actual power line):
| Common name | Mega Drive style name |
|---|---|
VCC | VCC
|
GND | GND
|
D0 | DATA0
|
D1 | DATA1
|
D2 | DATA2
|
D3 | DATA3
|
S0 | TH
|
S1 | TR
|
+5V | TL
|