コード例 #1
0
ファイル: z80.cpp プロジェクト: Oggom/mednafen-git
/* Process a z80 non-maskable interrupt */
void z80_nmi( void )
{
  if( z80.halted ) { PC++; z80.halted = 0; }

  IFF1 = 0;

  Z80_WB_MACRO( --SP, PCH ); Z80_WB_MACRO( --SP, PCL );

  /* FIXME: how is R affected? */

  /* FIXME: how does contention apply here? */
  z80_tstates += 11; PC = 0x0066;
}
コード例 #2
0
ファイル: z80.cpp プロジェクト: IcooN/OpenEmu
/* Process a z80 maskable interrupt */
int z80_interrupt( void )
{
  if( IFF1 ) {

    /* If interrupts have just been enabled, don't accept the interrupt now,
       but check after the next instruction has been executed */
    if( z80_tstates == z80.interrupts_enabled_at ) 
    {
     return(0);
    }
      //event_add( z80_tstates + 1, EVENT_TYPE_INTERRUPT );
	//puts("Oops");
    //  return 0;
    //}

    if( z80.halted ) { PC++; z80.halted = 0; }
    IFF1=IFF2=0;

    Z80_WB_MACRO( --SP, PCH ); Z80_WB_MACRO( --SP, PCL );

    R++; 

    //printf("IMode: %02x, I: %02x\n", IM, I);

    switch(IM) {
      case 0: PC = 0x0038; z80_tstates += 6; break;
      case 1: PC = 0x0038; z80_tstates += 7; break;
      case 2: 
	{
	  uint16 inttemp=(0x100*I)+0xff;
	  PCL = Z80_RB_MACRO(inttemp++); PCH = Z80_RB_MACRO(inttemp);
	  z80_tstates += 7;
	  break;
	}
    }

    return 1;			/* Accepted an interrupt */

  } else {

    return 0;			/* Did not accept an interrupt */

  }
}
コード例 #3
0
ファイル: z80.cpp プロジェクト: Oggom/mednafen-git
/* Process a z80 maskable interrupt */
int z80_interrupt( void )
{

  if( IFF1 ) {

    /* If interrupts have just been enabled, don't accept the interrupt now,
       but check after the next instruction has been executed */
    if( z80_tstates == z80.interrupts_enabled_at ) {
      return 0;
    }

    if( z80.halted ) { PC++; z80.halted = 0; }
    
    IFF1=IFF2=0;

    Z80_WB_MACRO( --SP, PCH ); Z80_WB_MACRO( --SP, PCL );

    R++;

    switch(IM) {
      case 0: PC = 0x0038; z80_tstates += 7; break;
      case 1: PC = 0x0038; z80_tstates += 7; break;
      case 2: 
	{
	  uint16 inttemp=(0x100*I)+0xff;
	  PCL = Z80_RB_MACRO(inttemp++); PCH = Z80_RB_MACRO(inttemp);
	  z80_tstates += 7;
	  break;
	}
      //default:
      //	ui_error( UI_ERROR_ERROR, "Unknown interrupt mode %d", IM );
      //	fuse_abort();
    }

    return 1;			/* Accepted an interrupt */

  } else {

    return 0;			/* Did not accept an interrupt */

  }
}