Page 1 of 1

Serial Data Transfer clock internal vs. external

Posted: Thu Dec 07, 2017 7:36 am
by zeroone
When you link 2 Game Boys together, how do they coordinate which of them clocks the channel? Is it based off of menu selections (e.g. Connect as player 1 vs connect as player 2)?

Re: Serial Data Transfer clock internal vs. external

Posted: Thu Dec 07, 2017 3:44 pm
by Shonumi
Typically, both Game Boys will set themselves up to receive data on an external clock, meaning they can't initiate a transfer. One Game Boy will switch to an internal clock when prompted by user input (pressing A or START on a given menu), then it will send a byte and wait for a response from the other GB. The one using the external clock would be the "slave" and the one using an internal clock is "master", since "master" will be the one driving communications.

It's possible for two GBs to switch to internal clocks at the same time during the user input phase for selecting multiplayer. In that case, some games have "master" and "slave" bytes they exchange. By default, the slave byte is put into register SB. Only when they switch to internal clocks do they setup the master code. If one GB tries to become master, but it receives a master byte, something went wrong, and the game will prompt users to try again.