diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index 41c81e696..1855df380 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -1906,6 +1906,13 @@ strobe(uint8_t old, uint8_t val, void *priv) /* Process incoming character. */ handle_char(dev, dev->data); + if (timer_is_enabled(&dev->timeout_timer)) { + timer_disable(&dev->timeout_timer); +#ifdef USE_DYNAREC + if (cpu_use_dynarec) + update_tsc(); +#endif + } /* ACK it, will be read on next READ STATUS. */ dev->ack = 1; timer_set_delay_u64(&dev->pulse_timer, ISACONST); @@ -1940,6 +1947,13 @@ write_ctrl(uint8_t val, void *priv) /* Process incoming character. */ handle_char(dev, dev->data); + if (timer_is_enabled(&dev->timeout_timer)) { + timer_disable(&dev->timeout_timer); +#ifdef USE_DYNAREC + if (cpu_use_dynarec) + update_tsc(); +#endif + } /* ACK it, will be read on next READ STATUS. */ dev->ack = 1; timer_set_delay_u64(&dev->pulse_timer, ISACONST); diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index 904ff34ad..b8f3b20b9 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -34,6 +34,7 @@ #include <86box/plat_dynld.h> #include <86box/ui.h> #include <86box/prt_devs.h> +#include "cpu.h" #ifdef _WIN32 # define GSDLLAPI __stdcall @@ -341,6 +342,14 @@ ps_strobe(uint8_t old, uint8_t val, void *priv) if (!(val & 0x01) && (old & 0x01)) { process_data(dev); + if (timer_is_enabled(&dev->timeout_timer)) { + timer_disable(&dev->timeout_timer); +#ifdef USE_DYNAREC + if (cpu_use_dynarec) + update_tsc(); +#endif + } + dev->ack = true; timer_set_delay_u64(&dev->pulse_timer, ISACONST); @@ -371,6 +380,14 @@ ps_write_ctrl(uint8_t val, void *priv) if (!(val & 0x01) && (dev->ctrl & 0x01)) { process_data(dev); + if (timer_is_enabled(&dev->timeout_timer)) { + timer_disable(&dev->timeout_timer); +#ifdef USE_DYNAREC + if (cpu_use_dynarec) + update_tsc(); +#endif + } + dev->ack = true; timer_set_delay_u64(&dev->pulse_timer, ISACONST); diff --git a/src/printer/prt_text.c b/src/printer/prt_text.c index 7604d023e..3acccf830 100644 --- a/src/printer/prt_text.c +++ b/src/printer/prt_text.c @@ -63,6 +63,7 @@ #include <86box/lpt.h> #include <86box/printer.h> #include <86box/prt_devs.h> +#include "cpu.h" #define FULL_PAGE 1 /* set if no top/bot margins */ @@ -391,6 +392,14 @@ strobe(uint8_t old, uint8_t val, void *priv) /* Process incoming character. */ handle_char(dev); + if (timer_is_enabled(&dev->timeout_timer)) { + timer_disable(&dev->timeout_timer); +#ifdef USE_DYNAREC + if (cpu_use_dynarec) + update_tsc(); +#endif + } + /* ACK it, will be read on next READ STATUS. */ dev->ack = 1; @@ -429,6 +438,14 @@ write_ctrl(uint8_t val, void *priv) /* ACK it, will be read on next READ STATUS. */ dev->ack = 1; + if (timer_is_enabled(&dev->timeout_timer)) { + timer_disable(&dev->timeout_timer); +#ifdef USE_DYNAREC + if (cpu_use_dynarec) + update_tsc(); +#endif + } + timer_set_delay_u64(&dev->pulse_timer, ISACONST); timer_set_delay_u64(&dev->timeout_timer, 5000000 * TIMER_USEC); }