Align struct name with rest of core

This commit is contained in:
OV2 2013-05-18 22:10:50 +02:00
parent eea4e6cc67
commit ba634f195c
9 changed files with 211 additions and 211 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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