diff --git a/src/devices/cpu/mcs48/mcs48.cpp b/src/devices/cpu/mcs48/mcs48.cpp index 5c6ebcf427d..4aa7b148a7a 100644 --- a/src/devices/cpu/mcs48/mcs48.cpp +++ b/src/devices/cpu/mcs48/mcs48.cpp @@ -531,19 +531,25 @@ uint8_t mcs48_cpu_device::p2_mask() void mcs48_cpu_device::expander_operation(expander_op operation, uint8_t port) { - /* put opcode/data on low 4 bits of P2 */ + // put opcode on low 4 bits of P2 (overwriting latch) port_w(2, m_p2 = (m_p2 & 0xf0) | (uint8_t(operation) << 2) | (port & 3)); - /* generate high-to-low transition on PROG line */ + // generate high-to-low transition on PROG line prog_w(0); - /* put data on low 4 bits of P2 */ + // transfer data on low 4 bits of P2 if (operation != EXPANDER_OP_READ) port_w(2, m_p2 = (m_p2 & 0xf0) | (m_a & 0x0f)); else - m_a = port_r(2) & 0x0f; + { + // place P20-P23 in input mode + port_w(2, m_p2 |= 0x0f); - /* generate low-to-high transition on PROG line */ + // input data to lower 4 bits of A (upper 4 bits are cleared) + m_a = port_r(2) & 0x0f; + } + + // generate low-to-high transition on PROG line prog_w(1); } diff --git a/src/devices/machine/i8243.cpp b/src/devices/machine/i8243.cpp index 371073f217e..4bfbc81ac11 100644 --- a/src/devices/machine/i8243.cpp +++ b/src/devices/machine/i8243.cpp @@ -117,7 +117,8 @@ WRITE_LINE_MEMBER(i8243_device::prog_w) switch (m_opcode >> 2) { case mcs48_cpu_device::EXPANDER_OP_READ: - break; // handled above + m_p2out = 0x0f; // release expander bus + break; case mcs48_cpu_device::EXPANDER_OP_WRITE: m_p[m_opcode & 3] = m_p2 & 0x0f;