summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/cxg_ch2001.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/cxg_ch2001.cpp')
-rw-r--r--src/mame/drivers/cxg_ch2001.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/mame/drivers/cxg_ch2001.cpp b/src/mame/drivers/cxg_ch2001.cpp
index e7de8598941..b0da63f1c0d 100644
--- a/src/mame/drivers/cxg_ch2001.cpp
+++ b/src/mame/drivers/cxg_ch2001.cpp
@@ -3,7 +3,7 @@
// thanks-to:Berger
/******************************************************************************
*
-* cxg_ch2001.cpp, subdriver of cxgbase.cpp
+* cxg_ch2001.cpp, subdriver of machine/chessbase.cpp
*******************************************************************************
@@ -15,9 +15,10 @@ Chess 2001:
******************************************************************************/
#include "emu.h"
-#include "includes/cxgbase.h"
+#include "includes/chessbase.h"
#include "cpu/z80/z80.h"
+#include "sound/dac.h"
#include "sound/volt_reg.h"
#include "speaker.h"
@@ -27,11 +28,14 @@ Chess 2001:
namespace {
-class ch2001_state : public cxgbase_state
+class ch2001_state : public chessbase_state
{
public:
ch2001_state(const machine_config &mconfig, device_type type, const char *tag) :
- cxgbase_state(mconfig, type, tag),
+ chessbase_state(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_irq_on(*this, "irq_on"),
+ m_dac(*this, "dac"),
m_speaker_off(*this, "speaker_off")
{ }
@@ -40,13 +44,20 @@ public:
private:
// devices/pointers
+ required_device<cpu_device> m_maincpu;
+ required_device<timer_device> m_irq_on;
+ required_device<dac_bit_interface> m_dac;
required_device<timer_device> m_speaker_off;
- // address maps
- void main_map(address_map &map);
+ // periodic interrupts
+ template<int Line> TIMER_DEVICE_CALLBACK_MEMBER(irq_on) { m_maincpu->set_input_line(Line, ASSERT_LINE); }
+ template<int Line> TIMER_DEVICE_CALLBACK_MEMBER(irq_off) { m_maincpu->set_input_line(Line, CLEAR_LINE); }
TIMER_DEVICE_CALLBACK_MEMBER(speaker_off) { m_dac->write(0); }
+ // address maps
+ void main_map(address_map &map);
+
// I/O handlers
DECLARE_WRITE8_MEMBER(speaker_w);
DECLARE_WRITE8_MEMBER(leds_w);
@@ -108,7 +119,7 @@ void ch2001_state::main_map(address_map &map)
******************************************************************************/
static INPUT_PORTS_START( ch2001 )
- PORT_INCLUDE( cxg_cb_magnets )
+ PORT_INCLUDE( generic_cb_magnets )
PORT_START("IN.8")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Black")
@@ -150,7 +161,7 @@ void ch2001_state::ch2001(machine_config &config)
TIMER(config, m_speaker_off).configure_generic(FUNC(ch2001_state::speaker_off));
- TIMER(config, "display_decay").configure_periodic(FUNC(cxgbase_state::display_decay_tick), attotime::from_msec(1));
+ TIMER(config, "display_decay").configure_periodic(FUNC(ch2001_state::display_decay_tick), attotime::from_msec(1));
config.set_default_layout(layout_cxg_ch2001);
/* sound hardware */