From 5bcb95dff7df0c0a8c679e22db80d6b26cb772db Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Thu, 16 Oct 2008 07:19:16 +0000 Subject: [PATCH] From: Phill Harvey-Smith [mailto:afra@aurigae.demon.co.uk] Sent: Saturday, October 11, 2008 12:01 PM To: submit@mamedev.org Subject: 6821 PIA changes Hi, Can this change be added to the 6821 pia code, it adds a function that allows the client code to get the status of CA2, taking account of the internal pull up resistor. This code only adds a function and does not change any existing code so should not have any impact on existing drivers. This change is needed for a couple of the mess drivers. Thanks. Phill. -- Phill Harvey-Smith, Programmer, Hardware hacker, and general eccentric ! --- src/emu/machine/6821pia.c | 13 +++++++++++++ src/emu/machine/6821pia.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/emu/machine/6821pia.c b/src/emu/machine/6821pia.c index e151fdf71f7..f50c3fbbf97 100644 --- a/src/emu/machine/6821pia.c +++ b/src/emu/machine/6821pia.c @@ -981,6 +981,19 @@ int pia_get_output_ca2(int which) return p->out_ca2; } +// Version of pia_get_output_ca2, which takes account of internal +// pullup resistor +int pia_get_output_ca2_z(int which) +{ + pia6821 *p = &pias[which]; + + p->out_ca2_needs_pulled = FALSE; + + // If it's an output, output the bit, if it's an input, it's + // pulled up + return p->out_ca2 | + C2_INPUT(p->ctl_a); +} /************************************* diff --git a/src/emu/machine/6821pia.h b/src/emu/machine/6821pia.h index 2d947848a74..b589210a7ef 100644 --- a/src/emu/machine/6821pia.h +++ b/src/emu/machine/6821pia.h @@ -94,6 +94,7 @@ void pia_set_input_ca1(int which, int data); int pia_get_input_ca2(int which); void pia_set_input_ca2(int which, int data); int pia_get_output_ca2(int which); +int pia_get_output_ca2_z(int which);