diff options
author | qwx <devnull@localhost> | 2018-06-22 14:49:18 +0200 |
---|---|---|
committer | qwx <devnull@localhost> | 2018-06-22 14:49:18 +0200 |
commit | 0da9e3a7f508a0b47fa71abc3585066100c6ccbf (patch) | |
tree | 9044e0ea8a285c5ef4793f1fbe100ac64a01d591 /sys/src/games | |
parent | f554155ed0aeb0d11c30f8c501540a32a848ad32 (diff) |
gba: handle 8bit writes to vram
ignore 8bit writes to obj and oam, and duplicate bits for bg and palette
memory, as per gbatek.
thanks aiju for helping with the implementation.
Diffstat (limited to 'sys/src/games')
-rw-r--r-- | sys/src/games/gba/mem.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/src/games/gba/mem.c b/sys/src/games/gba/mem.c index c5a56abbb..500123b4e 100644 --- a/sys/src/games/gba/mem.c +++ b/sys/src/games/gba/mem.c @@ -315,6 +315,11 @@ memwrite(u32int a, u32int v, int n) return; case 5: b = a & sizeof(pram) - 1; + if(n == 1){ + b &= ~1; + n = 2; + v |= v << 8; + } cyc += (n+1) >> 1; ar16write(pram + b/2, b & 1, v, n); return; @@ -322,13 +327,20 @@ memwrite(u32int a, u32int v, int n) b = a & 128*KB - 1; if(b >= 64*KB) b &= ~(32*KB); + if(n == 1 && ((reg[DISPCNT] & 7) > 2 && b < 80*KB || b < 64*KB)){ + b &= ~1; + n = 2; + v |= v << 8; + } cyc += (n+1) >> 1; - arwrite(vram + b, v, n); + if(n != 1) + arwrite(vram + b, v, n); return; case 7: b = a & sizeof(oam) - 1; cyc++; - ar16write(oam + b/2, b & 1, v, n); + if(n != 1) + ar16write(oam + b/2, b & 1, v, n); return; case 8: case 9: case 10: case 11: case 12: case 13: if(backup == EEPROM){ |