Merge remote-tracking branch 'libretro/master'

This commit is contained in:
OV2 2013-05-18 22:09:10 +02:00
commit eea4e6cc67
13 changed files with 274 additions and 233 deletions

View File

@ -722,9 +722,9 @@ void S9xAPULoadBlarggState(uint8 *oldblock)
SNES::smp.regs.pc = pc; SNES::smp.regs.pc = pc;
SNES::smp.regs.sp = sp; SNES::smp.regs.sp = sp;
SNES::smp.regs.a = a; SNES::smp.regs.endian.a = a;
SNES::smp.regs.x = x; SNES::smp.regs.x = x;
SNES::smp.regs.y = y; SNES::smp.regs.endian.y = y;
// blargg's psw has same layout as byuu's flags // blargg's psw has same layout as byuu's flags
SNES::smp.regs.p = psw; SNES::smp.regs.p = psw;

View File

@ -17,37 +17,37 @@ case 0xff: {
case 0x9f: { case 0x9f: {
op_io(4); op_io(4);
regs.a = (regs.a >> 4) | (regs.a << 4); regs.endian.a = (regs.endian.a >> 4) | (regs.endian.a << 4);
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
break; break;
} }
case 0xdf: { case 0xdf: {
op_io(2); op_io(2);
if(regs.p.c || (regs.a) > 0x99) { if(regs.p.c || (regs.endian.a) > 0x99) {
regs.a += 0x60; regs.endian.a += 0x60;
regs.p.c = 1; regs.p.c = 1;
} }
if(regs.p.h || (regs.a & 15) > 0x09) { if(regs.p.h || (regs.endian.a & 15) > 0x09) {
regs.a += 0x06; regs.endian.a += 0x06;
} }
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
break; break;
} }
case 0xbe: { case 0xbe: {
op_io(2); op_io(2);
if(!regs.p.c || (regs.a) > 0x99) { if(!regs.p.c || (regs.endian.a) > 0x99) {
regs.a -= 0x60; regs.endian.a -= 0x60;
regs.p.c = 0; regs.p.c = 0;
} }
if(!regs.p.h || (regs.a & 15) > 0x09) { if(!regs.p.h || (regs.endian.a & 15) > 0x09) {
regs.a -= 0x06; regs.endian.a -= 0x06;
} }
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
break; break;
} }
@ -230,7 +230,7 @@ case 0xf2: {
case 0x2d: { case 0x2d: {
op_io(2); op_io(2);
op_writestack(regs.a); op_writestack(regs.endian.a);
break; break;
} }
@ -242,7 +242,7 @@ case 0x4d: {
case 0x6d: { case 0x6d: {
op_io(2); op_io(2);
op_writestack(regs.y); op_writestack(regs.endian.y);
break; break;
} }
@ -254,7 +254,7 @@ case 0x0d: {
case 0xae: { case 0xae: {
op_io(2); op_io(2);
regs.a = op_readstack(); regs.endian.a = op_readstack();
break; break;
} }
@ -266,7 +266,7 @@ case 0xce: {
case 0xee: { case 0xee: {
op_io(2); op_io(2);
regs.y = op_readstack(); regs.endian.y = op_readstack();
break; break;
} }
@ -278,12 +278,12 @@ case 0x8e: {
case 0xcf: { case 0xcf: {
op_io(8); op_io(8);
ya = regs.y * regs.a; ya = regs.endian.y * regs.endian.a;
regs.a = ya; regs.endian.a = ya;
regs.y = ya >> 8; regs.endian.y = ya >> 8;
//result is set based on y (high-byte) only //result is set based on y (high-byte) only
regs.p.n = !!(regs.y & 0x80); regs.p.n = !!(regs.endian.y & 0x80);
regs.p.z = (regs.y == 0); regs.p.z = (regs.endian.y == 0);
break; break;
} }
@ -291,21 +291,21 @@ case 0x9e: {
op_io(11); op_io(11);
ya = regs.ya; ya = regs.ya;
//overflow set if quotient >= 256 //overflow set if quotient >= 256
regs.p.v = !!(regs.y >= regs.x); regs.p.v = !!(regs.endian.y >= regs.x);
regs.p.h = !!((regs.y & 15) >= (regs.x & 15)); regs.p.h = !!((regs.endian.y & 15) >= (regs.x & 15));
if(regs.y < (regs.x << 1)) { if(regs.endian.y < (regs.x << 1)) {
//if quotient is <= 511 (will fit into 9-bit result) //if quotient is <= 511 (will fit into 9-bit result)
regs.a = ya / regs.x; regs.endian.a = ya / regs.x;
regs.y = ya % regs.x; regs.endian.y = ya % regs.x;
} else { } else {
//otherwise, the quotient won't fit into regs.p.v + regs.a //otherwise, the quotient won't fit into regs.p.v + regs.endian.a
//this emulates the odd behavior of the S-SMP in this case //this emulates the odd behavior of the S-SMP in this case
regs.a = 255 - (ya - (regs.x << 9)) / (256 - regs.x); regs.endian.a = 255 - (ya - (regs.x << 9)) / (256 - regs.x);
regs.y = regs.x + (ya - (regs.x << 9)) % (256 - regs.x); regs.endian.y = regs.x + (ya - (regs.x << 9)) % (256 - regs.x);
} }
//result is set based on a (quotient) only //result is set based on a (quotient) only
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
break; break;
} }

View File

@ -1,22 +1,22 @@
case 0x7d: { case 0x7d: {
op_io(); op_io();
regs.a = regs.x; regs.endian.a = regs.x;
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
break; break;
} }
case 0xdd: { case 0xdd: {
op_io(); op_io();
regs.a = regs.y; regs.endian.a = regs.endian.y;
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
break; break;
} }
case 0x5d: { case 0x5d: {
op_io(); op_io();
regs.x = regs.a; regs.x = regs.endian.a;
regs.p.n = !!(regs.x & 0x80); regs.p.n = !!(regs.x & 0x80);
regs.p.z = (regs.x == 0); regs.p.z = (regs.x == 0);
break; break;
@ -24,9 +24,9 @@ case 0x5d: {
case 0xfd: { case 0xfd: {
op_io(); op_io();
regs.y = regs.a; regs.endian.y = regs.endian.a;
regs.p.n = !!(regs.y & 0x80); regs.p.n = !!(regs.endian.y & 0x80);
regs.p.z = (regs.y == 0); regs.p.z = (regs.endian.y == 0);
break; break;
} }
@ -45,9 +45,9 @@ case 0xbd: {
} }
case 0xe8: { case 0xe8: {
regs.a = op_readpc(); regs.endian.a = op_readpc();
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
break; break;
} }
@ -59,9 +59,9 @@ case 0xcd: {
} }
case 0x8d: { case 0x8d: {
regs.y = op_readpc(); regs.endian.y = op_readpc();
regs.p.n = !!(regs.y & 0x80); regs.p.n = !!(regs.endian.y & 0x80);
regs.p.z = (regs.y == 0); regs.p.z = (regs.endian.y == 0);
break; break;
} }
@ -71,9 +71,9 @@ case 0xe6: {
op_io(); op_io();
break; break;
case 2: case 2:
regs.a = op_readdp(regs.x); regs.endian.a = op_readdp(regs.x);
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -86,10 +86,10 @@ case 0xbf: {
op_io(); op_io();
break; break;
case 2: case 2:
regs.a = op_readdp(regs.x++); regs.endian.a = op_readdp(regs.x++);
op_io(); op_io();
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -102,9 +102,9 @@ case 0xe4: {
sp = op_readpc(); sp = op_readpc();
break; break;
case 2: case 2:
regs.a = op_readdp(sp); regs.endian.a = op_readdp(sp);
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -132,9 +132,9 @@ case 0xeb: {
sp = op_readpc(); sp = op_readpc();
break; break;
case 2: case 2:
regs.y = op_readdp(sp); regs.endian.y = op_readdp(sp);
regs.p.n = !!(regs.y & 0x80); regs.p.n = !!(regs.endian.y & 0x80);
regs.p.z = (regs.y == 0); regs.p.z = (regs.endian.y == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -148,9 +148,9 @@ case 0xf4: {
op_io(); op_io();
break; break;
case 2: case 2:
regs.a = op_readdp(sp + regs.x); regs.endian.a = op_readdp(sp + regs.x);
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -164,7 +164,7 @@ case 0xf9: {
op_io(); op_io();
break; break;
case 2: case 2:
regs.x = op_readdp(sp + regs.y); regs.x = op_readdp(sp + regs.endian.y);
regs.p.n = !!(regs.x & 0x80); regs.p.n = !!(regs.x & 0x80);
regs.p.z = (regs.x == 0); regs.p.z = (regs.x == 0);
opcode_cycle = 0; opcode_cycle = 0;
@ -180,9 +180,9 @@ case 0xfb: {
op_io(); op_io();
break; break;
case 2: case 2:
regs.y = op_readdp(sp + regs.x); regs.endian.y = op_readdp(sp + regs.x);
regs.p.n = !!(regs.y & 0x80); regs.p.n = !!(regs.endian.y & 0x80);
regs.p.z = (regs.y == 0); regs.p.z = (regs.endian.y == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -198,9 +198,9 @@ case 0xe5: {
sp |= op_readpc() << 8; sp |= op_readpc() << 8;
break; break;
case 3: case 3:
regs.a = op_readaddr(sp); regs.endian.a = op_readaddr(sp);
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -230,9 +230,9 @@ case 0xec: {
sp |= op_readpc() << 8; sp |= op_readpc() << 8;
break; break;
case 2: case 2:
regs.y = op_readaddr(sp); regs.endian.y = op_readaddr(sp);
regs.p.n = !!(regs.y & 0x80); regs.p.n = !!(regs.endian.y & 0x80);
regs.p.z = (regs.y == 0); regs.p.z = (regs.endian.y == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -247,9 +247,9 @@ case 0xf5: {
op_io(); op_io();
break; break;
case 2: case 2:
regs.a = op_readaddr(sp + regs.x); regs.endian.a = op_readaddr(sp + regs.x);
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -264,9 +264,9 @@ case 0xf6: {
op_io(); op_io();
break; break;
case 2: case 2:
regs.a = op_readaddr(sp + regs.y); regs.endian.a = op_readaddr(sp + regs.endian.y);
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -286,9 +286,9 @@ case 0xe7: {
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
break; break;
case 4: case 4:
regs.a = op_readaddr(sp); regs.endian.a = op_readaddr(sp);
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -308,9 +308,9 @@ case 0xf7: {
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
break; break;
case 4: case 4:
regs.a = op_readaddr(sp + regs.y); regs.endian.a = op_readaddr(sp + regs.endian.y);
regs.p.n = !!(regs.a & 0x80); regs.p.n = !!(regs.endian.a & 0x80);
regs.p.z = (regs.a == 0); regs.p.z = (regs.endian.a == 0);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -362,7 +362,7 @@ case 0xc6: {
op_readdp(regs.x); op_readdp(regs.x);
break; break;
case 3: case 3:
op_writedp(regs.x, regs.a); op_writedp(regs.x, regs.endian.a);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -374,7 +374,7 @@ case 0xaf: {
case 1: case 1:
op_io(2); op_io(2);
case 2: case 2:
op_writedp(regs.x++, regs.a); op_writedp(regs.x++, regs.endian.a);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -390,7 +390,7 @@ case 0xc4: {
op_readdp(dp); op_readdp(dp);
break; break;
case 3: case 3:
op_writedp(dp, regs.a); op_writedp(dp, regs.endian.a);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -422,7 +422,7 @@ case 0xcb: {
op_readdp(dp); op_readdp(dp);
break; break;
case 3: case 3:
op_writedp(dp, regs.y); op_writedp(dp, regs.endian.y);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -440,7 +440,7 @@ case 0xd4: {
op_readdp(dp); op_readdp(dp);
break; break;
case 3: case 3:
op_writedp(dp, regs.a); op_writedp(dp, regs.endian.a);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -452,7 +452,7 @@ case 0xd9: {
case 1: case 1:
dp = op_readpc(); dp = op_readpc();
op_io(); op_io();
dp += regs.y; dp += regs.endian.y;
break; break;
case 2: case 2:
op_readdp(dp); op_readdp(dp);
@ -476,7 +476,7 @@ case 0xdb: {
op_readdp(dp); op_readdp(dp);
break; break;
case 3: case 3:
op_writedp(dp, regs.y); op_writedp(dp, regs.endian.y);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -495,7 +495,7 @@ case 0xc5: {
op_readaddr(dp); op_readaddr(dp);
break; break;
case 4: case 4:
op_writeaddr(dp, regs.a); op_writeaddr(dp, regs.endian.a);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -533,7 +533,7 @@ case 0xcc: {
op_readaddr(dp); op_readaddr(dp);
break; break;
case 4: case 4:
op_writeaddr(dp, regs.y); op_writeaddr(dp, regs.endian.y);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -552,7 +552,7 @@ case 0xd5: {
op_readaddr(dp); op_readaddr(dp);
break; break;
case 3: case 3:
op_writeaddr(dp, regs.a); op_writeaddr(dp, regs.endian.a);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -565,13 +565,13 @@ case 0xd6: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
dp += regs.y; dp += regs.endian.y;
break; break;
case 2: case 2:
op_readaddr(dp); op_readaddr(dp);
break; break;
case 3: case 3:
op_writeaddr(dp, regs.a); op_writeaddr(dp, regs.endian.a);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -595,7 +595,7 @@ case 0xc7: {
op_readaddr(dp); op_readaddr(dp);
break; break;
case 5: case 5:
op_writeaddr(dp, regs.a); op_writeaddr(dp, regs.endian.a);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -613,13 +613,13 @@ case 0xd7: {
case 3: case 3:
dp |= op_readdp(sp + 1) << 8; dp |= op_readdp(sp + 1) << 8;
op_io(); op_io();
dp += regs.y; dp += regs.endian.y;
break; break;
case 4: case 4:
op_readaddr(dp); op_readaddr(dp);
break; break;
case 5: case 5:
op_writeaddr(dp, regs.a); op_writeaddr(dp, regs.endian.a);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }
@ -632,11 +632,11 @@ case 0xba: {
sp = op_readpc(); sp = op_readpc();
break; break;
case 2: case 2:
regs.a = op_readdp(sp); regs.endian.a = op_readdp(sp);
op_io(); op_io();
break; break;
case 3: case 3:
regs.y = op_readdp(sp + 1); regs.endian.y = op_readdp(sp + 1);
regs.p.n = !!(regs.ya & 0x8000); regs.p.n = !!(regs.ya & 0x8000);
regs.p.z = (regs.ya == 0); regs.p.z = (regs.ya == 0);
opcode_cycle = 0; opcode_cycle = 0;
@ -654,10 +654,10 @@ case 0xda: {
op_readdp(dp); op_readdp(dp);
break; break;
case 3: case 3:
op_writedp(dp, regs.a); op_writedp(dp, regs.endian.a);
break; break;
case 4: case 4:
op_writedp(dp + 1, regs.y); op_writedp(dp + 1, regs.endian.y);
opcode_cycle = 0; opcode_cycle = 0;
break; break;
} }

View File

@ -251,7 +251,7 @@ case 0x2e: {
sp = op_readdp(dp); sp = op_readdp(dp);
rd = op_readpc(); rd = op_readpc();
op_io(); op_io();
if(regs.a == sp){ break; } if(regs.endian.a == sp){ break; }
op_io(2); op_io(2);
regs.pc += (int8)rd; regs.pc += (int8)rd;
break; break;
@ -263,7 +263,7 @@ case 0xde: {
sp = op_readdp(dp + regs.x); sp = op_readdp(dp + regs.x);
rd = op_readpc(); rd = op_readpc();
op_io(); op_io();
if(regs.a == sp){ break; } if(regs.endian.a == sp){ break; }
op_io(2); op_io(2);
regs.pc += (int8)rd; regs.pc += (int8)rd;
break; break;
@ -283,9 +283,9 @@ case 0x6e: {
case 0xfe: { case 0xfe: {
rd = op_readpc(); rd = op_readpc();
op_io(); op_io();
regs.y--; regs.endian.y--;
op_io(); op_io();
if(regs.y == 0x00){ break; } if(regs.endian.y == 0x00){ break; }
op_io(2); op_io(2);
regs.pc += (int8)rd; regs.pc += (int8)rd;
break; break;

View File

@ -1,18 +1,18 @@
case 0x88: { case 0x88: {
rd = op_readpc(); rd = op_readpc();
regs.a = op_adc(regs.a, rd); regs.endian.a = op_adc(regs.endian.a, rd);
break; break;
} }
case 0x28: { case 0x28: {
rd = op_readpc(); rd = op_readpc();
regs.a = op_and(regs.a, rd); regs.endian.a = op_and(regs.endian.a, rd);
break; break;
} }
case 0x68: { case 0x68: {
rd = op_readpc(); rd = op_readpc();
regs.a = op_cmp(regs.a, rd); regs.endian.a = op_cmp(regs.endian.a, rd);
break; break;
} }
@ -24,88 +24,88 @@ case 0xc8: {
case 0xad: { case 0xad: {
rd = op_readpc(); rd = op_readpc();
regs.y = op_cmp(regs.y, rd); regs.endian.y = op_cmp(regs.endian.y, rd);
break; break;
} }
case 0x48: { case 0x48: {
rd = op_readpc(); rd = op_readpc();
regs.a = op_eor(regs.a, rd); regs.endian.a = op_eor(regs.endian.a, rd);
break; break;
} }
case 0x08: { case 0x08: {
rd = op_readpc(); rd = op_readpc();
regs.a = op_or(regs.a, rd); regs.endian.a = op_or(regs.endian.a, rd);
break; break;
} }
case 0xa8: { case 0xa8: {
rd = op_readpc(); rd = op_readpc();
regs.a = op_sbc(regs.a, rd); regs.endian.a = op_sbc(regs.endian.a, rd);
break; break;
} }
case 0x86: { case 0x86: {
op_io(); op_io();
rd = op_readdp(regs.x); rd = op_readdp(regs.x);
regs.a = op_adc(regs.a, rd); regs.endian.a = op_adc(regs.endian.a, rd);
break; break;
} }
case 0x26: { case 0x26: {
op_io(); op_io();
rd = op_readdp(regs.x); rd = op_readdp(regs.x);
regs.a = op_and(regs.a, rd); regs.endian.a = op_and(regs.endian.a, rd);
break; break;
} }
case 0x66: { case 0x66: {
op_io(); op_io();
rd = op_readdp(regs.x); rd = op_readdp(regs.x);
regs.a = op_cmp(regs.a, rd); regs.endian.a = op_cmp(regs.endian.a, rd);
break; break;
} }
case 0x46: { case 0x46: {
op_io(); op_io();
rd = op_readdp(regs.x); rd = op_readdp(regs.x);
regs.a = op_eor(regs.a, rd); regs.endian.a = op_eor(regs.endian.a, rd);
break; break;
} }
case 0x06: { case 0x06: {
op_io(); op_io();
rd = op_readdp(regs.x); rd = op_readdp(regs.x);
regs.a = op_or(regs.a, rd); regs.endian.a = op_or(regs.endian.a, rd);
break; break;
} }
case 0xa6: { case 0xa6: {
op_io(); op_io();
rd = op_readdp(regs.x); rd = op_readdp(regs.x);
regs.a = op_sbc(regs.a, rd); regs.endian.a = op_sbc(regs.endian.a, rd);
break; break;
} }
case 0x84: { case 0x84: {
dp = op_readpc(); dp = op_readpc();
rd = op_readdp(dp); rd = op_readdp(dp);
regs.a = op_adc(regs.a, rd); regs.endian.a = op_adc(regs.endian.a, rd);
break; break;
} }
case 0x24: { case 0x24: {
dp = op_readpc(); dp = op_readpc();
rd = op_readdp(dp); rd = op_readdp(dp);
regs.a = op_and(regs.a, rd); regs.endian.a = op_and(regs.endian.a, rd);
break; break;
} }
case 0x64: { case 0x64: {
dp = op_readpc(); dp = op_readpc();
rd = op_readdp(dp); rd = op_readdp(dp);
regs.a = op_cmp(regs.a, rd); regs.endian.a = op_cmp(regs.endian.a, rd);
break; break;
} }
@ -119,28 +119,28 @@ case 0x3e: {
case 0x7e: { case 0x7e: {
dp = op_readpc(); dp = op_readpc();
rd = op_readdp(dp); rd = op_readdp(dp);
regs.y = op_cmp(regs.y, rd); regs.endian.y = op_cmp(regs.endian.y, rd);
break; break;
} }
case 0x44: { case 0x44: {
dp = op_readpc(); dp = op_readpc();
rd = op_readdp(dp); rd = op_readdp(dp);
regs.a = op_eor(regs.a, rd); regs.endian.a = op_eor(regs.endian.a, rd);
break; break;
} }
case 0x04: { case 0x04: {
dp = op_readpc(); dp = op_readpc();
rd = op_readdp(dp); rd = op_readdp(dp);
regs.a = op_or(regs.a, rd); regs.endian.a = op_or(regs.endian.a, rd);
break; break;
} }
case 0xa4: { case 0xa4: {
dp = op_readpc(); dp = op_readpc();
rd = op_readdp(dp); rd = op_readdp(dp);
regs.a = op_sbc(regs.a, rd); regs.endian.a = op_sbc(regs.endian.a, rd);
break; break;
} }
@ -148,7 +148,7 @@ case 0x94: {
dp = op_readpc(); dp = op_readpc();
op_io(); op_io();
rd = op_readdp(dp + regs.x); rd = op_readdp(dp + regs.x);
regs.a = op_adc(regs.a, rd); regs.endian.a = op_adc(regs.endian.a, rd);
break; break;
} }
@ -156,7 +156,7 @@ case 0x34: {
dp = op_readpc(); dp = op_readpc();
op_io(); op_io();
rd = op_readdp(dp + regs.x); rd = op_readdp(dp + regs.x);
regs.a = op_and(regs.a, rd); regs.endian.a = op_and(regs.endian.a, rd);
break; break;
} }
@ -164,7 +164,7 @@ case 0x74: {
dp = op_readpc(); dp = op_readpc();
op_io(); op_io();
rd = op_readdp(dp + regs.x); rd = op_readdp(dp + regs.x);
regs.a = op_cmp(regs.a, rd); regs.endian.a = op_cmp(regs.endian.a, rd);
break; break;
} }
@ -172,7 +172,7 @@ case 0x54: {
dp = op_readpc(); dp = op_readpc();
op_io(); op_io();
rd = op_readdp(dp + regs.x); rd = op_readdp(dp + regs.x);
regs.a = op_eor(regs.a, rd); regs.endian.a = op_eor(regs.endian.a, rd);
break; break;
} }
@ -180,7 +180,7 @@ case 0x14: {
dp = op_readpc(); dp = op_readpc();
op_io(); op_io();
rd = op_readdp(dp + regs.x); rd = op_readdp(dp + regs.x);
regs.a = op_or(regs.a, rd); regs.endian.a = op_or(regs.endian.a, rd);
break; break;
} }
@ -188,7 +188,7 @@ case 0xb4: {
dp = op_readpc(); dp = op_readpc();
op_io(); op_io();
rd = op_readdp(dp + regs.x); rd = op_readdp(dp + regs.x);
regs.a = op_sbc(regs.a, rd); regs.endian.a = op_sbc(regs.endian.a, rd);
break; break;
} }
@ -196,7 +196,7 @@ case 0x85: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
rd = op_readaddr(dp); rd = op_readaddr(dp);
regs.a = op_adc(regs.a, rd); regs.endian.a = op_adc(regs.endian.a, rd);
break; break;
} }
@ -204,7 +204,7 @@ case 0x25: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
rd = op_readaddr(dp); rd = op_readaddr(dp);
regs.a = op_and(regs.a, rd); regs.endian.a = op_and(regs.endian.a, rd);
break; break;
} }
@ -212,7 +212,7 @@ case 0x65: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
rd = op_readaddr(dp); rd = op_readaddr(dp);
regs.a = op_cmp(regs.a, rd); regs.endian.a = op_cmp(regs.endian.a, rd);
break; break;
} }
@ -228,7 +228,7 @@ case 0x5e: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
rd = op_readaddr(dp); rd = op_readaddr(dp);
regs.y = op_cmp(regs.y, rd); regs.endian.y = op_cmp(regs.endian.y, rd);
break; break;
} }
@ -236,7 +236,7 @@ case 0x45: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
rd = op_readaddr(dp); rd = op_readaddr(dp);
regs.a = op_eor(regs.a, rd); regs.endian.a = op_eor(regs.endian.a, rd);
break; break;
} }
@ -244,7 +244,7 @@ case 0x05: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
rd = op_readaddr(dp); rd = op_readaddr(dp);
regs.a = op_or(regs.a, rd); regs.endian.a = op_or(regs.endian.a, rd);
break; break;
} }
@ -252,7 +252,7 @@ case 0xa5: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
rd = op_readaddr(dp); rd = op_readaddr(dp);
regs.a = op_sbc(regs.a, rd); regs.endian.a = op_sbc(regs.endian.a, rd);
break; break;
} }
@ -261,7 +261,7 @@ case 0x95: {
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.x); rd = op_readaddr(dp + regs.x);
regs.a = op_adc(regs.a, rd); regs.endian.a = op_adc(regs.endian.a, rd);
break; break;
} }
@ -269,8 +269,8 @@ case 0x96: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.y); rd = op_readaddr(dp + regs.endian.y);
regs.a = op_adc(regs.a, rd); regs.endian.a = op_adc(regs.endian.a, rd);
break; break;
} }
@ -279,7 +279,7 @@ case 0x35: {
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.x); rd = op_readaddr(dp + regs.x);
regs.a = op_and(regs.a, rd); regs.endian.a = op_and(regs.endian.a, rd);
break; break;
} }
@ -287,8 +287,8 @@ case 0x36: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.y); rd = op_readaddr(dp + regs.endian.y);
regs.a = op_and(regs.a, rd); regs.endian.a = op_and(regs.endian.a, rd);
break; break;
} }
@ -297,7 +297,7 @@ case 0x75: {
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.x); rd = op_readaddr(dp + regs.x);
regs.a = op_cmp(regs.a, rd); regs.endian.a = op_cmp(regs.endian.a, rd);
break; break;
} }
@ -305,8 +305,8 @@ case 0x76: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.y); rd = op_readaddr(dp + regs.endian.y);
regs.a = op_cmp(regs.a, rd); regs.endian.a = op_cmp(regs.endian.a, rd);
break; break;
} }
@ -315,7 +315,7 @@ case 0x55: {
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.x); rd = op_readaddr(dp + regs.x);
regs.a = op_eor(regs.a, rd); regs.endian.a = op_eor(regs.endian.a, rd);
break; break;
} }
@ -323,8 +323,8 @@ case 0x56: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.y); rd = op_readaddr(dp + regs.endian.y);
regs.a = op_eor(regs.a, rd); regs.endian.a = op_eor(regs.endian.a, rd);
break; break;
} }
@ -333,7 +333,7 @@ case 0x15: {
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.x); rd = op_readaddr(dp + regs.x);
regs.a = op_or(regs.a, rd); regs.endian.a = op_or(regs.endian.a, rd);
break; break;
} }
@ -341,8 +341,8 @@ case 0x16: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.y); rd = op_readaddr(dp + regs.endian.y);
regs.a = op_or(regs.a, rd); regs.endian.a = op_or(regs.endian.a, rd);
break; break;
} }
@ -351,7 +351,7 @@ case 0xb5: {
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.x); rd = op_readaddr(dp + regs.x);
regs.a = op_sbc(regs.a, rd); regs.endian.a = op_sbc(regs.endian.a, rd);
break; break;
} }
@ -359,8 +359,8 @@ case 0xb6: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
op_io(); op_io();
rd = op_readaddr(dp + regs.y); rd = op_readaddr(dp + regs.endian.y);
regs.a = op_sbc(regs.a, rd); regs.endian.a = op_sbc(regs.endian.a, rd);
break; break;
} }
@ -370,7 +370,7 @@ case 0x87: {
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp); rd = op_readaddr(sp);
regs.a = op_adc(regs.a, rd); regs.endian.a = op_adc(regs.endian.a, rd);
break; break;
} }
@ -380,7 +380,7 @@ case 0x27: {
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp); rd = op_readaddr(sp);
regs.a = op_and(regs.a, rd); regs.endian.a = op_and(regs.endian.a, rd);
break; break;
} }
@ -390,7 +390,7 @@ case 0x67: {
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp); rd = op_readaddr(sp);
regs.a = op_cmp(regs.a, rd); regs.endian.a = op_cmp(regs.endian.a, rd);
break; break;
} }
@ -400,7 +400,7 @@ case 0x47: {
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp); rd = op_readaddr(sp);
regs.a = op_eor(regs.a, rd); regs.endian.a = op_eor(regs.endian.a, rd);
break; break;
} }
@ -410,7 +410,7 @@ case 0x07: {
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp); rd = op_readaddr(sp);
regs.a = op_or(regs.a, rd); regs.endian.a = op_or(regs.endian.a, rd);
break; break;
} }
@ -420,7 +420,7 @@ case 0xa7: {
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp); rd = op_readaddr(sp);
regs.a = op_sbc(regs.a, rd); regs.endian.a = op_sbc(regs.endian.a, rd);
break; break;
} }
@ -429,8 +429,8 @@ case 0x97: {
op_io(); op_io();
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp + regs.y); rd = op_readaddr(sp + regs.endian.y);
regs.a = op_adc(regs.a, rd); regs.endian.a = op_adc(regs.endian.a, rd);
break; break;
} }
@ -439,8 +439,8 @@ case 0x37: {
op_io(); op_io();
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp + regs.y); rd = op_readaddr(sp + regs.endian.y);
regs.a = op_and(regs.a, rd); regs.endian.a = op_and(regs.endian.a, rd);
break; break;
} }
@ -449,8 +449,8 @@ case 0x77: {
op_io(); op_io();
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp + regs.y); rd = op_readaddr(sp + regs.endian.y);
regs.a = op_cmp(regs.a, rd); regs.endian.a = op_cmp(regs.endian.a, rd);
break; break;
} }
@ -459,8 +459,8 @@ case 0x57: {
op_io(); op_io();
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp + regs.y); rd = op_readaddr(sp + regs.endian.y);
regs.a = op_eor(regs.a, rd); regs.endian.a = op_eor(regs.endian.a, rd);
break; break;
} }
@ -469,8 +469,8 @@ case 0x17: {
op_io(); op_io();
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp + regs.y); rd = op_readaddr(sp + regs.endian.y);
regs.a = op_or(regs.a, rd); regs.endian.a = op_or(regs.endian.a, rd);
break; break;
} }
@ -479,14 +479,14 @@ case 0xb7: {
op_io(); op_io();
sp = op_readdp(dp); sp = op_readdp(dp);
sp |= op_readdp(dp + 1) << 8; sp |= op_readdp(dp + 1) << 8;
rd = op_readaddr(sp + regs.y); rd = op_readaddr(sp + regs.endian.y);
regs.a = op_sbc(regs.a, rd); regs.endian.a = op_sbc(regs.endian.a, rd);
break; break;
} }
case 0x99: { case 0x99: {
op_io(); op_io();
rd = op_readdp(regs.y); rd = op_readdp(regs.endian.y);
wr = op_readdp(regs.x); wr = op_readdp(regs.x);
wr = op_adc(wr, rd); wr = op_adc(wr, rd);
(1) ? op_writedp(regs.x, wr) : op_io(); (1) ? op_writedp(regs.x, wr) : op_io();
@ -495,7 +495,7 @@ case 0x99: {
case 0x39: { case 0x39: {
op_io(); op_io();
rd = op_readdp(regs.y); rd = op_readdp(regs.endian.y);
wr = op_readdp(regs.x); wr = op_readdp(regs.x);
wr = op_and(wr, rd); wr = op_and(wr, rd);
(1) ? op_writedp(regs.x, wr) : op_io(); (1) ? op_writedp(regs.x, wr) : op_io();
@ -504,7 +504,7 @@ case 0x39: {
case 0x79: { case 0x79: {
op_io(); op_io();
rd = op_readdp(regs.y); rd = op_readdp(regs.endian.y);
wr = op_readdp(regs.x); wr = op_readdp(regs.x);
wr = op_cmp(wr, rd); wr = op_cmp(wr, rd);
(0) ? op_writedp(regs.x, wr) : op_io(); (0) ? op_writedp(regs.x, wr) : op_io();
@ -513,7 +513,7 @@ case 0x79: {
case 0x59: { case 0x59: {
op_io(); op_io();
rd = op_readdp(regs.y); rd = op_readdp(regs.endian.y);
wr = op_readdp(regs.x); wr = op_readdp(regs.x);
wr = op_eor(wr, rd); wr = op_eor(wr, rd);
(1) ? op_writedp(regs.x, wr) : op_io(); (1) ? op_writedp(regs.x, wr) : op_io();
@ -522,7 +522,7 @@ case 0x59: {
case 0x19: { case 0x19: {
op_io(); op_io();
rd = op_readdp(regs.y); rd = op_readdp(regs.endian.y);
wr = op_readdp(regs.x); wr = op_readdp(regs.x);
wr = op_or(wr, rd); wr = op_or(wr, rd);
(1) ? op_writedp(regs.x, wr) : op_io(); (1) ? op_writedp(regs.x, wr) : op_io();
@ -531,7 +531,7 @@ case 0x19: {
case 0xb9: { case 0xb9: {
op_io(); op_io();
rd = op_readdp(regs.y); rd = op_readdp(regs.endian.y);
wr = op_readdp(regs.x); wr = op_readdp(regs.x);
wr = op_sbc(wr, rd); wr = op_sbc(wr, rd);
(1) ? op_writedp(regs.x, wr) : op_io(); (1) ? op_writedp(regs.x, wr) : op_io();

View File

@ -1,6 +1,6 @@
case 0xbc: { case 0xbc: {
op_io(); op_io();
regs.a = op_inc(regs.a); regs.endian.a = op_inc(regs.endian.a);
break; break;
} }
@ -12,13 +12,13 @@ case 0x3d: {
case 0xfc: { case 0xfc: {
op_io(); op_io();
regs.y = op_inc(regs.y); regs.endian.y = op_inc(regs.endian.y);
break; break;
} }
case 0x9c: { case 0x9c: {
op_io(); op_io();
regs.a = op_dec(regs.a); regs.endian.a = op_dec(regs.endian.a);
break; break;
} }
@ -30,31 +30,31 @@ case 0x1d: {
case 0xdc: { case 0xdc: {
op_io(); op_io();
regs.y = op_dec(regs.y); regs.endian.y = op_dec(regs.endian.y);
break; break;
} }
case 0x1c: { case 0x1c: {
op_io(); op_io();
regs.a = op_asl(regs.a); regs.endian.a = op_asl(regs.endian.a);
break; break;
} }
case 0x5c: { case 0x5c: {
op_io(); op_io();
regs.a = op_lsr(regs.a); regs.endian.a = op_lsr(regs.endian.a);
break; break;
} }
case 0x3c: { case 0x3c: {
op_io(); op_io();
regs.a = op_rol(regs.a); regs.endian.a = op_rol(regs.endian.a);
break; break;
} }
case 0x7c: { case 0x7c: {
op_io(); op_io();
regs.a = op_ror(regs.a); regs.endian.a = op_ror(regs.endian.a);
break; break;
} }
@ -218,10 +218,10 @@ case 0x0e: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
rd = op_readaddr(dp); rd = op_readaddr(dp);
regs.p.n = !!((regs.a - rd) & 0x80); regs.p.n = !!((regs.endian.a - rd) & 0x80);
regs.p.z = ((regs.a - rd) == 0); regs.p.z = ((regs.endian.a - rd) == 0);
op_readaddr(dp); op_readaddr(dp);
op_writeaddr(dp, rd | regs.a); op_writeaddr(dp, rd | regs.endian.a);
break; break;
} }
@ -229,10 +229,10 @@ case 0x4e: {
dp = op_readpc(); dp = op_readpc();
dp |= op_readpc() << 8; dp |= op_readpc() << 8;
rd = op_readaddr(dp); rd = op_readaddr(dp);
regs.p.n = !!((regs.a - rd) & 0x80); regs.p.n = !!((regs.endian.a - rd) & 0x80);
regs.p.z = ((regs.a - rd) == 0); regs.p.z = ((regs.endian.a - rd) == 0);
op_readaddr(dp); op_readaddr(dp);
op_writeaddr(dp, rd &~ regs.a); op_writeaddr(dp, rd &~ regs.endian.a);
break; break;
} }

View File

@ -73,9 +73,9 @@ void SMP::reset() {
regs.pc = 0xffc0; regs.pc = 0xffc0;
regs.sp = 0xef; regs.sp = 0xef;
regs.a = 0x00; regs.endian.a = 0x00;
regs.x = 0x00; regs.x = 0x00;
regs.y = 0x00; regs.endian.y = 0x00;
regs.p = 0x02; regs.p = 0x02;
//$00f1 //$00f1

View File

@ -58,9 +58,9 @@ public:
union { union {
uint16 ya; uint16 ya;
#ifndef __BIG_ENDIAN__ #ifndef __BIG_ENDIAN__
struct { uint8 a, y; }; struct { uint8 a, y; } endian;
#else #else
struct { uint8 y, a; }; struct { uint8 y, a; } endian;
#endif #endif
}; };
uint8 x; uint8 x;

View File

@ -38,9 +38,9 @@ void SMP::save_spc (uint8 *block) {
out.pc_low = regs.pc & 0xff; out.pc_low = regs.pc & 0xff;
out.pc_high = (regs.pc >> 8) & 0xff; out.pc_high = (regs.pc >> 8) & 0xff;
out.a = regs.a; out.a = regs.endian.a;
out.x = regs.x; out.x = regs.x;
out.y = regs.y; out.y = regs.endian.y;
out.psw = (uint8) ((unsigned) regs.p); out.psw = (uint8) ((unsigned) regs.p);
out.sp = regs.sp; out.sp = regs.sp;
out.unused_a[0] = out.unused_a[1] = 0; out.unused_a[0] = out.unused_a[1] = 0;
@ -84,9 +84,9 @@ void SMP::save_state(uint8 **block) {
INT32(regs.pc); INT32(regs.pc);
INT32(regs.sp); INT32(regs.sp);
INT32(regs.a); INT32(regs.endian.a);
INT32(regs.x); INT32(regs.x);
INT32(regs.y); INT32(regs.endian.y);
INT32(regs.p.n); INT32(regs.p.n);
INT32(regs.p.v); INT32(regs.p.v);
@ -146,9 +146,9 @@ void SMP::load_state(uint8 **block) {
INT32(regs.pc); INT32(regs.pc);
INT32(regs.sp); INT32(regs.sp);
INT32(regs.a); INT32(regs.endian.a);
INT32(regs.x); INT32(regs.x);
INT32(regs.y); INT32(regs.endian.y);
INT32(regs.p.n); INT32(regs.p.n);
INT32(regs.p.v); INT32(regs.p.v);

View File

@ -13,47 +13,69 @@ endif
CXX = g++ CXX = g++
CC = gcc CC = gcc
TARGET_NAME = snes9x
ifeq ($(platform), unix) ifeq ($(platform), unix)
TARGET := libretro.so TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T SHARED := -shared -Wl,--version-script=link.T
else ifeq ($(platform), osx) else ifeq ($(platform), osx)
TARGET := libretro.dylib TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC fpic := -fPIC
SHARED := -dynamiclib SHARED := -dynamiclib
else ifeq ($(platform), ios)
TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
CC = clang -arch armv7 -isysroot $(IOSSDK)
CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
CXXFLAGS += -DIOS
else ifeq ($(platform), qnx)
TARGET := $(TARGET_NAME)_libretro_qnx.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T
CC = qcc -Vgcc_notarmv7le
CC = QCC -Vgcc_notarmv7le_cpp
AR = QCC -Vgcc_ntoarmv7le
CXXFLAGS += -D__BLACKBERRY_QNX__
else ifeq ($(platform), ps3) else ifeq ($(platform), ps3)
TARGET := libretro_ps3.a TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe CXX = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-g++.exe
AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ CXXFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
STATIC_LINKING = 1
else ifeq ($(platform), sncps3) else ifeq ($(platform), sncps3)
TARGET := libretro_ps3.a TARGET := $(TARGET_NAME)_libretro_ps3.a
CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe CXX = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ CXXFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
STATIC_LINKING = 1
else ifeq ($(platform), psl1ght) else ifeq ($(platform), psl1ght)
TARGET := libretro_psl1ght.a TARGET := $(TARGET_NAME)_libretro_psl1ght.a
CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
CXX = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT) CXX = $(PS3DEV)/ppu/bin/ppu-g++$(EXE_EXT)
AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ CXXFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
STATIC_LINKING = 1
else ifeq ($(platform), xenon) else ifeq ($(platform), xenon)
TARGET := libretro_xenon360.a TARGET := $(TARGET_NAME)_libretro_xenon360.a
CC = xenon-gcc$(EXE_EXT) CC = xenon-gcc$(EXE_EXT)
CXX = xenon-g++$(EXE_EXT) CXX = xenon-g++$(EXE_EXT)
AR = xenon-ar$(EXE_EXT) AR = xenon-ar$(EXE_EXT)
CFLAGS += -D__LIBXENON__ -m32 -D__ppc__ CXXFLAGS += -D__LIBXENON__ -m32 -D__ppc__
STATIC_LINKING = 1
else ifeq ($(platform), wii) else ifeq ($(platform), wii)
TARGET := libretro_wii.a TARGET := $(TARGET_NAME)_libretro_wii.a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT) CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
CFLAGS += -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ CXXFLAGS += -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
STATIC_LINKING = 1
else else
TARGET := libretro.dll TARGET := $(TARGET_NAME)_libretro.dll
CC = gcc CC = gcc
CXX = g++ CXX = g++
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T
@ -79,15 +101,7 @@ CFLAGS = $(CXXFLAGS)
all: $(TARGET) all: $(TARGET)
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
ifeq ($(platform), ps3) ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else ifeq ($(platform), sncps3)
$(AR) rcs $@ $(OBJECTS)
else ifeq ($(platform), psl1ght)
$(AR) rcs $@ $(OBJECTS)
else ifeq ($(platform), xenon)
$(AR) rcs $@ $(OBJECTS)
else ifeq ($(platform), wii)
$(AR) rcs $@ $(OBJECTS) $(AR) rcs $@ $(OBJECTS)
else else
$(CXX) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) -lm $(CXX) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) -lm

23
libretro/jni/Android.mk Normal file
View File

@ -0,0 +1,23 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
ifeq ($(TARGET_ARCH),arm)
LOCAL_CFLAGS += -DANDROID_ARM
LOCAL_ARM_MODE := arm
endif
ifeq ($(TARGET_ARCH),x86)
LOCAL_CFLAGS += -DANDROID_X86
endif
ifeq ($(TARGET_ARCH),mips)
LOCAL_CFLAGS += -DANDROID_MIPS
endif
LOCAL_MODULE := libretro
LOCAL_SRC_FILES = ../../apu/apu.cpp ../../apu/bapu/dsp/sdsp.cpp ../../apu/bapu/dsp/SPC_DSP.cpp ../../apu/bapu/smp/smp.cpp ../../apu/bapu/smp/smp_state.cpp ../../bsx.cpp ../../c4.cpp ../../c4emu.cpp ../../cheats.cpp ../../cheats2.cpp ../../clip.cpp ../../conffile.cpp ../../controls.cpp ../../cpu.cpp ../../cpuexec.cpp ../../cpuops.cpp ../../crosshairs.cpp ../../dma.cpp ../../dsp.cpp ../../dsp1.cpp ../../dsp2.cpp ../../dsp3.cpp ../../dsp4.cpp ../../fxinst.cpp ../../fxemu.cpp ../../gfx.cpp ../../globals.cpp ../../logger.cpp ../../memmap.cpp ../../movie.cpp ../../obc1.cpp ../../ppu.cpp ../../stream.cpp ../../sa1.cpp ../../sa1cpu.cpp ../../screenshot.cpp ../../sdd1.cpp ../../sdd1emu.cpp ../../seta.cpp ../../seta010.cpp ../../seta011.cpp ../../seta018.cpp ../../snapshot.cpp ../../snes9x.cpp ../../spc7110.cpp ../../srtc.cpp ../../tile.cpp ../libretro.cpp
LOCAL_CXXFLAGS = -DANDROID
LOCAL_C_INCLUDES = ../../ ../../apu/bapu/
include $(BUILD_SHARED_LIBRARY)

View File

@ -0,0 +1,2 @@
APP_STL := stlport_static
APP_ABI := all

View File

@ -188,6 +188,8 @@
#include "jma/s9x-jma.h" #include "jma/s9x-jma.h"
#endif #endif
#include <ctype.h>
#include "snes9x.h" #include "snes9x.h"
#include "memmap.h" #include "memmap.h"
#include "apu/apu.h" #include "apu/apu.h"