From 8db81776242323ccecd1cbeda00a1782b06c0d43 Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 13 Feb 2017 02:41:48 +0100 Subject: [PATCH] pic16c5x: changed rtcc pin to inputline (nw) --- src/devices/cpu/pic16c5x/pic16c5x.cpp | 21 +++++++++++++-------- src/devices/cpu/pic16c5x/pic16c5x.h | 8 ++++++-- src/mame/drivers/hh_pic16.cpp | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/devices/cpu/pic16c5x/pic16c5x.cpp b/src/devices/cpu/pic16c5x/pic16c5x.cpp index 49f7216eea5..0873a255c2f 100644 --- a/src/devices/cpu/pic16c5x/pic16c5x.cpp +++ b/src/devices/cpu/pic16c5x/pic16c5x.cpp @@ -50,7 +50,7 @@ * Fixes the case where the status register is the destination. * * hap (12-Feb-2017) Ver 1.16 * * - Added basic support for the old GI PIC1650 and PIC1655. * - * - Made RTCC(aka T0CKI) pin a writeline handler. * + * - Made RTCC(aka T0CKI) pin an inputline handler. * * * * * * **** Notes: **** * @@ -1128,16 +1128,21 @@ void pic16c5x_device::pic16c5x_update_timer(int counts) } } -WRITE_LINE_MEMBER(pic16c5x_device::write_rtcc) +void pic16c5x_device::execute_set_input(int line, int state) { - state = (state) ? 1 : 0; + switch (line) + { + case PIC16C5x_RTCC: + if (T0CS && state != m_rtcc) /* Count mode, edge triggered */ + if ((T0SE && !state) || (!T0SE && state)) + m_count_pending = true; - /* Count mode, edge triggered */ - if (T0CS && state != m_rtcc) - if ((T0SE && !state) || (!T0SE && state)) - m_count_pending = true; + m_rtcc = state; + break; - m_rtcc = state; + default: + break; + } } diff --git a/src/devices/cpu/pic16c5x/pic16c5x.h b/src/devices/cpu/pic16c5x/pic16c5x.h index a2d3b8bfeac..4eb9309923b 100644 --- a/src/devices/cpu/pic16c5x/pic16c5x.h +++ b/src/devices/cpu/pic16c5x/pic16c5x.h @@ -16,6 +16,11 @@ #ifndef __PIC16C5X_H__ #define __PIC16C5X_H__ +// input lines +enum +{ + PIC16C5x_RTCC = 0 +}; // i/o ports enum @@ -83,8 +88,6 @@ public: template static devcb_base &set_write_c_callback(device_t &device, _Object object) { return downcast(device).m_write_c.set_callback(object); } template static devcb_base &set_write_d_callback(device_t &device, _Object object) { return downcast(device).m_write_d.set_callback(object); } - DECLARE_WRITE_LINE_MEMBER(write_rtcc); // RTCC pin - /**************************************************************************** * Function to configure the CONFIG register. This is actually hard-wired * during ROM programming, so should be called in the driver INIT, with @@ -115,6 +118,7 @@ protected: virtual uint32_t execute_input_lines() const override { return 1; } virtual uint32_t execute_default_irq_vector() const override { return 0; } virtual void execute_run() override; + virtual void execute_set_input(int line, int state) override; // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override diff --git a/src/mame/drivers/hh_pic16.cpp b/src/mame/drivers/hh_pic16.cpp index 8b5d16eead8..9fe801af38b 100644 --- a/src/mame/drivers/hh_pic16.cpp +++ b/src/mame/drivers/hh_pic16.cpp @@ -356,7 +356,7 @@ static MACHINE_CONFIG_START( touchme, touchme_state ) MCFG_PIC16C5x_WRITE_C_CB(WRITE8(touchme_state, write_c)) MCFG_DEVICE_ADD("clock", CLOCK, 300000/4) // PIC CLKOUT, tied to RTCC - MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("maincpu", pic1655_device, write_rtcc)) + MCFG_CLOCK_SIGNAL_HANDLER(INPUTLINE("maincpu", PIC16C5x_RTCC)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_pic16_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_touchme)