From 2315e528556221ecd9cf5d240a0a6f57a323b8ec Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 21 Feb 2016 15:40:51 -0800 Subject: [PATCH] GB IO: Fix reading from palette data --- src/gb/io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gb/io.c b/src/gb/io.c index 4009bfb41..a6d67be0a 100644 --- a/src/gb/io.c +++ b/src/gb/io.c @@ -338,7 +338,7 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) { case REG_BCPS: gb->video.bcpIndex = value & 0x3F; gb->video.bcpIncrement = value & 0x80; - gb->memory.io[REG_BCPD] = gb->video.palette[gb->video.bcpIndex >> 1]; + gb->memory.io[REG_BCPD] = gb->video.palette[gb->video.bcpIndex >> 1] >> (8 * (gb->video.bcpIndex & 1)); break; case REG_BCPD: GBVideoProcessDots(&gb->video); @@ -347,7 +347,7 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) { case REG_OCPS: gb->video.ocpIndex = value & 0x3F; gb->video.ocpIncrement = value & 0x80; - gb->memory.io[REG_OCPD] = gb->video.palette[8 * 4 + (gb->video.ocpIndex >> 1)]; + gb->memory.io[REG_OCPD] = gb->video.palette[8 * 4 + (gb->video.ocpIndex >> 1)] >> (8 * (gb->video.ocpIndex & 1)); break; case REG_OCPD: GBVideoProcessDots(&gb->video);