summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/ecoinf3.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/ecoinf3.c')
-rw-r--r--src/mame/drivers/ecoinf3.c58
1 files changed, 35 insertions, 23 deletions
diff --git a/src/mame/drivers/ecoinf3.c b/src/mame/drivers/ecoinf3.c
index 00df2922006..94e89172bc2 100644
--- a/src/mame/drivers/ecoinf3.c
+++ b/src/mame/drivers/ecoinf3.c
@@ -23,7 +23,11 @@ class ecoinf3_state : public driver_device
public:
ecoinf3_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu")
+ m_maincpu(*this, "maincpu"),
+ m_reel0(*this, "reel0"),
+ m_reel1(*this, "reel1"),
+ m_reel2(*this, "reel2"),
+ m_reel3(*this, "reel3")
{
strobe_amount = 0;
strobe_addr = 0;
@@ -31,6 +35,10 @@ public:
}
required_device<z180_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;
UINT16 m_lamps[16];
UINT16 m_chars[14];
@@ -39,6 +47,11 @@ public:
int strobe_addr;
int strobe_amount;
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; }
+
int m_percent_mux;
DECLARE_READ8_MEMBER(ppi8255_intf_a_read_a) { int ret = 0x00; logerror("%04x - ppi8255_intf_a_read_a %02x\n", m_maincpu->pcbase(), ret); return ret; }
@@ -211,32 +224,22 @@ public:
DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_a_reel01)
{
// logerror("%04x - ppi8255_intf_d_(used)write_a %02x\n", m_maincpu->pcbase(), data);
- stepper_update(0, data&0x0f);
- stepper_update(1, (data>>4)&0x0f);
-
- if ( stepper_optic_state(0) ) m_optic_pattern |= 0x10;
- else m_optic_pattern &= ~0x10;
- if ( stepper_optic_state(1) ) m_optic_pattern |= 0x20;
- else m_optic_pattern &= ~0x20;
+ m_reel0->update( data &0x0f);
+ m_reel1->update((data>>4)&0x0f);
- awp_draw_reel(0);
- awp_draw_reel(1);
+ awp_draw_reel(0, m_reel0);
+ awp_draw_reel(1, m_reel1);
}
DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_b_reel23)
{
// logerror("%04x - ppi8255_intf_d_(used)write_b %02x\n", m_maincpu->pcbase(), data);
- stepper_update(2, data&0x0f);
- stepper_update(3, (data>>4)&0x0f);
-
- if ( stepper_optic_state(2) ) m_optic_pattern |= 0x40;
- else m_optic_pattern &= ~0x40;
- if ( stepper_optic_state(3) ) m_optic_pattern |= 0x80;
- else m_optic_pattern &= ~0x80;
+ m_reel2->update( data &0x0f);
+ m_reel3->update((data>>4)&0x0f);
- awp_draw_reel(2);
- awp_draw_reel(3);
+ awp_draw_reel(2, m_reel2);
+ awp_draw_reel(3, m_reel3);
}
DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_c) { logerror("%04x - ppi8255_intf_d_(used)write_c %02x\n", m_maincpu->pcbase(), data);}
@@ -654,10 +657,10 @@ INPUT_PORTS_END
MACHINE_START_MEMBER(ecoinf3_state,ecoinf3)
{
- for ( int n = 0; n < 4; n++ )
- {
- stepper_config(machine(), n, &ecoin_interface_200step_reel);
- }
+ m_reel0->configure(&ecoin_interface_200step_reel);
+ m_reel1->configure(&ecoin_interface_200step_reel);
+ m_reel2->configure(&ecoin_interface_200step_reel);
+ m_reel3->configure(&ecoin_interface_200step_reel);
}
static MACHINE_CONFIG_START( ecoinf3_pyramid, ecoinf3_state )
@@ -740,6 +743,15 @@ static MACHINE_CONFIG_START( ecoinf3_pyramid, ecoinf3_state )
MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf3_state, ppi8255_intf_h_write_b))
MCFG_I8255_IN_PORTC_CB(READ8(ecoinf3_state, ppi8255_intf_h_read_c))
MCFG_I8255_OUT_PORTC_CB(WRITE8(ecoinf3_state, ppi8255_intf_h_write_c))
+
+ MCFG_DEVICE_ADD("reel0", STEPPER, 0)
+ MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel0_optic_cb))
+ MCFG_DEVICE_ADD("reel1", STEPPER, 0)
+ MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel1_optic_cb))
+ MCFG_DEVICE_ADD("reel2", STEPPER, 0)
+ MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel2_optic_cb))
+ MCFG_DEVICE_ADD("reel3", STEPPER, 0)
+ MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel3_optic_cb))
MACHINE_CONFIG_END