GB IO: Fix edge cases for JOYP
Jeffrey Pfau jeffrey@endrift.com
Tue, 16 Feb 2016 23:40:02 -0800
1 files changed,
5 insertions(+),
3 deletions(-)
jump to
M
src/gb/io.c
→
src/gb/io.c
@@ -359,14 +359,16 @@
static uint8_t _readKeys(struct GB* gb) { uint8_t keys = *gb->keySource; switch (gb->memory.io[REG_JOYP] & 0x30) { + case 0x30: + keys = 0; + break; case 0x20: keys >>= 4; break; case 0x10: break; - default: - // ??? - keys = 0; + case 0x00: + keys |= keys >> 4; break; } return 0xC0 | (gb->memory.io[REG_JOYP] | 0xF) ^ (keys & 0xF);