Skip to content

Commit f3bab87

Browse files
committed
Fix SYA and SXA opcodes in the CPU. blargg_nes_cpu_test5 now works
1 parent 7c70db1 commit f3bab87

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/ops.inc

+8-2
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,16 @@ case 0x93: ST_IY(_A&_X&(((A-_Y)>>8)+1));
464464
case 0x9F: ST_ABY(_A&_X&(((A-_Y)>>8)+1));
465465

466466
/* SYA */
467-
case 0x9C: ST_ABX(_Y&(((A-_X)>>8)+1));
467+
case 0x9C: /* Can't reuse existing ST_ABI macro here, due to addressing weirdness. */
468+
{
469+
unsigned int A; GetABIWR(A,_X); A = ((_Y&((A>>8)+1)) << 8) | (A & 0xff); WrMem(A,A>>8); break;
470+
}
468471

469472
/* SXA */
470-
case 0x9E: ST_ABY(_X&(((A-_Y)>>8)+1));
473+
case 0x9E: /* Can't reuse existing ST_ABI macro here, due to addressing weirdness. */
474+
{
475+
unsigned int A; GetABIWR(A,_Y); A = ((_X&((A>>8)+1)) << 8) | (A & 0xff); WrMem(A,A>>8); break;
476+
}
471477

472478
/* XAS */
473479
case 0x9B: _S=_A&_X;ST_ABY(_S& (((A-_Y)>>8)+1) );

0 commit comments

Comments
 (0)