Blob Blame History Raw
--- audacious-plugins-3.7.2/src/console/Spc_Cpu.h	2016-03-28 17:31:06.000000000 +0200
+++ audacious-plugins-3.8.2/src/console/Spc_Cpu.h	2017-01-20 18:03:32.000000000 +0100
@@ -76,8 +76,8 @@
 // TODO: remove non-wrapping versions?
 #define SPC_NO_SP_WRAPAROUND 0
 
-#define SET_SP( v )     (sp = ram + 0x101 + (v))
-#define GET_SP()        (sp - 0x101 - ram)
+#define SET_SP( v )     (sp = ram + 0x101 + ((uint8_t) v))
+#define GET_SP()        (uint8_t) (sp - 0x101 - ram)
 
 #if SPC_NO_SP_WRAPAROUND
 #define PUSH16( v )     (sp -= 2, SET_LE16( sp, v ))
@@ -485,7 +485,7 @@
 
 	case 0xAF: // MOV (X)+,A
 		WRITE_DP( 0, x, a + no_read_before_write  );
-		x++;
+		x = (uint8_t) (x + 1);
 		goto loop;
 
 // 5. 8-BIT LOGIC OPERATION COMMANDS
@@ -808,7 +808,7 @@
 		unsigned temp = y * a;
 		a = (uint8_t) temp;
 		nz = ((temp >> 1) | temp) & 0x7F;
-		y = temp >> 8;
+		y = (uint8_t) (temp >> 8);
 		nz |= y;
 		goto loop;
 	}
@@ -838,6 +838,7 @@
 
 		nz = (uint8_t) a;
 		a = (uint8_t) a;
+		y = (uint8_t) y;
 
 		goto loop;
 	}
@@ -1004,7 +1005,7 @@
 	case 0x7F: // RET1
 		temp = *sp;
 		SET_PC( GET_LE16( sp + 1 ) );
-		sp += 3;
+		SET_SP( GET_SP() + 3 );
 		goto set_psw;
 	case 0x8E: // POP PSW
 		POP( temp );
--- audacious-plugins-3.7.2/src/console/Spc_Dsp.cc	2016-03-28 17:31:06.000000000 +0200
+++ audacious-plugins-3.8.2/src/console/Spc_Dsp.cc	2017-01-20 18:03:32.000000000 +0100
@@ -641,7 +641,12 @@
 void Spc_Dsp::init( void* ram_64k )
 {
 	m.ram = (uint8_t*) ram_64k;
-	mute_voices( 0 );
+
+	// [jlindgren 2016/12/16] Calling mute_voices() before load() causes an
+	// unitialized read of m.regs; instead, just set m.mute_mask here, as we
+	// know mute_voices() will be called as part of load() anyway.
+	m.mute_mask = 0;  // mute_voices( 0 );
+
 	disable_surround( false );
 	set_output( 0, 0 );
 	reset();