shithub: riscv

Download patch

ref: 1df8b3d2c15ae0e8acd4d4f341385d774213d292
parent: 1a67cd2c4400bc5e0a6f79b2be0b1fc1b324ad64
author: aiju <devnull@localhost>
date: Tue Feb 25 18:25:28 EST 2014

games/nes: it's too late to write code

--- a/sys/src/games/nes/apu.c
+++ b/sys/src/games/nes/apu.c
@@ -94,11 +94,12 @@
 			(*a)--;
 	}
 	a = apuctr + TRILIN;
-	if((apuctr[RELOAD] & (1<<2)) != 0){
-		*a = mem[0x4008];
-		apuctr[RELOAD] &= ~(1<<2);
-	}else if(*a != 0)
+	if((apuctr[RELOAD] & (1<<2)) != 0)
+		*a = mem[0x4008] & 0x7f;
+	else if(*a != 0)
 		(*a)--;
+	if((mem[0x4008] & 0x80) == 0)
+		apuctr[RELOAD] &= ~(1<<2);
 }
 
 void