From db9d5467b6ade296ce9da9d46ac6d1581ea87bec Mon Sep 17 00:00:00 2001 From: xlar54 Date: Tue, 14 Jun 2022 00:25:52 -0500 Subject: [PATCH] changes per #1 from pi1541 --- emu816.cc | 6 +++--- emu816.h | 29 +++++++++++++++++++---------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/emu816.cc b/emu816.cc index e4d2c03..6162b05 100644 --- a/emu816.cc +++ b/emu816.cc @@ -118,7 +118,7 @@ void emu816::step() case 0x1e: op_asl(am_absx()); break; case 0x1f: op_ora(am_alnx()); break; - case 0x20: op_jsr(am_absl()); break; + case 0x20: op_jsr(am_absl2()); break; case 0x21: op_and(am_dpix()); break; case 0x22: op_jsl(am_alng()); break; case 0x23: op_and(am_srel()); break; @@ -164,7 +164,7 @@ void emu816::step() case 0x49: op_eor(am_immm()); break; case 0x4a: op_lsra(am_impl()); break; case 0x4b: op_phk(am_impl()); break; - case 0x4c: op_jmp(am_absl()); break; + case 0x4c: op_jmp(am_absl2()); break; case 0x4d: op_eor(am_absl()); break; case 0x4e: op_lsr(am_absl()); break; case 0x4f: op_eor(am_alng()); break; @@ -176,7 +176,7 @@ void emu816::step() case 0x54: op_mvn(am_immw()); break; case 0x55: op_eor(am_dpgx()); break; case 0x56: op_lsr(am_dpgx()); break; - case 0x57: op_eor(am_dpil()); break; + case 0x57: op_eor(am_dpiy()); break; case 0x58: op_cli(am_impl()); break; case 0x59: op_eor(am_absy()); break; case 0x5a: op_phy(am_impl()); break; diff --git a/emu816.h b/emu816.h index f928937..e8b3ab0 100644 --- a/emu816.h +++ b/emu816.h @@ -145,6 +145,16 @@ private: return (ea); } + // Absolute - a (fix for 4c and 20) + INLINE static Addr am_absl2() + { + register Addr ea = join(pbr, getWord(bank(pbr) | pc)); + + BYTES(2); + cycles += 2; + return (ea); + } + // Absolute Indexed X - a,X INLINE static Addr am_absx() { @@ -168,7 +178,7 @@ private: // Absolute Indirect - (a) INLINE static Addr am_absi() { - register Addr ia = join(0, getWord(bank(pbr) | pc)); + register Addr ia = join(pbr, getWord(bank(pbr) | pc)); BYTES(2); cycles += 4; @@ -531,12 +541,12 @@ private: if (e || p.f_m) { setc(a.b & 0x80); setnz_b(a.b <<= 1); - setByte(ea, a.b); + //setByte(ea, a.b); } else { setc(a.w & 0x8000); setnz_w(a.w <<= 1); - setWord(ea, a.w); + //setWord(ea, a.w); } cycles += 2; } @@ -771,7 +781,7 @@ private: Byte data = getByte(ea); Word temp = a.b - data; - setc(temp & 0x100); + setc(a.b >= data); setnz_b(lo(temp)); cycles += 2; } @@ -779,7 +789,7 @@ private: Word data = getWord(ea); Addr temp = a.w - data; - setc(temp & 0x10000L); + setc(a.w >= data); setnz_w((Word)temp); cycles += 3; } @@ -822,7 +832,7 @@ private: Byte data = getByte(ea); Word temp = x.b - data; - setc(temp & 0x100); + setc(x.b >= data); setnz_b(lo(temp)); cycles += 2; } @@ -830,7 +840,7 @@ private: Word data = getWord(ea); Addr temp = x.w - data; - setc(temp & 0x10000); + setc(x.w >= data); setnz_w((Word) temp); cycles += 3; } @@ -844,7 +854,7 @@ private: Byte data = getByte(ea); Word temp = y.b - data; - setc(temp & 0x100); + setc(y.b >= data); setnz_b(lo(temp)); cycles += 2; } @@ -852,7 +862,7 @@ private: Word data = getWord(ea); Addr temp = y.w - data; - setc(temp & 0x10000); + setc(y.w >= data); setnz_w((Word) temp); cycles += 3; } @@ -1432,7 +1442,6 @@ private: pbr = pullByte(); cycles += 7; } - p.f_i = 0; } INLINE static void op_rtl(Addr ea)