From 3d278b344f6495ca91c6f3e949a697d59e345d9c Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 15 May 2020 07:24:43 +0200 Subject: [PATCH] Some PPI changes, should make the PPI behave consistently on hard reset. --- src/cpu_common/808x.c | 5 ++++- src/keyboard_at.c | 2 +- src/ppi.c | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/cpu_common/808x.c b/src/cpu_common/808x.c index ca2b80979..6bc896753 100644 --- a/src/cpu_common/808x.c +++ b/src/cpu_common/808x.c @@ -34,6 +34,7 @@ #include <86box/rom.h> #include <86box/nmi.h> #include <86box/pic.h> +#include <86box/ppi.h> #include <86box/timer.h> /* The opcode of the instruction currently being executed. */ @@ -978,8 +979,10 @@ reset_common(int hard) in_smm = smi_latched = 0; smi_line = smm_in_hlt = 0; - if (hard) + if (hard) { smbase = 0x00030000; + ppi_reset(); + } in_sys = 0; } diff --git a/src/keyboard_at.c b/src/keyboard_at.c index dc2a01378..744af2365 100644 --- a/src/keyboard_at.c +++ b/src/keyboard_at.c @@ -2039,7 +2039,7 @@ do_command: break; case 0x61: - ppi.pb = val; + ppi.pb = (ppi.pb & 0x10) | (val & 0x0f); speaker_update(); speaker_gated = val & 1; diff --git a/src/ppi.c b/src/ppi.c index d9eb03cb3..c70d01ece 100644 --- a/src/ppi.c +++ b/src/ppi.c @@ -20,8 +20,8 @@ PPI ppi; int ppispeakon; -void ppi_reset(void) +void +ppi_reset(void) { - ppi.pa=0x0; - ppi.pb=0x40; + memset(&ppi, 0x00, sizeof(PPI)); }