@Override
    public void set_nmi_line(int linestate) {
        if (m6502.nmi_state == linestate) return;

	m6502.nmi_state = linestate;
	if( linestate != CLEAR_LINE )
	{
		if(m6502log!=null) fprintf(m6502log,"M6502#%d set_nmi_line(ASSERT)\n", cpu_getactivecpu());
		m6502.ea.SetD(M6502_NMI_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 NMI ($%04x)\n", cpu_getactivecpu(), m6502.pc.D);
		change_pc16(m6502.pc.D);
	}
    }