void C6821::SetCA1(BYTE byData) { byData = byData ? 1 : 0; // the new state has caused a transition if ( m_byCA1 ^ byData ) { // handle the active transition if ( ( byData && C1_LOW_TO_HIGH( m_byCTLA ) ) || ( !byData && C1_HIGH_TO_LOW( m_byCTLA ) ) ) { // mark the IRQ SET_IRQ1(m_byCTLA); // update externals UpdateInterrupts(); // CA2 is configured as output and in read strobe mode and cleared by a CA1 transition if ( C2_OUTPUT( m_byCTLA ) && C2_STROBE_MODE( m_byCTLA ) && STROBE_C1_RESET( m_byCTLA ) ) { // call the CA2 output function if ( !m_byOCA2 ) PIA_W_CALLBACK( m_stOutCA2, 1 ); // clear CA2 m_byOCA2 = 1; } } } // set the new value for CA1 m_byCA1 = byData; }
void pia_set_input_cb1(int which, int data) { pia6821 *p = pia + which; /* limit the data to 0 or 1 */ data = data ? 1 : 0; /* the new state has caused a transition */ if (p->in_cb1 ^ data) { /* handle the active transition */ if ((data && C1_LOW_TO_HIGH(p->ctl_b)) || (!data && C1_HIGH_TO_LOW(p->ctl_b))) { /* mark the IRQ */ p->irq_b1 = 1; /* update externals */ update_6821_interrupts(p); /* If CB2 is configured as a write-strobe output which is reset by a CB1 transition, this reset will only happen when a read from port B implicitly clears the IRQ B1 flag. So we handle the CB2 reset there. Note that this is different from what happens with port A. */ } } /* set the new value for CB1 */ p->in_cb1 = data; p->in_set |= PIA_IN_SET_CB1; }
void pia_set_input_cb1 (int which, int data) { struct pia6821 *p = pia + which; /* limit the data to 0 or 1 */ data = data ? 1 : 0; /* the new state has caused a transition */ if (p->in_cb1 ^ data) { /* handle the active transition */ if ((data && C1_LOW_TO_HIGH (p->ctl_b)) || (!data && C1_HIGH_TO_LOW (p->ctl_b))) { /* mark the IRQ */ p->irq_b1 = 1; /* call the IRQ function if enabled */ if (IRQ1_ENABLED (p->ctl_b)) if (p->irq_b_func) p->irq_b_func (); /* CB2 is configured as output and in write strobe mode and cleared by a CA1 transition */ if (C2_OUTPUT (p->ctl_b) && C2_STROBE_MODE (p->ctl_b) && STROBE_C1_RESET (p->ctl_b)) { /* the IRQ1 flag must have also been cleared */ if (!p->irq_b1) { /* call the CB2 output function */ if (!p->out_cb2) if (p->out_cb2_func) p->out_cb2_func (0, 1); /* clear CB2 */ p->out_cb2 = 1; } } } } /* set the new value for CB1 */ p->in_cb1 = data; }
void pia_set_input_ca1(int which, int data) { struct pia6821 *p = pia + which; /* limit the data to 0 or 1 */ data = data ? 1 : 0; /* the new state has caused a transition */ if (p->in_ca1 ^ data) { /* handle the active transition */ if ((data && C1_LOW_TO_HIGH(p->ctl_a)) || (!data && C1_HIGH_TO_LOW(p->ctl_a))) { /* mark the IRQ */ p->irq_a1 = 1; /* update externals */ update_6821_interrupts(p); /* CA2 is configured as output and in read strobe mode and cleared by a CA1 transition */ if (C2_OUTPUT(p->ctl_a) && C2_STROBE_MODE(p->ctl_a) && STROBE_C1_RESET(p->ctl_a)) { /* call the CA2 output function */ if (!p->out_ca2) if (p->intf->out_ca2_func) p->intf->out_ca2_func(0, 1); /* clear CA2 */ p->out_ca2 = 1; } } } /* set the new value for CA1 */ p->in_ca1 = data; p->in_set |= PIA_IN_SET_CA1; }