Пример #1
0
void pia_set_input_cb2(int which, int data)
{
	struct pia6821 *p = pia + which;

	/* limit the data to 0 or 1 */
	data = data ? 1 : 0;

	/* CB2 is in input mode */
	if (C2_INPUT(p->ctl_b))
	{
		/* the new state has caused a transition */
		if (p->in_cb2 ^ data)
		{
			/* handle the active transition */
			if ((data && C2_LOW_TO_HIGH(p->ctl_b)) || (!data && C2_HIGH_TO_LOW(p->ctl_b)))
			{
				/* mark the IRQ */
				p->irq_b2 = 1;

				/* update externals */
				update_6821_interrupts(p);
			}
		}
	}

	/* set the new value for CA2 */
	p->in_cb2 = data;
	p->in_set |= PIA_IN_SET_CB2;
}
Пример #2
0
void pia_set_input_cb2 (int which, int data)
{
	struct pia6821 *p = pia + which;

	/* limit the data to 0 or 1 */
	data = data ? 1 : 0;

	/* CB2 is in input mode */
	if (C2_INPUT (p->ctl_b))
	{
		/* the new state has caused a transition */
		if (p->in_cb2 ^ data)
		{
			/* handle the active transition */
			if ((data && C2_LOW_TO_HIGH (p->ctl_b)) || (!data && C2_HIGH_TO_LOW (p->ctl_b)))
			{
				/* mark the IRQ */
				p->irq_b2 = 1;

				/* call the IRQ function if enabled */
				if (IRQ2_ENABLED (p->ctl_b))
					if (p->irq_b_func) p->irq_b_func ();
			}
		}
	}

	/* set the new value for CA2 */
	p->in_cb2 = data;
}
Пример #3
0
void C6821::SetCB2(BYTE byData)
{
  byData = byData ? 1 : 0;

  // CA2 is in input mode
  if ( C2_INPUT( m_byCTLB ) )
  {
    // the new state has caused a transition
    if ( m_byICB2 ^ byData )
    {
      // handle the active transition
      if ( ( byData && C2_LOW_TO_HIGH( m_byCTLB ) ) ||
        ( !byData && C2_HIGH_TO_LOW( m_byCTLB ) ) )
      {
        // mark the IRQ
        SET_IRQ2( m_byCTLB );

        // update externals
        UpdateInterrupts();
      }
    }
  }

  // set the new value for CA2
  m_byICB2 = byData;
}