From f9c2f04a52a52db5c009acfde133d5a8a30dc0ef Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 28 Nov 2020 07:02:38 +0100 Subject: [PATCH] 808x fixes - 8088mph works normally again. --- src/cpu/808x.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/cpu/808x.c b/src/cpu/808x.c index 4932b9494..72a66703f 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -279,7 +279,7 @@ resub_cycles(int old_cycles) if (old_cycles > cycles) { cyc_diff = old_cycles - cycles; cycles = old_cycles; - resub_cycles(cyc_diff); + sub_cycles(cyc_diff); } } @@ -298,27 +298,35 @@ cpu_io(int bits, int out, uint16_t port) if (out) { wait(4, 1); if (bits == 16) { - if (is8086 && !(port & 1)) + if (is8086 && !(port & 1)) { + old_cycles = cycles; outw(port, AX); - else { + } else { wait(4, 1); + old_cycles = cycles; outb(port++, AL); outb(port, AH); } - } else + } else { + old_cycles = cycles; outb(port, AL); + } } else { wait(4, 1); if (bits == 16) { - if (is8086 && !(port & 1)) + if (is8086 && !(port & 1)) { + old_cycles = cycles; AX = inw(port); - else { + } else { wait(4, 1); + old_cycles = cycles; AL = inb(port++); AH = inb(port); } - } else + } else { + old_cycles = cycles; AL = inb(port); + } } resub_cycles(old_cycles);