From b8da0e5e897aea8f7af500ca0f56c445602cd326 Mon Sep 17 00:00:00 2001 From: James Wallace Date: Wed, 17 Dec 2014 16:03:36 +0000 Subject: [PATCH] Attempt at fixing the new Stepper device to load correctly for AWP games. This is part 1 of a plan to remove the stepper_interface for a devcb2 setup. [James Wallace] --- src/emu/machine/steppers.c | 7 ++++- src/emu/machine/steppers.h | 7 ++--- src/mame/drivers/bfm_sc2.c | 53 ++++++++++++++++++++++-------------- src/mame/drivers/ecoinfr.c | 2 ++ src/mame/drivers/jpmimpct.c | 14 ++++++++++ src/mame/drivers/mpu4hw.c | 18 ++++++++++++ src/mame/includes/jpmimpct.h | 12 ++++---- src/mame/includes/mpu4.h | 34 +++++++++++------------ 8 files changed, 98 insertions(+), 49 deletions(-) diff --git a/src/emu/machine/steppers.c b/src/emu/machine/steppers.c index 35c0286ffdd..db6f5af078f 100644 --- a/src/emu/machine/steppers.c +++ b/src/emu/machine/steppers.c @@ -75,8 +75,13 @@ const stepper_interface ecoin_interface_200step_reel = 7 }; +const device_type STEPPER = &device_creator; - +stepper_device::stepper_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, STEPPER, "Stepper Motor", tag, owner, clock, "stepper", __FILE__), + m_optic_cb(*this) + { + } /////////////////////////////////////////////////////////////////////////// void stepper_device::configure(const stepper_interface *intf) { diff --git a/src/emu/machine/steppers.h b/src/emu/machine/steppers.h index 352c7198bd1..f6bc3dd9b1c 100644 --- a/src/emu/machine/steppers.h +++ b/src/emu/machine/steppers.h @@ -52,15 +52,12 @@ extern const stepper_interface ecoin_interface_200step_reel; devcb = &stepper_device::set_optic_handler(*device, DEVCB_##_write); class stepper_device; -const device_type STEPPER = &device_creator; +extern const device_type STEPPER; class stepper_device : public device_t { public: - stepper_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, STEPPER, "Stepper Motor", tag, owner, clock, "stepper", __FILE__), - m_optic_cb(*this) - { } + stepper_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); template static devcb_base &set_optic_handler(device_t &device, _Object object) { return downcast(device).m_optic_cb.set_callback(object); } diff --git a/src/mame/drivers/bfm_sc2.c b/src/mame/drivers/bfm_sc2.c index 5a9eca3e5b8..d9d4ca14985 100644 --- a/src/mame/drivers/bfm_sc2.c +++ b/src/mame/drivers/bfm_sc2.c @@ -193,13 +193,13 @@ public: m_dm01(*this, "dm01") { } required_device m_maincpu; - required_device m_reel0; - required_device m_reel1; - required_device m_reel2; - required_device m_reel3; - required_device m_reel4; - required_device m_reel5; - required_device m_upd7759; + optional_device m_reel0; + optional_device m_reel1; + optional_device m_reel2; + optional_device m_reel3; + optional_device m_reel4; + optional_device m_reel5; + optional_device m_upd7759; optional_device m_vfd0; optional_device m_vfd1; optional_device m_dm01; @@ -2164,19 +2164,6 @@ static MACHINE_CONFIG_START( scorpion2_vid, bfm_sc2_state ) MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_3_579545MHz) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - MCFG_DEVICE_ADD("reel0", STEPPER, 0) - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel0_optic_cb)) - MCFG_DEVICE_ADD("reel1", STEPPER, 0) - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel1_optic_cb)) - MCFG_DEVICE_ADD("reel2", STEPPER, 0) - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel2_optic_cb)) - MCFG_DEVICE_ADD("reel3", STEPPER, 0) - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel3_optic_cb)) - MCFG_DEVICE_ADD("reel4", STEPPER, 0) - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel4_optic_cb)) - MCFG_DEVICE_ADD("reel5", STEPPER, 0) - MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel5_optic_cb)) - MACHINE_CONFIG_END @@ -3626,6 +3613,19 @@ static MACHINE_CONFIG_START( scorpion2, bfm_sc2_state ) /* video hardware */ MCFG_DEFAULT_LAYOUT(layout_sc2_vfd) + + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel1_optic_cb)) + MCFG_DEVICE_ADD("reel2", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel3_optic_cb)) + MCFG_DEVICE_ADD("reel4", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel4_optic_cb)) + MCFG_DEVICE_ADD("reel5", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel5_optic_cb)) MACHINE_CONFIG_END @@ -3663,6 +3663,19 @@ static MACHINE_CONFIG_START( scorpion2_dm01, bfm_sc2_state ) MCFG_CPU_ADD("matrix", M6809, 2000000 ) /* matrix board 6809 CPU at 2 Mhz ?? I don't know the exact freq.*/ MCFG_CPU_PROGRAM_MAP(bfm_dm01_memmap) MCFG_CPU_PERIODIC_INT_DRIVER(bfm_sc2_state, nmi_line_assert, 1500 ) /* generate 1500 NMI's per second ?? what is the exact freq?? */ + + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel1_optic_cb)) + MCFG_DEVICE_ADD("reel2", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel3_optic_cb)) + MCFG_DEVICE_ADD("reel4", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel4_optic_cb)) + MCFG_DEVICE_ADD("reel5", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel5_optic_cb)) MACHINE_CONFIG_END void bfm_sc2_state::sc2awp_common_init(int reels, int decrypt) diff --git a/src/mame/drivers/ecoinfr.c b/src/mame/drivers/ecoinfr.c index e7d43757ec6..4094f9b4a48 100644 --- a/src/mame/drivers/ecoinfr.c +++ b/src/mame/drivers/ecoinfr.c @@ -795,6 +795,8 @@ static MACHINE_CONFIG_START( ecoinfr, ecoinfr_state ) MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel1_optic_cb)) MCFG_DEVICE_ADD("reel2", STEPPER, 0) MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel3_optic_cb)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/jpmimpct.c b/src/mame/drivers/jpmimpct.c index 293b97e5136..e9acaa0c144 100644 --- a/src/mame/drivers/jpmimpct.c +++ b/src/mame/drivers/jpmimpct.c @@ -1331,6 +1331,20 @@ MACHINE_CONFIG_START( impctawp, jpmimpct_state ) MCFG_SOUND_ADD("upd",UPD7759, UPD7759_STANDARD_CLOCK) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MCFG_DEFAULT_LAYOUT(layout_jpmimpct) + + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(jpmimpct_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(jpmimpct_state, reel1_optic_cb)) + MCFG_DEVICE_ADD("reel2", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(jpmimpct_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(jpmimpct_state, reel3_optic_cb)) + MCFG_DEVICE_ADD("reel4", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(jpmimpct_state, reel4_optic_cb)) + MCFG_DEVICE_ADD("reel5", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(jpmimpct_state, reel5_optic_cb)) + MACHINE_CONFIG_END diff --git a/src/mame/drivers/mpu4hw.c b/src/mame/drivers/mpu4hw.c index 2146d35ff02..2373500aa75 100644 --- a/src/mame/drivers/mpu4hw.c +++ b/src/mame/drivers/mpu4hw.c @@ -2615,6 +2615,24 @@ MACHINE_CONFIG_FRAGMENT( mpu4_common ) MCFG_PIA_CB2_HANDLER(WRITELINE(mpu4_state, pia_ic8_cb2_w)) MCFG_PIA_IRQA_HANDLER(WRITELINE(mpu4_state, cpu0_irq)) MCFG_PIA_IRQB_HANDLER(WRITELINE(mpu4_state, cpu0_irq)) + + + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel1_optic_cb)) + MCFG_DEVICE_ADD("reel2", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel3_optic_cb)) + MCFG_DEVICE_ADD("reel4", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel4_optic_cb)) + MCFG_DEVICE_ADD("reel5", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel5_optic_cb)) + MCFG_DEVICE_ADD("reel6", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel6_optic_cb)) + MCFG_DEVICE_ADD("reel7", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu4_state, reel7_optic_cb)) MACHINE_CONFIG_END MACHINE_CONFIG_FRAGMENT( mpu4_common2 ) diff --git a/src/mame/includes/jpmimpct.h b/src/mame/includes/jpmimpct.h index 6058a9293d0..82c1ededcde 100644 --- a/src/mame/includes/jpmimpct.h +++ b/src/mame/includes/jpmimpct.h @@ -137,10 +137,10 @@ public: required_device m_upd7759; optional_device m_palette; optional_device m_dsp; - required_device m_reel0; - required_device m_reel1; - required_device m_reel2; - required_device m_reel3; - required_device m_reel4; - required_device m_reel5; + optional_device m_reel0; + optional_device m_reel1; + optional_device m_reel2; + optional_device m_reel3; + optional_device m_reel4; + optional_device m_reel5; }; diff --git a/src/mame/includes/mpu4.h b/src/mame/includes/mpu4.h index fa31e3ddd4c..2bec0693d7f 100644 --- a/src/mame/includes/mpu4.h +++ b/src/mame/includes/mpu4.h @@ -212,7 +212,14 @@ public: DECLARE_MACHINE_START(mpu4bwb); DECLARE_MACHINE_START(mpu4cry); TIMER_DEVICE_CALLBACK_MEMBER(gen_50hz); - + DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } + DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } + DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } + DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } + DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; } + DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; } + DECLARE_WRITE_LINE_MEMBER(reel6_optic_cb) { if (state) m_optic_pattern |= 0x40; else m_optic_pattern &= ~0x40; } + DECLARE_WRITE_LINE_MEMBER(reel7_optic_cb) { if (state) m_optic_pattern |= 0x80; else m_optic_pattern &= ~0x80; } protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); @@ -249,14 +256,14 @@ protected: required_ioport m_aux2_port; optional_memory_bank m_bank1; optional_device m_msm6376; - required_device m_reel0; - required_device m_reel1; - required_device m_reel2; - required_device m_reel3; - required_device m_reel4; - required_device m_reel5; - required_device m_reel6; - required_device m_reel7; + optional_device m_reel0; + optional_device m_reel1; + optional_device m_reel2; + optional_device m_reel3; + optional_device m_reel4; + optional_device m_reel5; + optional_device m_reel6; + optional_device m_reel7; enum { @@ -295,14 +302,7 @@ protected: UINT8 m_led_strobe; UINT8 m_ay_data; int m_optic_pattern; - DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; } - DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; } - DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; } - DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; } - DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; } - DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; } - DECLARE_WRITE_LINE_MEMBER(reel6_optic_cb) { if (state) m_optic_pattern |= 0x40; else m_optic_pattern &= ~0x40; } - DECLARE_WRITE_LINE_MEMBER(reel7_optic_cb) { if (state) m_optic_pattern |= 0x80; else m_optic_pattern &= ~0x80; } + int m_active_reel; int m_remote_meter; int m_reel_mux;