You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/SGB_Command_Packet.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,30 +8,37 @@ Game Boy keyboard matrix (which still works).
8
8
## Transferring Bits
9
9
10
10
A command packet transfer must be initiated by setting both P14 and P15
11
-
to LOW, this will reset and start the SNES packet receiving program.
11
+
to LOW; this will reset and start the ICD2 packet receiving circuit.
12
12
Data is then transferred (LSB first), setting P14=LOW will indicate a
13
13
"0" bit, and setting P15=LOW will indicate a "1" bit. For example:
14
14
15
15
```
16
16
RESET 0 0 1 1 0 1 0
17
17
P14 --_---_---_-----------_-------_--...
18
18
P15 --_-----------_---_-------_------...
19
+
↑ ↑ ↑ ↑
20
+
Time 0 50 100 150
19
21
```
20
22
21
-
Data and reset pulses must be kept LOW for at least 5us. P14 and P15
22
-
must be kept both HIGH for at least 15us between any pulses. Obviously,
23
-
it'd be no good idea to access the JOYPAD register during the transfer,
23
+
[The boot ROM](<#Super Game Boy (SGB, SGB2)>) and licensed software keep data and reset pulses LOW for at least 5 μs and leave P14 and P15 HIGH for at least 15 μs after each pulse.
24
+
Though the hardware is capable of receiving pulses and spaces as short as 2 μs (as tested using [sgb-speedtest]),
25
+
following the common practice of 5-cycle pulses and 15-cycle spaces may improve reliability in some corner case that the community has not yet discovered.
26
+
Obviously, it'd be no good idea to access [the joypad register](<#FF00 — P1/JOYP: Joypad>) during the transfer,
24
27
for example, in case that your VBlank interrupt procedure reads-out
25
-
joypad states each frame, be sure to disable that interrupt during the
28
+
joypad states each frame, so be sure to disable that interrupt during the
26
29
transfer (or disable only the joypad procedure by using a software
0 commit comments