Core/cpu/hd6309/hd6309.cpp
/* Generate interrupts */
/****************************************************************************
 * Set IRQ line state
 ****************************************************************************/
Generate interrupts
Set IRQ line state
Generate interrupts Set IRQ line state
void hd6309_set_irq_line(int irqline, int state)
{
	if (irqline == HD6309_INPUT_LINE_NMI)
	{
		if (hd6309.nmi_state == state) return;
		hd6309.nmi_state = state;
		if( state == HD6309_CLEAR_LINE ) return;
		if( !(hd6309.int_state & HD6309_LDS) ) return;
		hd6309.int_state &= ~HD6309_SYNC;
		if( hd6309.int_state & HD6309_CWAI )
		{
			hd6309.int_state &= ~HD6309_CWAI;
			hd6309.extra_cycles += 7;	
		}
		else
		{
			CC |= CC_E; 				
			PUSHWORD(pPC);
			PUSHWORD(pU);
			PUSHWORD(pY);
			PUSHWORD(pX);
			PUSHBYTE(DP);
			if ( MD & MD_EM )
			{
				PUSHBYTE(F);
				PUSHBYTE(E);
				hd6309.extra_cycles += 2; 
			}
			PUSHBYTE(B);
			PUSHBYTE(A);
			PUSHBYTE(CC);
			hd6309.extra_cycles += 19;	
		}
		CC |= CC_IF | CC_II;			
		PCD = RM16(0xfffc);
		CHANGE_PC;
	}
	else if (irqline < 2)
	{
		hd6309.irq_state[irqline] = state;
		if (state == HD6309_CLEAR_LINE) return;
		CHECK_IRQ_LINES();
	}
}
void hd6309_set_irq_line ( int irqline , int state ) { if ( irqline == HD6309_INPUT_LINE_NMI ) { if ( hd6309 . nmi_state == state ) return ; hd6309 . nmi_state = state ; if ( state == HD6309_CLEAR_LINE ) return ; if ( ! ( hd6309 . int_state & HD6309_LDS ) ) return ; hd6309 . int_state &= ~ HD6309_SYNC ; if ( hd6309 . int_state & HD6309_CWAI ) { hd6309 . int_state &= ~ HD6309_CWAI ; hd6309 . extra_cycles += 7 ; } else { CC |= CC_E ; PUSHWORD ( pPC ) ; PUSHWORD ( pU ) ; PUSHWORD ( pY ) ; PUSHWORD ( pX ) ; PUSHBYTE ( DP ) ; if ( MD & MD_EM ) { PUSHBYTE ( F ) ; PUSHBYTE ( E ) ; hd6309 . extra_cycles += 2 ; } PUSHBYTE ( B ) ; PUSHBYTE ( A ) ; PUSHBYTE ( CC ) ; hd6309 . extra_cycles += 19 ; } CC |= CC_IF | CC_II ; PCD = RM16 ( 0xfffc ) ; CHANGE_PC ; } else if ( irqline < 2 ) { hd6309 . irq_state [ irqline ] = state ; if ( state == HD6309_CLEAR_LINE ) return ; CHECK_IRQ_LINES ( ) ; } }
Generate interrupts
 Set IRQ line state
Generate interrupts Set IRQ line state
//		LOG(("HD6309#%d set_irq_line (NMI) %d (PC=%4.4X)\n", cpu_getactivecpu(), state, pPC.d)); /* if the stack was not yet initialized */ /* HJB 990225: state already saved by CWAI? */ /* subtract +7 cycles next time */ /* save entire state */ /* subtract +2 cycles */ /* subtract +19 cycles next time */ /* inhibit FIRQ and IRQ */ //		LOG(("HD6309#%d set_irq_line %d, %d (PC=%4.4X)\n", cpu_getactivecpu(), irqline, state, pPC.d));