INLINE void sm8500_do_interrupt(UINT16 vector) { /* Push PC */ PUSH_BYTE( regs.PC & 0xFF ); PUSH_BYTE( regs.PC >> 8 ); /* Push PS1 */ PUSH_BYTE( regs.PS1 ); /* Clear I flag */ regs.PS1 &= ~ 0x01; /* Change PC to address stored at "vector" */ regs.PC = sm85cpu_mem_readword( vector ); }
void cpu6502_irq(struct cpu6502_context *context) { if (context->flags & FLAG_I) { return; /* interrupts disabled */ } PUSH_BYTE(context, context->pc >> 8); PUSH_BYTE(context, context->pc & 0xff); PUSH_BYTE(context, (GET_FLAGS(context)) & ~FLAG_B); context->flags |= FLAG_I; context->flags &= ~FLAG_D; context->pc = context->readfunc(context->cpu, VECTOR_IRQ_LO); context->pc |= context->readfunc(context->cpu, VECTOR_IRQ_HI) << 8; context->cycles_left -= 7; }