GB: Yet more SGB cleanup
Vicki Pfau vi@endrift.com
Fri, 06 Sep 2019 19:22:18 -0700
2 files changed,
6 insertions(+),
3 deletions(-)
M
src/gb/io.c
→
src/gb/io.c
@@ -115,10 +115,12 @@ }
if (bits == gb->currentSgbBits) { return; } - gb->currentSgbBits = bits; switch (bits) { + case 0: case 1: - gb->sgbIncrement = !gb->sgbIncrement; + if (gb->currentSgbBits & 2) { + gb->sgbIncrement = !gb->sgbIncrement; + } break; case 3: if (gb->sgbIncrement) {@@ -127,6 +129,7 @@ gb->sgbCurrentController = (gb->sgbCurrentController + 1) & gb->sgbControllers;
} break; } + gb->currentSgbBits = bits; if (gb->sgbBit == 128 && bits == 2) { GBVideoWriteSGBPacket(&gb->video, gb->sgbPacket); ++gb->sgbBit;
M
src/gb/video.c
→
src/gb/video.c
@@ -702,7 +702,7 @@ case SGB_ATTR_SET:
break; case SGB_MLT_REQ: video->p->sgbControllers = video->sgbPacketBuffer[1] & 0x3; - video->p->sgbCurrentController = 0; + video->p->sgbCurrentController &= video->p->sgbControllers; return; case SGB_MASK_EN: video->renderer->sgbRenderMode = video->sgbPacketBuffer[1] & 0x3;