Post by lunchbox on May 22, 2020 17:53:55 GMT -5
This is only the second controller. Without taking into account differences ZT cable. I still did not understand how to initialize, how the program will understand that this is the second joystick or cable. Unconnected cable or cable connected at bid. It is very difficult. Now it’s clear why there are no games with this feature.
So zero tolerance sets up the 2nd controller port much like a standard controller. It uses the TH and TL lines and does 4-bit parallel data transfer and uses i believe pins 7 and 9 to tell the console whe its ok to transfer data or receive data by bringing the signal high or low.
I WOULD NOT bother with this method unless you truly understand parallel data transmission.
The serial data transmission is easy and there isnt much to it.
TXDATA EQU $A10015 ; SERIAL TRANSMIT REGISTER (CONTROLLER PORT 2)
RXDATA EQU $A10017 ; SERIAL RECEIVE REGISTER (CONTROLLER PORT 2)
SCTRL2 EQU $A10019 ; SERIAL CONTROL REGISTER (CONTROLLER PORT 2)
TX data is the transfer data register for controller port 2
RX Data is the receive data register for controller port 2.
SCTRL2 Is the serial control register. your read against it to see if its ok to send or IF there is a byte read to read in (receive)
Just like the registers posted above, they are also registers like this for controller port 1 serial tx/rx and control and even the ext port on the back of the early model 1 megadrive.
See here for more info. It goes well into further info about it, however its all in assembly.
plutiedev.com/io-ports
Also here are the pinouts for a custom cable to make this code work between two megadrives.
use the code i provided below and convert them into bex assembly functions where you pass in your byte to d0
to send and you receive data in d0 from the receive routine.