shithub: riscv

Download patch

ref: 5d202d345616907d511b46e395226958fe66a2c3
parent: 8fdd633d57778af2e7fc01115e67f3735e553244
author: aiju <devnull@localhost>
date: Wed Jun 13 05:26:55 EDT 2018

games/gb: fix mbc5 register addressing (fixes warioland3 gamebreaking bug)

--- a/sys/src/games/gb/mem.c
+++ b/sys/src/games/gb/mem.c
@@ -431,11 +431,11 @@
 		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);