improved serial input emulation.

This commit is contained in:
smf- 2012-01-27 19:13:38 +00:00
parent bba6893104
commit 678e9c4209

View File

@ -382,6 +382,7 @@ void via6522_device::shift()
}
}
}
if (SO_EXT_CONTROL(m_acr))
{
m_out_cb2 = (m_sr >> 7) & 1;
@ -399,6 +400,35 @@ void via6522_device::shift()
}
}
}
if (SI_O2_CONTROL(m_acr) || SI_T2_CONTROL(m_acr))
{
if (!m_in_cb2_func.isnull())
{
m_in_cb2 = m_in_cb2_func();
}
m_sr = (m_sr << 1) | (m_in_cb2 & 1);
m_shift_counter = (m_shift_counter + 1) % 8;
if (m_shift_counter)
{
if (SI_O2_CONTROL(m_acr)) {
m_shift_timer->adjust(cycles_to_time(2));
} else {
m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2));
}
}
else
{
if (!(m_ifr & INT_SR))
{
set_int(INT_SR);
}
}
}
if (SI_EXT_CONTROL(m_acr))
{
if (!m_in_cb2_func.isnull())
@ -653,11 +683,11 @@ READ8_MEMBER( via6522_device::read )
val = m_sr;
m_shift_counter=0;
clear_int(INT_SR);
if (SO_O2_CONTROL(m_acr))
if (SI_O2_CONTROL(m_acr))
{
m_shift_timer->adjust(cycles_to_time(2));
}
if (SO_T2_CONTROL(m_acr))
if (SI_T2_CONTROL(m_acr))
{
m_shift_timer->adjust(cycles_to_time((m_t2ll + 2)*2));
}