gbdev / pandocs

The single, most comprehensive Game Boy technical reference.
https://gbdev.io/pandocs/
Creative Commons Zero v1.0 Universal
583 stars 89 forks source link

Behaviour of "open" serial transfers #558

Open ISSOtm opened 6 days ago

ISSOtm commented 6 days ago

Originally raised as https://github.com/gbdev/pandocs/pull/556#pullrequestreview-2153629353:

I'm now wondering what value is obtained from attempting a transfer when the other GB(C) has not set its bit 7. Could it depend on the last transferred bit?

This can be expanded to "what happens if the serial port is not connected to another console?"; to the best of my knowledge, bits shifted in are 1s, but this isn't stated clearly.

quinnyo commented 6 days ago

I have some limited test results about this. I tested various no-connection and live disconnection scenarios (cable out, power down, SC.7 == 0). I say 'limited' because I wasn't specifically testing what happened upon disconnection while/after receiving certain values. It seems likely that I did inadvertently test both 1 and 0 but it's possible I got lucky and always happened to transfer the right value just before disconnection.

The table shows the various scenarios (remote status) and the value received.

remote status value rx
not connected 1
connected, unpowered 0
connected, SC.7 == 0 0

Each status includes booting up in that configuration as well as forcing that configuration after some amount of successful transfers. I found no differences in that sense so I just condensed the table down.

Test notes: - Test devices: DMG, MGB, CGB(clear), CGB(red) - all combinations (each as clock provider and not) of MGB & CGB: same result. - CGB(red) has a flaky connector so wasn't tested further. - all combinations of DMG, MGB, and CGB(clear): same result. - CGB mode not used. - test program simply started the next transfer if not transferring - test values were either counting patterns or random numbers - the last ~8 received bytes were printed on screen - results collected by lookin' at numbers