public static void take_irq()
    {
        if(m6502log!=null) fprintf(m6502log,"M6502#%d before_takeirq :PC:%d,PPC:%d,SP:%d,ZP:%d,EA:%d,A:%d,X:%d,Y:%d,P:%d,p_irq:%d,a_c:%d,nmi:%d,irq:%d,so:%d\n", cpu_getactivecpu(),m6502.pc.D,m6502.ppc.D,m6502.sp.D,m6502.zp.D,m6502.ea.D,m6502.a,m6502.x,m6502.y,m6502.p,m6502.pending_irq,m6502.after_cli,m6502.nmi_state,m6502.irq_state,m6502.so_state);          
    
	if( (m6502.p & F_I)==0 )
	{
		m6502.ea.SetD(M6502_IRQ_VEC);
		m6502_ICount[0] -= 7;
		PUSH(m6502.pc.H);
		PUSH(m6502.pc.L);
		PUSH(m6502.p & ~F_B);
		m6502.p = ((m6502.p & ~F_D) | F_I)&0xFF;		/* knock out D and set I flag */
		m6502.pc.SetL(RDMEM(m6502.ea.D));
		m6502.pc.SetH(RDMEM(m6502.ea.D+1));
		if(m6502log!=null) fprintf(m6502log,"M6502#%d takes IRQ ($%04x)\n", cpu_getactivecpu(), m6502.pc.D);
		/* call back the cpuintrf to let it clear the line */
		if (m6502.irq_callback!=null) m6502.irq_callback.handler(0);
		change_pc16(m6502.pc.D);
	}
	m6502.pending_irq = 0;
        if(m6502log!=null) fprintf(m6502log,"M6502#%d after_takeirq :PC:%d,PPC:%d,SP:%d,ZP:%d,EA:%d,A:%d,X:%d,Y:%d,P:%d,p_irq:%d,a_c:%d,nmi:%d,irq:%d,so:%d\n", cpu_getactivecpu(),m6502.pc.D,m6502.ppc.D,m6502.sp.D,m6502.zp.D,m6502.ea.D,m6502.a,m6502.x,m6502.y,m6502.p,m6502.pending_irq,m6502.after_cli,m6502.nmi_state,m6502.irq_state,m6502.so_state);          
    
    }