mcs48: Set lower 4 bits of P2 to input during (and after) MOVD A,Pp

i8243: Release P2 output after completion of read operation
This commit is contained in:
AJR 2018-10-03 17:08:34 -04:00
parent 845925fe99
commit 0321f85141
2 changed files with 13 additions and 6 deletions

View File

@ -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);
}

View File

@ -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;