From 41f27f31a434c8e5ed7ae21c4f100a6f4e1e0d3c Mon Sep 17 00:00:00 2001 From: stephena Date: Sun, 27 Apr 2008 11:53:22 +0000 Subject: [PATCH] Fixed typo with double ampersand instead of the required single ampersand in evaluating the SBC opcode. Technically, the code does the same thing in C++, but that was only a fluke :) Thanks to JLA for the bug report. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1485 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/m6502/src/M6502.m4 | 6 +++--- stella/src/emucore/m6502/src/M6502Hi.ins | 24 +++++++++++------------ stella/src/emucore/m6502/src/M6502Low.ins | 24 +++++++++++------------ 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/stella/src/emucore/m6502/src/M6502.m4 b/stella/src/emucore/m6502/src/M6502.m4 index 71793e81e..9ac8a6365 100644 --- a/stella/src/emucore/m6502/src/M6502.m4 +++ b/stella/src/emucore/m6502/src/M6502.m4 @@ -13,14 +13,14 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: M6502.m4,v 1.6 2008-02-23 20:06:36 stephena Exp $ +// $Id: M6502.m4,v 1.7 2008-04-27 11:53:22 stephena Exp $ //============================================================================ /** Code and cases to emulate each of the 6502 instruction @author Bradford W. Mott - @version $Id: M6502.m4,v 1.6 2008-02-23 20:06:36 stephena Exp $ + @version $Id: M6502.m4,v 1.7 2008-04-27 11:53:22 stephena Exp $ */ #ifndef NOTSAMEPAGE @@ -546,7 +546,7 @@ define(M6502_SBC, `{ difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; diff --git a/stella/src/emucore/m6502/src/M6502Hi.ins b/stella/src/emucore/m6502/src/M6502Hi.ins index fac95bfdd..7171134ea 100644 --- a/stella/src/emucore/m6502/src/M6502Hi.ins +++ b/stella/src/emucore/m6502/src/M6502Hi.ins @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: M6502Hi.ins,v 1.4 2008-02-23 20:06:37 stephena Exp $ +// $Id: M6502Hi.ins,v 1.5 2008-04-27 11:53:22 stephena Exp $ //============================================================================ /** @@ -21,7 +21,7 @@ high compatibility emulation @author Bradford W. Mott - @version $Id: M6502Hi.ins,v 1.4 2008-02-23 20:06:37 stephena Exp $ + @version $Id: M6502Hi.ins,v 1.5 2008-04-27 11:53:22 stephena Exp $ */ #ifndef NOTSAMEPAGE @@ -114,14 +114,14 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: M6502Hi.ins,v 1.4 2008-02-23 20:06:37 stephena Exp $ +// $Id: M6502Hi.ins,v 1.5 2008-04-27 11:53:22 stephena Exp $ //============================================================================ /** Code and cases to emulate each of the 6502 instruction @author Bradford W. Mott - @version $Id: M6502Hi.ins,v 1.4 2008-02-23 20:06:37 stephena Exp $ + @version $Id: M6502Hi.ins,v 1.5 2008-04-27 11:53:22 stephena Exp $ */ #ifndef NOTSAMEPAGE @@ -3502,7 +3502,7 @@ case 0xeb: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3540,7 +3540,7 @@ case 0xe5: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3581,7 +3581,7 @@ case 0xf5: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3621,7 +3621,7 @@ case 0xed: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3663,7 +3663,7 @@ case 0xfd: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3705,7 +3705,7 @@ case 0xf9: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3748,7 +3748,7 @@ case 0xe1: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3791,7 +3791,7 @@ case 0xf1: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; diff --git a/stella/src/emucore/m6502/src/M6502Low.ins b/stella/src/emucore/m6502/src/M6502Low.ins index d4a012df9..01a78ff36 100644 --- a/stella/src/emucore/m6502/src/M6502Low.ins +++ b/stella/src/emucore/m6502/src/M6502Low.ins @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: M6502Low.ins,v 1.6 2008-02-23 20:06:37 stephena Exp $ +// $Id: M6502Low.ins,v 1.7 2008-04-27 11:53:22 stephena Exp $ //============================================================================ /** @@ -21,7 +21,7 @@ low compatibility emulation @author Bradford W. Mott - @version $Id: M6502Low.ins,v 1.6 2008-02-23 20:06:37 stephena Exp $ + @version $Id: M6502Low.ins,v 1.7 2008-04-27 11:53:22 stephena Exp $ */ #ifndef NOTSAMEPAGE @@ -115,14 +115,14 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: M6502Low.ins,v 1.6 2008-02-23 20:06:37 stephena Exp $ +// $Id: M6502Low.ins,v 1.7 2008-04-27 11:53:22 stephena Exp $ //============================================================================ /** Code and cases to emulate each of the 6502 instruction @author Bradford W. Mott - @version $Id: M6502Low.ins,v 1.6 2008-02-23 20:06:37 stephena Exp $ + @version $Id: M6502Low.ins,v 1.7 2008-04-27 11:53:22 stephena Exp $ */ #ifndef NOTSAMEPAGE @@ -3491,7 +3491,7 @@ case 0xeb: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3530,7 +3530,7 @@ case 0xe5: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3569,7 +3569,7 @@ case 0xf5: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3609,7 +3609,7 @@ case 0xed: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3657,7 +3657,7 @@ case 0xfd: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3705,7 +3705,7 @@ case 0xf9: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3745,7 +3745,7 @@ case 0xe1: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80; @@ -3792,7 +3792,7 @@ case 0xf1: difference += 100; // Z flag calculation ignores D flag - notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) && 0xff; + notZ = (((Int16)A) + ((Int16)~operand) + (C ? 1 : 0)) & 0xff; A = ourBCDTable[1][difference]; N = A & 0x80;