diff options
Diffstat (limited to 'src/mame/drivers/mpu3.c')
-rw-r--r-- | src/mame/drivers/mpu3.c | 78 |
1 files changed, 36 insertions, 42 deletions
diff --git a/src/mame/drivers/mpu3.c b/src/mame/drivers/mpu3.c index 656a312d809..befef70f639 100644 --- a/src/mame/drivers/mpu3.c +++ b/src/mame/drivers/mpu3.c @@ -132,7 +132,12 @@ public: mpu3_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_vfd(*this, "vfd"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_reel0(*this, "reel0"), + m_reel1(*this, "reel1"), + m_reel2(*this, "reel2"), + m_reel3(*this, "reel3") + { } optional_device<roc10937_t> m_vfd; @@ -165,6 +170,11 @@ int m_prot_col; 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; } + emu_timer *m_ic21_timer; DECLARE_WRITE8_MEMBER(characteriser_w); DECLARE_READ8_MEMBER(characteriser_r); @@ -198,12 +208,15 @@ emu_timer *m_ic21_timer; TIMER_DEVICE_CALLBACK_MEMBER(gen_50hz); TIMER_DEVICE_CALLBACK_MEMBER(ic10_callback); void update_triacs(); - void mpu3_stepper_reset(); void ic11_update(); void ic21_output(int data); void ic21_setup(); void mpu3_config_common(); required_device<cpu_device> m_maincpu; + required_device<stepper_device> m_reel0; + required_device<stepper_device> m_reel1; + required_device<stepper_device> m_reel2; + required_device<stepper_device> m_reel3; }; #define DISPLAY_PORT 0 @@ -224,23 +237,10 @@ void mpu3_state::update_triacs() } /* called if board is reset */ -void mpu3_state::mpu3_stepper_reset() -{ - int pattern = 0,reel; - for (reel = 0; reel < 6; reel++) - { - stepper_reset_position(reel); - if (stepper_optic_state(reel)) pattern |= 1<<reel; - } - m_optic_pattern = pattern; -} - void mpu3_state::machine_reset() { m_vfd->reset(); - mpu3_stepper_reset(); - m_lamp_strobe = 0; m_led_strobe = 0; @@ -509,29 +509,14 @@ WRITE_LINE_MEMBER(mpu3_state::pia_ic4_cb2_w) WRITE8_MEMBER(mpu3_state::pia_ic5_porta_w) { LOG(("%s: IC5 PIA Port A Set to %2x (Reel)\n", machine().describe_context(),data)); - stepper_update(0, data & 0x03 ); - stepper_update(1, (data>>2) & 0x03 ); - stepper_update(2, (data>>4) & 0x03 ); - stepper_update(3, (data>>6) & 0x03 ); - awp_draw_reel(0); - awp_draw_reel(1); - awp_draw_reel(2); - awp_draw_reel(3); - - { - if ( stepper_optic_state(0) ) m_optic_pattern |= 0x01; - else m_optic_pattern &= ~0x01; - - if ( stepper_optic_state(1) ) m_optic_pattern |= 0x02; - else m_optic_pattern &= ~0x02; - if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; - else m_optic_pattern &= ~0x04; - - if ( stepper_optic_state(3) ) m_optic_pattern |= 0x08; - else m_optic_pattern &= ~0x08; - - } - + m_reel0->update( data & 0x03); + m_reel1->update((data>>2) & 0x03); + m_reel2->update((data>>4) & 0x03); + m_reel3->update((data>>6) & 0x03); + awp_draw_reel(0, m_reel0); + awp_draw_reel(1, m_reel1); + awp_draw_reel(2, m_reel2); + awp_draw_reel(3, m_reel3); } READ8_MEMBER(mpu3_state::pia_ic5_portb_r) @@ -723,10 +708,10 @@ void mpu3_state::machine_start() MechMtr_config(machine(),8); /* setup 4 reels */ - stepper_config(machine(), 0, &mpu3_reel_interface); - stepper_config(machine(), 1, &mpu3_reel_interface); - stepper_config(machine(), 2, &mpu3_reel_interface); - stepper_config(machine(), 3, &mpu3_reel_interface); + m_reel0->configure(&mpu3_reel_interface); + m_reel1->configure(&mpu3_reel_interface); + m_reel2->configure(&mpu3_reel_interface); + m_reel3->configure(&mpu3_reel_interface); } /* @@ -871,6 +856,15 @@ static MACHINE_CONFIG_START( mpu3base, mpu3_state ) MCFG_PIA_IRQA_HANDLER(WRITELINE(mpu3_state, cpu0_irq)) MCFG_PIA_IRQB_HANDLER(WRITELINE(mpu3_state, cpu0_irq)) + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel1_optic_cb)) + MCFG_DEVICE_ADD("reel2", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel3_optic_cb)) + MCFG_NVRAM_ADD_0FILL("nvram") MCFG_DEFAULT_LAYOUT(layout_mpu3) |