From eff0d4dea8727fe4d290a84a6a6986e543b11802 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 4 Aug 2020 04:18:39 +0200 Subject: [PATCH] The PIT now decreases the latched count by 1 if the counter's count is latched when the count is set to a new mode, fixes Mortal Kombat 1 for DOS hanging when attempting to play music on the OPL. --- src/pit.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pit.c b/src/pit.c index 9e140650d..9311dbe6e 100644 --- a/src/pit.c +++ b/src/pit.c @@ -567,6 +567,11 @@ pit_write(uint16_t addr, uint8_t val, void *priv) ctr->null_count = 1; ctr_set_out(ctr, !!ctr->m); ctr->state = 0; + if (ctr->latched) { + pit_log("PIT %i: Reload while counter is latched\n", t); + ctr->rl--; + } + pit_log("PIT %i: M = %i, RM/WM = %i, State = %i, Out = %i\n", t, ctr->m, ctr->rm, ctr->state, ctr->out); } }