From 5d202d345616907d511b46e395226958fe66a2c3 Mon Sep 17 00:00:00 2001 From: aiju <devnull@localhost> Date: Wed, 13 Jun 2018 09:26:55 +0000 Subject: [PATCH] games/gb: fix mbc5 register addressing (fixes warioland3 gamebreaking bug) --- sys/src/games/gb/mem.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/src/games/gb/mem.c b/sys/src/games/gb/mem.c index 44a10820c..ff8fd7950 100644 --- a/sys/src/games/gb/mem.c +++ b/sys/src/games/gb/mem.c @@ -431,11 +431,11 @@ mbc5(int a, int v) default: nope(a); } - switch(a >> 13){ - case 0: ramen = (v & 0xf) == 0xa; break; - case 1: b0 = b0 & 0x100 | v; break; - case 2: b0 = b0 & 0xff | v << 8 & 0x100; break; - case 3: b1 = v & 0xff; b1 %= nbackbank; break; + switch(a >> 12){ + case 0: case 1: ramen = (v & 0xf) == 0xa; break; + case 2: b0 = b0 & 0x100 | v; break; + case 3: b0 = b0 & 0xff | v << 8 & 0x100; break; + case 4: b1 = v & 0xff; b1 %= nbackbank; break; } b0 %= nrom >> 14; romb = rom + (b0 << 14);