via6522: fixed the flank timer value which improved but not completelly reverted the vectrex regression

This commit is contained in:
Joakim Larsson Edstrom 2017-05-04 18:09:54 +02:00
parent 7c72a2f441
commit eb0dd7370f

View File

@ -405,7 +405,7 @@ void via6522_device::shift_in()
{ {
LOGINT("SHIFT in INT request "); LOGINT("SHIFT in INT request ");
// set_int(INT_SR);// TODO: this interrupt is 1-2 clock cycles too early // set_int(INT_SR);// TODO: this interrupt is 1-2 clock cycles too early
m_shift_irq_timer->adjust(clocks_to_attotime(2)); // Delay IRQ 2 flanks for all shift INs (mode 1-3) m_shift_irq_timer->adjust(clocks_to_attotime(2)/2); // Delay IRQ 2 flanks for all shift INs (mode 1-3)
} }
} }
m_shift_counter = (m_shift_counter - 1) & 0x0f; // Count all flanks m_shift_counter = (m_shift_counter - 1) & 0x0f; // Count all flanks
@ -439,11 +439,11 @@ void via6522_device::device_timer(emu_timer &timer, device_timer_id id, int para
{ {
if (SI_O2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr)) if (SI_O2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr))
{ {
m_shift_timer->adjust(clocks_to_attotime(1)); m_shift_timer->adjust(clocks_to_attotime(1) / 2);
} }
else if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr) || SI_T2_CONTROL(m_acr)) else if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr) || SI_T2_CONTROL(m_acr))
{ {
m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2)); m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2) / 2);
} }
else // otherwise we stop it else // otherwise we stop it
{ {
@ -670,12 +670,12 @@ READ8_MEMBER( via6522_device::read )
LOGSHIFT(" - ACR: %02x ", m_acr); LOGSHIFT(" - ACR: %02x ", m_acr);
if (SI_O2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr)) if (SI_O2_CONTROL(m_acr) || SO_O2_CONTROL(m_acr))
{ {
m_shift_timer->adjust(clocks_to_attotime(8)); // 8 flanks to start shifter from a read m_shift_timer->adjust(clocks_to_attotime(8) / 2); // 8 flanks to start shifter from a read
LOGSHIFT(" - read SR starts O2 timer "); LOGSHIFT(" - read SR starts O2 timer ");
} }
else if (SI_T2_CONTROL(m_acr) || SO_T2_CONTROL(m_acr)) else if (SI_T2_CONTROL(m_acr) || SO_T2_CONTROL(m_acr))
{ {
m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2)); m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2) / 2);
LOGSHIFT(" - read SR starts T2 timer "); LOGSHIFT(" - read SR starts T2 timer ");
} }
else if (! SO_T2_RATE(m_acr)) else if (! SO_T2_RATE(m_acr))
@ -855,12 +855,12 @@ WRITE8_MEMBER( via6522_device::write )
LOGSHIFT(" - ACR is: %02x ", m_acr); LOGSHIFT(" - ACR is: %02x ", m_acr);
if (SO_O2_CONTROL(m_acr) || SI_O2_CONTROL(m_acr)) if (SO_O2_CONTROL(m_acr) || SI_O2_CONTROL(m_acr))
{ {
m_shift_timer->adjust(clocks_to_attotime(8)); // 8 flanks to start shifte from a write m_shift_timer->adjust(clocks_to_attotime(8) / 2); // 8 flanks to start shifte from a write
LOGSHIFT(" - write SR starts O2 timer"); LOGSHIFT(" - write SR starts O2 timer");
} }
else if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr) || SI_T2_CONTROL(m_acr)) else if (SO_T2_RATE(m_acr) || SO_T2_CONTROL(m_acr) || SI_T2_CONTROL(m_acr))
{ {
m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2)); m_shift_timer->adjust(clocks_to_attotime(m_t2ll + 2) / 2);
LOGSHIFT(" - write starts T2 timer"); LOGSHIFT(" - write starts T2 timer");
} }
else else