Fix 8-bit I/O writes

This commit is contained in:
Jeffrey Pfau 2013-07-29 01:30:06 -07:00
parent 15aa862d70
commit 3f122dcf14
1 changed files with 3 additions and 3 deletions

View File

@ -130,9 +130,9 @@ void GBAIOWrite8(struct GBA* gba, uint32_t address, uint8_t value) {
} }
return; return;
} }
value <<= 8 * (address & 1); uint16_t value16 = value << (8 * (address & 1));
value |= (gba->memory.io[(address & (SIZE_IO - 1)) >> 1]) & ~(0xFF << (8 * (address & 1))); value16 |= (gba->memory.io[(address & (SIZE_IO - 1)) >> 1]) & ~(0xFF << (8 * (address & 1)));
GBAIOWrite(gba, address, value); GBAIOWrite(gba, address & 0xFFFFFFFE, value16);
} }
void GBAIOWrite32(struct GBA* gba, uint32_t address, uint32_t value) { void GBAIOWrite32(struct GBA* gba, uint32_t address, uint32_t value) {