mirror of https://github.com/mgba-emu/mgba.git
GB I/O: Fix SGB command clocking (fixes #1029)
This commit is contained in:
parent
36de596fdb
commit
16eed8ed34
|
@ -106,7 +106,7 @@ static const uint8_t _registerMask[] = {
|
||||||
|
|
||||||
static void _writeSGBBits(struct GB* gb, int bits) {
|
static void _writeSGBBits(struct GB* gb, int bits) {
|
||||||
if (!bits) {
|
if (!bits) {
|
||||||
gb->sgbBit = 0;
|
gb->sgbBit = -1;
|
||||||
memset(gb->sgbPacket, 0, sizeof(gb->sgbPacket));
|
memset(gb->sgbPacket, 0, sizeof(gb->sgbPacket));
|
||||||
}
|
}
|
||||||
if (bits == gb->currentSgbBits) {
|
if (bits == gb->currentSgbBits) {
|
||||||
|
@ -122,9 +122,12 @@ static void _writeSGBBits(struct GB* gb, int bits) {
|
||||||
}
|
}
|
||||||
switch (bits) {
|
switch (bits) {
|
||||||
case 1:
|
case 1:
|
||||||
|
if (gb->sgbBit < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
gb->sgbPacket[gb->sgbBit >> 3] |= 1 << (gb->sgbBit & 7);
|
gb->sgbPacket[gb->sgbBit >> 3] |= 1 << (gb->sgbBit & 7);
|
||||||
// Fall through
|
break;
|
||||||
case 2:
|
case 3:
|
||||||
++gb->sgbBit;
|
++gb->sgbBit;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue