template<int i> void CPUcore::op_write_longr_w() { aa.l = op_readpc(); aa.h = op_readpc(); aa.b = op_readpc(); op_writelong(aa.d + regs.r[i] + 0, regs.a.l); L op_writelong(aa.d + regs.r[i] + 1, regs.a.h); }
template<void (CPUcore::*op)()> void CPUcore::op_read_addrx_b() { aa.l = op_readpc(); aa.h = op_readpc(); op_io_cond4(aa.w, aa.w + regs.x.w); L rd.l = op_readdbr(aa.w + regs.x.w); call(op); }
template<void (CPUcore::*op)()> void CPUcore::op_read_long_b() { aa.l = op_readpc(); aa.h = op_readpc(); aa.b = op_readpc(); L rd.l = op_readlong(aa.d); call(op); }
template<int n> alwaysinline void SMP::op_mov_reg_addr() { sp = op_readpc() << 0; sp |= op_readpc() << 8; regs.r[n] = op_readaddr(sp); regs.p.n = (regs.r[n] & 0x80); regs.p.z = (regs.r[n] == 0); }
template<void (R65816::*op)()> void R65816::op_read_longx_b() { aa.l = op_readpc(); aa.h = op_readpc(); aa.b = op_readpc(); L rd.l = op_readlong(aa.d + regs.x.w); call(op); }
template<void (R65816::*op)()> void R65816::op_read_addry_b() { aa.l = op_readpc(); aa.h = op_readpc(); op_io_cond4(aa.w, aa.w + regs.y.w); L rd.l = op_readdbr(aa.w + regs.y.w); call(op); }
void SMP::op_read_a_addrr() { dp = op_readpc() << 0; dp |= op_readpc() << 8; op_io(); rd = op_readaddr(dp + regs.r[i]); regs.a = (this->*op)(regs.a, rd); }
template<void (R65816::*op)()> void R65816::op_read_addr_w() { aa.l = op_readpc(); aa.h = op_readpc(); rd.l = op_readdbr(aa.w + 0); L rd.h = op_readdbr(aa.w + 1); call(op); }
template<int n, int i> void CPUcore::op_write_addrr_w() { aa.l = op_readpc(); aa.h = op_readpc(); op_io(); op_writedbr(aa.w + regs.r[i] + 0, regs.r[n] >> 0); L op_writedbr(aa.w + regs.r[i] + 1, regs.r[n] >> 8); }
void R65816::op_pea_e() { aa.l = op_readpc(); aa.h = op_readpc(); op_writestackn(aa.h); L op_writestackn(aa.l); regs.s.h = 0x01; }
void SMPcore::op_adjust_addr() { dp = op_readpc() << 0; dp |= op_readpc() << 8; rd = op_readaddr(dp); rd = (this->*op)(rd); op_writeaddr(dp, rd); }
void R65816::op_jmp_iaddr() { aa.l = op_readpc(); aa.h = op_readpc(); rd.l = op_readaddr(aa.w + 0); L rd.h = op_readaddr(aa.w + 1); regs.pc.w = rd.w; }
template<int i> alwaysinline void SMP::op_mov_a_addrr() { sp = op_readpc() << 0; sp |= op_readpc() << 8; op_io(); regs.a = op_readaddr(sp + regs.r[i]); regs.p.n = (regs.a & 0x80); regs.p.z = (regs.a == 0); }
template<int i> alwaysinline void SMP::op_mov_addrr_a() { dp = op_readpc() << 0; dp |= op_readpc() << 8; op_io(); dp += regs.r[i]; op_readaddr(dp); op_writeaddr(dp, regs.a); }
template<void (R65816::*op)()> void R65816::op_read_long_w() { aa.l = op_readpc(); aa.h = op_readpc(); aa.b = op_readpc(); rd.l = op_readlong(aa.d + 0); L rd.h = op_readlong(aa.d + 1); call(op); }
template<int op> void SMP::op_and1_bit() { dp = op_readpc() << 0; dp |= op_readpc() << 8; bit = dp >> 13; dp &= 0x1fff; rd = op_readaddr(dp); regs.p.c = regs.p.c & ((bool)(rd & (1 << bit)) ^ op); }
template<int i> void SMPcore::op_mov_addrr_a() { dp = op_readpc() << 0; dp |= op_readpc() << 8; op_io(); dp += regs.r[i]; op_readaddr<false>(dp); op_writeaddr(dp, regs.a); }
template<void (CPUcore::*op)()> void CPUcore::op_read_longx_w() { aa.l = op_readpc(); aa.h = op_readpc(); aa.b = op_readpc(); rd.l = op_readlong(aa.d + regs.x.w + 0); L rd.h = op_readlong(aa.d + regs.x.w + 1); call(op); }
alwaysinline void SMP::op_mov1_c_bit() { sp = op_readpc() << 0; sp |= op_readpc() << 8; bit = sp >> 13; sp &= 0x1fff; rd = op_readaddr(sp); regs.p.c = (rd & (1 << bit)); }
void R65816::op_jmp_iladdr() { aa.l = op_readpc(); aa.h = op_readpc(); rd.l = op_readaddr(aa.w + 0); rd.h = op_readaddr(aa.w + 1); L rd.b = op_readaddr(aa.w + 2); regs.pc.d = rd.d & 0xffffff; }
void R65816::op_per_n() { aa.l = op_readpc(); aa.h = op_readpc(); op_io(); rd.w = regs.pc.d + (int16)aa.w; op_writestackn(rd.h); L op_writestackn(rd.l); }
void R65816::op_jmp_iaddrx() { aa.l = op_readpc(); aa.h = op_readpc(); op_io(); rd.l = op_readpbr(aa.w + regs.x.w + 0); L rd.h = op_readpbr(aa.w + regs.x.w + 1); regs.pc.w = rd.w; }
void SMP::op_read_dp_const() { rd = op_readpc(); dp = op_readpc(); wr = op_readdp(dp); wr = (this->*op)(wr, rd); static uint8 (SMP::*cmp)(uint8, uint8) = &SMP::op_cmp; (op != cmp) ? op_writedp(dp, wr) : op_io(); }
void R65816::op_jsr_addr() { aa.l = op_readpc(); aa.h = op_readpc(); op_io(); regs.pc.w--; op_writestack(regs.pc.h); L op_writestack(regs.pc.l); regs.pc.w = aa.w; }
template<int op> void SMPcore::op_or1_bit() { dp = op_readpc() << 0; dp |= op_readpc() << 8; bit = dp >> 13; dp &= 0x1fff; rd = op_read(dp); op_io(); regs.p.c = regs.p.c | ((bool)(rd & (1 << bit)) ^ op); }
void SMPcore::op_adjust_addr_a() { dp = op_readpc() << 0; dp |= op_readpc() << 8; rd = op_readaddr(dp); regs.p.n = ((regs.a - rd) & 0x80); regs.p.z = ((regs.a - rd) == 0); op_readaddr(dp); op_writeaddr(dp, (op ? rd | regs.a : rd & ~regs.a)); }
alwaysinline void SMP::op_jmp_iaddrx() { dp = op_readpc() << 0; dp |= op_readpc() << 8; op_io(); dp += regs.x; rd = op_readaddr(dp + 0) << 0; rd |= op_readaddr(dp + 1) << 8; regs.pc = rd; }
void SMP::op_not1_bit() { dp = op_readpc() << 0; dp |= op_readpc() << 8; bit = dp >> 13; dp &= 0x1fff; rd = op_readaddr(dp); rd ^= 1 << bit; op_writeaddr(dp, rd); }
void SMP::op_eor1_bit() { dp = op_readpc() << 0; dp |= op_readpc() << 8; bit = dp >> 13; dp &= 0x1fff; rd = op_readaddr(dp); op_io(); regs.p.c = regs.p.c ^ (bool)(rd & (1 << bit)); }
void R65816::op_jsr_iaddrx_n() { aa.l = op_readpc(); op_writestackn(regs.pc.h); op_writestackn(regs.pc.l); aa.h = op_readpc(); op_io(); rd.l = op_readpbr(aa.w + regs.x.w + 0); L rd.h = op_readpbr(aa.w + regs.x.w + 1); regs.pc.w = rd.w; }