z8: Split sio_tick into two functions (nw)

This commit is contained in:
AJR 2019-01-21 16:49:51 -05:00
parent fb8254d751
commit 2e6e2d33d6
2 changed files with 30 additions and 23 deletions

View File

@ -481,7 +481,7 @@ bool z8_device::get_serial_in()
return (m_input[3] & Z8_P3_SIN) != 0; return (m_input[3] & Z8_P3_SIN) != 0;
} }
void z8_device::sio_tick() void z8_device::sio_receive()
{ {
if (m_receive_started) if (m_receive_started)
{ {
@ -548,9 +548,13 @@ void z8_device::sio_tick()
m_receive_count = 0; m_receive_count = 0;
} }
} }
}
if (m_transmit_sr != 0) void z8_device::sio_transmit()
{ {
if (m_transmit_sr == 0)
return;
m_transmit_count = (m_transmit_count + 1) & 15; m_transmit_count = (m_transmit_count + 1) & 15;
if (m_transmit_count == 0) if (m_transmit_count == 0)
{ {
@ -575,7 +579,6 @@ void z8_device::sio_tick()
} }
} }
} }
}
uint8_t z8_device::sio_read() uint8_t z8_device::sio_read()
{ {
@ -622,7 +625,10 @@ void z8_device::timer_end()
tout_toggle(); tout_toggle();
if (T == 0 && (m_p3m & Z8_P3M_P3_SERIAL) != 0) if (T == 0 && (m_p3m & Z8_P3M_P3_SERIAL) != 0)
sio_tick(); {
sio_receive();
sio_transmit();
}
else else
request_interrupt(4 + T); request_interrupt(4 + T);

View File

@ -138,7 +138,8 @@ private:
emu_timer *m_internal_timer[2]; emu_timer *m_internal_timer[2];
bool get_serial_in(); bool get_serial_in();
void sio_tick(); void sio_receive();
void sio_transmit();
template <int T> void timer_start(); template <int T> void timer_start();
template <int T> void timer_stop(); template <int T> void timer_stop();