mirror of https://github.com/mgba-emu/mgba.git
GB IO: Fix edge cases for JOYP
This commit is contained in:
parent
f47b6881fc
commit
2266ecf86e
|
@ -359,14 +359,16 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
|
||||||
static uint8_t _readKeys(struct GB* gb) {
|
static uint8_t _readKeys(struct GB* gb) {
|
||||||
uint8_t keys = *gb->keySource;
|
uint8_t keys = *gb->keySource;
|
||||||
switch (gb->memory.io[REG_JOYP] & 0x30) {
|
switch (gb->memory.io[REG_JOYP] & 0x30) {
|
||||||
|
case 0x30:
|
||||||
|
keys = 0;
|
||||||
|
break;
|
||||||
case 0x20:
|
case 0x20:
|
||||||
keys >>= 4;
|
keys >>= 4;
|
||||||
break;
|
break;
|
||||||
case 0x10:
|
case 0x10:
|
||||||
break;
|
break;
|
||||||
default:
|
case 0x00:
|
||||||
// ???
|
keys |= keys >> 4;
|
||||||
keys = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0xC0 | (gb->memory.io[REG_JOYP] | 0xF) ^ (keys & 0xF);
|
return 0xC0 | (gb->memory.io[REG_JOYP] | 0xF) ^ (keys & 0xF);
|
||||||
|
|
Loading…
Reference in New Issue