Bug fixes

This commit is contained in:
Andrew Jacobs 2019-09-03 08:34:45 +01:00
parent aba1cc1521
commit 72a21b6af3
2 changed files with 13 additions and 17 deletions

View File

@ -278,7 +278,7 @@ void emu816::step()
case 0xb4: op_ldy(am_dpgx()); break; case 0xb4: op_ldy(am_dpgx()); break;
case 0xb5: op_lda(am_dpgx()); break; case 0xb5: op_lda(am_dpgx()); break;
case 0xb6: op_ldx(am_dpgy()); break; case 0xb6: op_ldx(am_dpgy()); break;
case 0xb7: op_lda(am_dpil()); break; case 0xb7: op_lda(am_dily()); break;
case 0xb8: op_clv(am_impl()); break; case 0xb8: op_clv(am_impl()); break;
case 0xb9: op_lda(am_absy()); break; case 0xb9: op_lda(am_absy()); break;
case 0xba: op_tsx(am_impl()); break; case 0xba: op_tsx(am_impl()); break;
@ -309,7 +309,7 @@ void emu816::step()
case 0xd1: op_cmp(am_dpiy()); break; case 0xd1: op_cmp(am_dpiy()); break;
case 0xd2: op_cmp(am_dpgi()); break; case 0xd2: op_cmp(am_dpgi()); break;
case 0xd3: op_cmp(am_sriy()); break; case 0xd3: op_cmp(am_sriy()); break;
case 0xd4: op_pei(am_dpgi()); break; case 0xd4: op_pei(am_dpag()); break;
case 0xd5: op_cmp(am_dpgx()); break; case 0xd5: op_cmp(am_dpgx()); break;
case 0xd6: op_dec(am_dpgx()); break; case 0xd6: op_dec(am_dpgx()); break;
case 0xd7: op_cmp(am_dily()); break; case 0xd7: op_cmp(am_dily()); break;

View File

@ -769,7 +769,7 @@ private:
if (e || p.f_m) { if (e || p.f_m) {
Byte data = getByte(ea); Byte data = getByte(ea);
Word temp = data - a.b - 1; Word temp = a.b - data;
setc(temp & 0x100); setc(temp & 0x100);
setnz_b(lo(temp)); setnz_b(lo(temp));
@ -777,7 +777,7 @@ private:
} }
else { else {
Word data = getWord(ea); Word data = getWord(ea);
Addr temp = data - a.w - 1; Addr temp = a.w - data;
setc(temp & 0x10000L); setc(temp & 0x10000L);
setnz_w((Word)temp); setnz_w((Word)temp);
@ -820,7 +820,7 @@ private:
if (e || p.f_x) { if (e || p.f_x) {
Byte data = getByte(ea); Byte data = getByte(ea);
Word temp = data - x.b - 1; Word temp = x.b - data;
setc(temp & 0x100); setc(temp & 0x100);
setnz_b(lo(temp)); setnz_b(lo(temp));
@ -828,7 +828,7 @@ private:
} }
else { else {
Word data = getWord(ea); Word data = getWord(ea);
Addr temp = data - x.w - 1; Addr temp = x.w - data;
setc(temp & 0x10000); setc(temp & 0x10000);
setnz_w((Word) temp); setnz_w((Word) temp);
@ -842,7 +842,7 @@ private:
if (e || p.f_x) { if (e || p.f_x) {
Byte data = getByte(ea); Byte data = getByte(ea);
Word temp = data - y.b - 1; Word temp = y.b - data;
setc(temp & 0x100); setc(temp & 0x100);
setnz_b(lo(temp)); setnz_b(lo(temp));
@ -850,7 +850,7 @@ private:
} }
else { else {
Word data = getWord(ea); Word data = getWord(ea);
Addr temp = data - y.w - 1; Addr temp = y.w - data;
setc(temp & 0x10000); setc(temp & 0x10000);
setnz_w((Word) temp); setnz_w((Word) temp);
@ -1100,8 +1100,8 @@ private:
{ {
TRACE("MVN"); TRACE("MVN");
Byte src = getByte(ea + 0); Byte src = getByte(ea + 1);
Byte dst = getByte(ea + 1); Byte dst = getByte(ea + 0);
setByte(join(dbr = dst, y.w++), getByte(join(src, x.w++))); setByte(join(dbr = dst, y.w++), getByte(join(src, x.w++)));
if (--a.w != 0xffff) pc -= 3; if (--a.w != 0xffff) pc -= 3;
@ -1112,8 +1112,8 @@ private:
{ {
TRACE("MVP"); TRACE("MVP");
Byte src = getByte(ea + 0); Byte src = getByte(ea + 1);
Byte dst = getByte(ea + 1); Byte dst = getByte(ea + 0);
setByte(join(dbr = dst, y.w--), getByte(join(src, x.w--))); setByte(join(dbr = dst, y.w--), getByte(join(src, x.w--)));
if (--a.w != 0xffff) pc -= 3; if (--a.w != 0xffff) pc -= 3;
@ -1364,14 +1364,12 @@ private:
setc(a.b & 0x80); setc(a.b & 0x80);
setnz_b(a.b = (a.b << 1) | carry); setnz_b(a.b = (a.b << 1) | carry);
setByte(ea, a.b);
} }
else { else {
register Word carry = p.f_c ? 0x0001 : 0x0000; register Word carry = p.f_c ? 0x0001 : 0x0000;
setc(a.w & 0x8000); setc(a.w & 0x8000);
setnz_w(a.w = (a.w << 1) | carry); setnz_w(a.w = (a.w << 1) | carry);
setWord(ea, a.w);
} }
cycles += 2; cycles += 2;
} }
@ -1409,14 +1407,12 @@ private:
setc(a.b & 0x01); setc(a.b & 0x01);
setnz_b(a.b = (a.b >> 1) | carry); setnz_b(a.b = (a.b >> 1) | carry);
setByte(ea, a.b);
} }
else { else {
register Word carry = p.f_c ? 0x8000 : 0x0000; register Word carry = p.f_c ? 0x8000 : 0x0000;
setc(a.w & 0x0001); setc(a.w & 0x0001);
setnz_w(a.w = (a.w >> 1) | carry); setnz_w(a.w = (a.w >> 1) | carry);
setWord(ea, a.w);
} }
cycles += 2; cycles += 2;
} }
@ -1819,8 +1815,8 @@ private:
p.f_c = oe; p.f_c = oe;
if (e) { if (e) {
p.b |= 0x30;
sp.w = 0x0100 | sp.b; sp.w = 0x0100 | sp.b;
dp.w = 0x0000;
} }
cycles += 2; cycles += 2;
} }