all repos — mgba @ 16eed8ed34d6cbe366fce2d2335b04418c489031

mGBA Game Boy Advance Emulator

GB I/O: Fix SGB command clocking (fixes #1029)
Vicki Pfau vi@endrift.com
Fri, 30 Mar 2018 21:11:34 -0700
commit

16eed8ed34d6cbe366fce2d2335b04418c489031

parent

36de596fdbe9190a52ab40318a02b9d37806ce35

1 files changed, 6 insertions(+), 3 deletions(-)

jump to
M src/gb/io.csrc/gb/io.c

@@ -106,7 +106,7 @@ };

static void _writeSGBBits(struct GB* gb, int bits) { if (!bits) { - gb->sgbBit = 0; + gb->sgbBit = -1; memset(gb->sgbPacket, 0, sizeof(gb->sgbPacket)); } if (bits == gb->currentSgbBits) {

@@ -122,9 +122,12 @@ return;

} switch (bits) { case 1: + if (gb->sgbBit < 0) { + return; + } gb->sgbPacket[gb->sgbBit >> 3] |= 1 << (gb->sgbBit & 7); - // Fall through - case 2: + break; + case 3: ++gb->sgbBit; default: break;