UINT8 pia6821_device::port_a_r() { UINT8 ret = get_in_a_value(); // IRQ flags implicitly cleared by a read m_irq_a1 = FALSE; m_irq_a2 = FALSE; update_interrupts(); // CA2 is configured as output and in read strobe mode if(C2_OUTPUT(m_ctl_a) && C2_STROBE_MODE(m_ctl_a)) { // this will cause a transition low set_out_ca2(FALSE); // if the CA2 strobe is cleared by the E, reset it right away if(STROBE_E_RESET(m_ctl_a)) { set_out_ca2(TRUE); } } LOG(("PIA #%s: port A read = %02X\n", tag(), ret)); return ret; }
static UINT8 port_a_r(const device_config *device) { pia6821_state *p = get_token(device); UINT8 ret = get_in_a_value(device); /* IRQ flags implicitly cleared by a read */ p->irq_a1 = FALSE; p->irq_a2 = FALSE; update_interrupts(device); /* CA2 is configured as output and in read strobe mode */ if (C2_OUTPUT(p->ctl_a) && C2_STROBE_MODE(p->ctl_a)) { /* this will cause a transition low */ set_out_ca2(device, FALSE); /* if the CA2 strobe is cleared by the E, reset it right away */ if (STROBE_E_RESET(p->ctl_a)) set_out_ca2(device, TRUE); } LOG(("PIA #%s: port A read = %02X\n", device->tag, ret)); return ret; }
static UINT8 get_out_a_value(const device_config *device) { pia6821_state *p = get_token(device); UINT8 ret; if (p->ddr_a == 0xff) /* all output */ ret = p->out_a; else /* input pins don't change */ ret = (p->out_a & p->ddr_a) | (get_in_a_value(device) & ~p->ddr_a); return ret; }
UINT8 pia6821_device::get_out_a_value() { UINT8 ret; if (m_ddr_a == 0xff) { // all output ret = m_out_a; } else { // input pins don't change ret = (m_out_a & m_ddr_a) | (get_in_a_value() & ~m_ddr_a); } return ret; }