diff --git a/src/pit_fast.c b/src/pit_fast.c index 20633de80..4eb9314f7 100644 --- a/src/pit_fast.c +++ b/src/pit_fast.c @@ -404,6 +404,8 @@ pitf_write(uint16_t addr, uint8_t val, void *priv) pit_log("[%04X:%08X] pit_write(%04X, %02X, %08X)\n", CS, cpu_state.pc, addr, val, priv); + cycles -= ISA_CYCLES(8); + switch (addr & 3) { case 3: /* control */ t = val >> 6; @@ -470,15 +472,18 @@ pitf_write(uint16_t addr, uint8_t val, void *priv) switch (ctr->wm) { case 1: ctr->l = val; + if (t == 1) pclog("Timer 1 counter set to: %08X\n", ctr->l); pitf_ctr_load(ctr); break; case 2: ctr->l = (val << 8); + if (t == 1) pclog("Timer 1 counter set to: %08X\n", ctr->l); pitf_ctr_load(ctr); break; case 0: ctr->l &= 0xFF; ctr->l |= (val << 8); + if (t == 1) pclog("Timer 1 counter set to: %08X\n", ctr->l); pitf_ctr_load(ctr); ctr->wm = 3; break; @@ -541,6 +546,8 @@ pitf_read(uint16_t addr, void *priv) int t = (addr & 3); ctrf_t *ctr; + cycles -= ISA_CYCLES(8); + switch (addr & 3) { case 3: /* Control. */ /* This is 8254-only, 8253 returns 0x00. */ diff --git a/src/port_6x.c b/src/port_6x.c index 340d6df2b..750b9678c 100644 --- a/src/port_6x.c +++ b/src/port_6x.c @@ -37,6 +37,7 @@ #include <86box/video.h> #include <86box/port_6x.h> #include <86box/plat_unused.h> +#include <86box/random.h> #define PS2_REFRESH_TIME (16 * TIMER_USEC) @@ -52,6 +53,8 @@ port_6x_write(uint16_t port, uint8_t val, void *priv) port &= 3; + cycles -= ISA_CYCLES(8); + if ((port == 3) && (dev->flags & PORT_6X_MIRROR)) port = 1; @@ -80,6 +83,8 @@ port_61_read_simple(UNUSED(uint16_t port), UNUSED(void *priv)) { uint8_t ret = ppi.pb & 0x1f; + cycles -= ISA_CYCLES(8); + if (ppispeakon) ret |= 0x20; @@ -92,6 +97,8 @@ port_61_read(UNUSED(uint16_t port), void *priv) const port_6x_t *dev = (port_6x_t *) priv; uint8_t ret = 0xff; + cycles -= ISA_CYCLES(8); + if (dev->flags & PORT_6X_EXT_REF) { ret = ppi.pb & 0x0f;