diff --git a/src/emu/bus/centronics/epson_lx810l.c b/src/emu/bus/centronics/epson_lx810l.c index 94b24fc3f46..7e9cb6b7f9b 100644 --- a/src/emu/bus/centronics/epson_lx810l.c +++ b/src/emu/bus/centronics/epson_lx810l.c @@ -160,6 +160,10 @@ static MACHINE_CONFIG_FRAGMENT( epson_lx810l ) /* 256-bit eeprom */ MCFG_EEPROM_SERIAL_93C06_ADD("eeprom") + + /* steppers */ + MCFG_DEVICE_ADD("pf_stepper", STEPPER, 0) + MCFG_DEVICE_ADD("cr_stepper", STEPPER, 0) MACHINE_CONFIG_END //------------------------------------------------- @@ -278,6 +282,8 @@ epson_lx810l_t::epson_lx810l_t(const machine_config &mconfig, const char *tag, d device_t(mconfig, EPSON_LX810L, "Epson LX-810L", tag, owner, clock, "lx810l", __FILE__), device_centronics_peripheral_interface(mconfig, *this), m_maincpu(*this, "maincpu"), + m_pf_stepper(*this, "pf_stepper"), + m_cr_stepper(*this, "cr_stepper"), m_eeprom(*this, "eeprom"), m_speaker(*this, "speaker"), m_e05a30(*this, "e05a30"), @@ -296,6 +302,8 @@ epson_lx810l_t::epson_lx810l_t(const machine_config &mconfig, device_type type, device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__), device_centronics_peripheral_interface(mconfig, *this), m_maincpu(*this, "maincpu"), + m_pf_stepper(*this, "pf_stepper"), + m_cr_stepper(*this, "cr_stepper"), m_eeprom(*this, "eeprom"), m_speaker(*this, "speaker"), m_e05a30(*this, "e05a30"), @@ -339,8 +347,8 @@ static const stepper_interface lx810l_cr_stepper = void epson_lx810l_t::device_start() { - stepper_config(machine(), 0, &lx810l_pf_stepper); - stepper_config(machine(), 1, &lx810l_cr_stepper); + m_pf_stepper->configure(&lx810l_pf_stepper); + m_cr_stepper->configure(&lx810l_cr_stepper); } @@ -515,8 +523,8 @@ WRITE16_MEMBER( epson_lx810l_t::printhead ) WRITE8_MEMBER( epson_lx810l_t::pf_stepper ) { - stepper_update(0, data); - m_pf_pos_abs = 200 - stepper_get_absolute_position(0); + m_pf_stepper->update(data); + m_pf_pos_abs = 200 - m_pf_stepper->get_absolute_position(); LX810LLOG("%s: %s(%02x); abs %d\n", machine().describe_context(), __func__, data, m_pf_pos_abs); } @@ -525,8 +533,8 @@ WRITE8_MEMBER( epson_lx810l_t::cr_stepper ) { int m_cr_pos_abs_prev = m_cr_pos_abs; - stepper_update(1, data); - m_cr_pos_abs = 200 - stepper_get_absolute_position(1); + m_cr_stepper->update(data); + m_cr_pos_abs = 200 - m_cr_stepper->get_absolute_position(); if (m_cr_pos_abs > m_cr_pos_abs_prev) { /* going right */ diff --git a/src/emu/bus/centronics/epson_lx810l.h b/src/emu/bus/centronics/epson_lx810l.h index f136af737e1..5e35378ce2e 100644 --- a/src/emu/bus/centronics/epson_lx810l.h +++ b/src/emu/bus/centronics/epson_lx810l.h @@ -100,6 +100,8 @@ protected: private: required_device m_maincpu; + required_device m_pf_stepper; + required_device m_cr_stepper; required_device m_eeprom; required_device m_speaker; required_device m_e05a30; diff --git a/src/emu/machine/steppers.c b/src/emu/machine/steppers.c index 70dfe688d92..35c0286ffdd 100644 --- a/src/emu/machine/steppers.c +++ b/src/emu/machine/steppers.c @@ -28,8 +28,6 @@ // 05-03-2004: Re-Animator // // // // TODO: add further types of stepper motors if needed (Konami/IGT?) // -// Someone who understands the device system may want to convert // -// this // // 200 Step reels can alter their relative opto tab position, // // may be worth adding the phase setting to the interface // // There are reports that some games use a pulse that is too short// @@ -41,34 +39,6 @@ #include "emu.h" #include "steppers.h" -/* local prototypes */ - -static void update_optic(int which); - -/* local vars */ - -struct stepper -{ - const stepper_interface *intf; - UINT8 pattern, /* coil pattern */ - old_pattern, /* old coil pattern */ - initphase, - phase, /* motor phase */ - old_phase, /* old phase */ - type; /* reel type */ - INT16 step_pos, /* step position 0 - max_steps */ - max_steps; /* maximum step position */ - INT32 abs_step_pos; /* absolute step position */ - - INT16 index_start, /* start position of index (in half steps) */ - index_end, /* end position of index (in half steps) */ - index_patt; /* pattern needed on coils (0=don't care) */ - - UINT8 optic; -}; - -static stepper step[MAX_STEPPERS]; - /* useful interfaces (Starpoint is a very common setup)*/ const stepper_interface starpoint_interface_48step = { @@ -108,148 +78,123 @@ const stepper_interface ecoin_interface_200step_reel = /////////////////////////////////////////////////////////////////////////// -void stepper_config(running_machine &machine, int which, const stepper_interface *intf) +void stepper_device::configure(const stepper_interface *intf) { - assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call stepper_config at init time!"); - assert_always((which >= 0) && (which < MAX_STEPPERS), "stepper_config called on an invalid stepper motor!"); - assert_always(intf, "stepper_config called with an invalid interface!"); + assert_always(machine().phase() == MACHINE_PHASE_INIT, "Can only call configure at init time!"); + assert_always(intf, "configure called with an invalid interface!"); - step[which].intf = intf; - - step[which].type = intf->type; - step[which].index_start = intf->index_start;/* location of first index value in half steps */ - step[which].index_end = intf->index_end; /* location of last index value in half steps */ - step[which].index_patt = intf->index_patt; /* hex value of coil pattern (0 if not needed)*/ - step[which].initphase = intf->initphase; /* Phase at 0 steps, for alignment) */ + m_type = intf->type; + m_index_start = intf->index_start; /* location of first index value in half steps */ + m_index_end = intf->index_end; /* location of last index value in half steps */ + m_index_patt = intf->index_patt; /* hex value of coil pattern (0 if not needed)*/ + m_initphase = intf->initphase; /* Phase at 0 steps, for alignment) */ - step[which].pattern = 0; - step[which].old_pattern = 0; - step[which].step_pos = 0; - step[which].abs_step_pos= 0; - step[which].phase = step[which].initphase; - step[which].old_phase = step[which].initphase; + m_pattern = 0; + m_old_pattern = 0; + m_step_pos = 0; + m_abs_step_pos = 0; + m_phase = m_initphase; + m_old_phase = m_initphase; - switch ( step[which].type ) + switch ( m_type ) { default: case STARPOINT_48STEP_REEL: /* STARPOINT RMxxx */ case BARCREST_48STEP_REEL : /* Barcrest Reel unit */ case MPU3_48STEP_REEL : case GAMESMAN_48STEP_REEL : /* Gamesman GMxxxx */ case PROJECT_48STEP_REEL : - step[which].max_steps = (48*2); + m_max_steps = (48*2); break; case GAMESMAN_100STEP_REEL : - step[which].max_steps = (100*2); + m_max_steps = (100*2); break; case STARPOINT_144STEP_DICE :/* STARPOINT 1DCU DICE mechanism */ //Dice reels are 48 step motors, but complete three full cycles between opto updates - step[which].max_steps = ((48*3)*2); + m_max_steps = ((48*3)*2); break; case STARPOINT_200STEP_REEL : case GAMESMAN_200STEP_REEL : case ECOIN_200STEP_REEL : - step[which].max_steps = (200*2); + m_max_steps = (200*2); break; } - - state_save_register_item(machine, "stepper", NULL, which, step[which].index_start); - state_save_register_item(machine, "stepper", NULL, which, step[which].index_end); - state_save_register_item(machine, "stepper", NULL, which, step[which].index_patt); - state_save_register_item(machine, "stepper", NULL, which, step[which].initphase); - state_save_register_item(machine, "stepper", NULL, which, step[which].phase); - state_save_register_item(machine, "stepper", NULL, which, step[which].old_phase); - state_save_register_item(machine, "stepper", NULL, which, step[which].pattern); - state_save_register_item(machine, "stepper", NULL, which, step[which].old_pattern); - state_save_register_item(machine, "stepper", NULL, which, step[which].step_pos); - state_save_register_item(machine, "stepper", NULL, which, step[which].abs_step_pos); - state_save_register_item(machine, "stepper", NULL, which, step[which].max_steps); - state_save_register_item(machine, "stepper", NULL, which, step[which].type); -} - -/////////////////////////////////////////////////////////////////////////// -int stepper_get_position(int which) -{ - return step[which].step_pos; -} - -/////////////////////////////////////////////////////////////////////////// -int stepper_get_absolute_position(int which) -{ - return step[which].abs_step_pos; } /////////////////////////////////////////////////////////////////////////// -int stepper_get_max(int which) +void stepper_device::update_optic() { - return step[which].max_steps; -} - -/////////////////////////////////////////////////////////////////////////// - -static void update_optic(int which) -{ - int pos = step[which].step_pos, - start = step[which].index_start, - end = step[which].index_end; + int pos = m_step_pos, + start = m_index_start, + end = m_index_end; if (start > end) // cope with index patterns that wrap around { if ( (( pos > start ) || ( pos < end )) && - ( ( step[which].pattern == step[which].index_patt || step[which].index_patt==0) || - ( step[which].pattern == 0 && - (step[which].old_pattern == step[which].index_patt || step[which].index_patt==0) + ( ( m_pattern == m_index_patt || m_index_patt==0) || + ( m_pattern == 0 && + (m_old_pattern == m_index_patt || m_index_patt==0) ) ) ) { - step[which].optic = 1; + m_optic = 1; } - else step[which].optic = 0; + else m_optic = 0; } else { if ( (( pos > start ) && ( pos < end )) && - ( ( step[which].pattern == step[which].index_patt || step[which].index_patt==0) || - ( step[which].pattern == 0 && - (step[which].old_pattern == step[which].index_patt || step[which].index_patt==0) + ( ( m_pattern == m_index_patt || m_index_patt==0) || + ( m_pattern == 0 && + (m_old_pattern == m_index_patt || m_index_patt==0) ) ) ) { - step[which].optic = 1; + m_optic = 1; } - else step[which].optic = 0; - } -} -/////////////////////////////////////////////////////////////////////////// - -void stepper_reset_position(int which) -{ - step[which].step_pos = 0x00; - step[which].abs_step_pos= 0x00; - step[which].pattern = 0x00; - step[which].old_pattern = 0x00; - step[which].phase = step[which].initphase; - step[which].old_phase = step[which].initphase; - update_optic(which); -} - -/////////////////////////////////////////////////////////////////////////// - -int stepper_optic_state(int which) -{ - int result = 0; - - if ( which < MAX_STEPPERS ) - { - result = step[which].optic; + else m_optic = 0; } - return result; + m_optic_cb(m_optic); +} +/////////////////////////////////////////////////////////////////////////// + +void stepper_device::device_start() +{ + /* resolve callbacks */ + m_optic_cb.resolve_safe(); + + /* register for state saving */ + save_item(NAME(m_index_start)); + save_item(NAME(m_index_end)); + save_item(NAME(m_index_patt)); + save_item(NAME(m_initphase)); + save_item(NAME(m_phase)); + save_item(NAME(m_old_phase)); + save_item(NAME(m_pattern)); + save_item(NAME(m_old_pattern)); + save_item(NAME(m_step_pos)); + save_item(NAME(m_abs_step_pos)); + save_item(NAME(m_max_steps)); + save_item(NAME(m_type)); } /////////////////////////////////////////////////////////////////////////// -int stepper_update(int which, UINT8 pattern) +void stepper_device::device_reset() +{ + m_step_pos = 0x00; + m_abs_step_pos = 0x00; + m_pattern = 0x00; + m_old_pattern = 0x00; + m_phase = m_initphase; + m_old_phase = m_initphase; + update_optic(); +} + +/////////////////////////////////////////////////////////////////////////// + +int stepper_device::update(UINT8 pattern) { int changed = 0; @@ -271,11 +216,11 @@ int stepper_update(int which, UINT8 pattern) */ int pos,steps=0; - step[which].pattern = pattern; - switch ( step[which].type ) + m_pattern = pattern; + switch ( m_type ) { default: - logerror("No reel type specified for %x!\n",which); + logerror("No reel type specified!\n"); break; case STARPOINT_48STEP_REEL : /* STARPOINT RMxxx */ case GAMESMAN_200STEP_REEL : /* Gamesman GMxxxx */ @@ -287,51 +232,51 @@ int stepper_update(int which, UINT8 pattern) switch (pattern) { //Black Blue Red Yellow case 0x02:// 0 0 1 0 - step[which].phase = 7; + m_phase = 7; break; case 0x06:// 0 1 1 0 - step[which].phase = 6; + m_phase = 6; break; case 0x04:// 0 1 0 0 - step[which].phase = 5; + m_phase = 5; break; case 0x05:// 0 1 0 1 - step[which].phase = 4; + m_phase = 4; break; case 0x01:// 0 0 0 1 - step[which].phase = 3; + m_phase = 3; break; case 0x09:// 1 0 0 1 - step[which].phase = 2; + m_phase = 2; break; case 0x08:// 1 0 0 0 - step[which].phase = 1; + m_phase = 1; break; case 0x0A:// 1 0 1 0 - step[which].phase = 0; + m_phase = 0; break; // Black Blue Red Yellow case 0x03:// 0 0 1 1 { - if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now + if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now { - step[which].phase = 7; + m_phase = 7; } else //otherwise it will line up due south { - step[which].phase = 3; + m_phase = 3; } } break; case 0x0C:// 1 1 0 0 { - if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now + if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now { - step[which].phase = 5; + m_phase = 5; } else //otherwise it will line up due west { - step[which].phase = 1; + m_phase = 1; } } break; @@ -347,54 +292,54 @@ int stepper_update(int which, UINT8 pattern) { // Yellow Brown Orange Black case 0x01:// 0 0 0 1 - step[which].phase = 7; + m_phase = 7; break; case 0x03:// 0 0 1 1 - step[which].phase = 6; + m_phase = 6; break; case 0x02:// 0 0 1 0 - step[which].phase = 5; + m_phase = 5; break; case 0x06:// 0 1 1 0 - step[which].phase = 4; + m_phase = 4; break; case 0x04:// 0 1 0 0 - step[which].phase = 3; + m_phase = 3; break; case 0x0C:// 1 1 0 0 - step[which].phase = 2; + m_phase = 2; break; case 0x08:// 1 0 0 0 - step[which].phase = 1; + m_phase = 1; break;//YOLB case 0x09:// 1 0 0 1 - step[which].phase = 0; + m_phase = 0; break; // The below values should not be used by anything sane, as they effectively ignore one stator side entirely // Yellow Brown Orange Black case 0x05:// 0 1 0 1 { - if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now + if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now { - step[which].phase = 7; + m_phase = 7; } else //otherwise it will line up due south { - step[which].phase = 3; + m_phase = 3; } } break; case 0x0A:// 1 0 1 0 { - if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now + if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now { - step[which].phase = 5; + m_phase = 5; } else //otherwise it will line up due west { - step[which].phase = 1; + m_phase = 1; } } break; @@ -410,16 +355,16 @@ int stepper_update(int which, UINT8 pattern) { // Yellow(2) Brown(1) Orange(!2) Black(!1) case 0x00 :// 0 0 1 1 - step[which].phase = 6; + m_phase = 6; break; case 0x01 :// 0 1 1 0 - step[which].phase = 4; + m_phase = 4; break; case 0x03 :// 1 1 0 0 - step[which].phase = 2; + m_phase = 2; break; case 0x02 :// 1 0 0 1 - step[which].phase = 0; + m_phase = 0; break; } break; @@ -431,50 +376,50 @@ int stepper_update(int which, UINT8 pattern) switch (pattern) { case 0x08:// 0 0 1 0 - step[which].phase = 7; + m_phase = 7; break; case 0x0c:// 0 1 1 0 - step[which].phase = 6; + m_phase = 6; break; case 0x04:// 0 1 0 0 - step[which].phase = 5; + m_phase = 5; break; case 0x06:// 0 1 0 1 - step[which].phase = 4; + m_phase = 4; break; case 0x02:// 0 0 0 1 - step[which].phase = 3; + m_phase = 3; break; case 0x03:// 1 0 0 1 - step[which].phase = 2; + m_phase = 2; break; case 0x01:// 1 0 0 0 - step[which].phase = 1; + m_phase = 1; break; case 0x09:// 1 0 1 0 - step[which].phase = 0; + m_phase = 0; break; case 0x0a:// 0 0 1 1 { - if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now + if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now { - step[which].phase = 7; + m_phase = 7; } else //otherwise it will line up due south { - step[which].phase = 3; + m_phase = 3; } } break; case 0x07:// 1 1 0 0 { - if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now + if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now { - step[which].phase = 5; + m_phase = 5; } else //otherwise it will line up due west { - step[which].phase = 1; + m_phase = 1; } } break; @@ -488,50 +433,50 @@ int stepper_update(int which, UINT8 pattern) switch (pattern) { case 0x08:// 0 0 1 0 - step[which].phase = 7; + m_phase = 7; break; case 0x0c:// 0 1 1 0 - step[which].phase = 6; + m_phase = 6; break; case 0x04:// 0 1 0 0 - step[which].phase = 5; + m_phase = 5; break; case 0x05:// 0 1 0 1 - step[which].phase = 4; + m_phase = 4; break; case 0x01:// 0 0 0 1 - step[which].phase = 3; + m_phase = 3; break; case 0x03:// 1 0 0 1 - step[which].phase = 2; + m_phase = 2; break; case 0x02:// 1 0 0 0 - step[which].phase = 1; + m_phase = 1; break; case 0x0a:// 1 0 1 0 - step[which].phase = 0; + m_phase = 0; break; case 0x09:// 0 0 1 1 { - if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now + if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now { - step[which].phase = 7; + m_phase = 7; } else //otherwise it will line up due south { - step[which].phase = 3; + m_phase = 3; } } break; case 0x06:// 1 1 0 0 { - if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now + if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now { - step[which].phase = 5; + m_phase = 5; } else //otherwise it will line up due west { - step[which].phase = 1; + m_phase = 1; } } break; @@ -542,7 +487,7 @@ int stepper_update(int which, UINT8 pattern) } - steps = step[which].old_phase - step[which].phase; + steps = m_old_phase - m_phase; if (steps < -4) { @@ -553,29 +498,25 @@ int stepper_update(int which, UINT8 pattern) steps = steps -8; } - step[which].old_phase = step[which].phase; - step[which].old_pattern = step[which].pattern; + m_old_phase = m_phase; + m_old_pattern = m_pattern; - int max = step[which].max_steps; + int max = m_max_steps; pos = 0; if (max!=0) { - step[which].abs_step_pos += steps; - pos = (step[which].step_pos + steps + max) % max; - } - else - { - logerror("step[%x].max_steps == 0\n",which); + m_abs_step_pos += steps; + pos = (m_step_pos + steps + max) % max; } - if (pos != step[which].step_pos) + if (pos != m_step_pos) { changed++; } - step[which].step_pos = pos; - update_optic(which); + m_step_pos = pos; + update_optic(); return changed; } diff --git a/src/emu/machine/steppers.h b/src/emu/machine/steppers.h index db1b30cb1e9..352c7198bd1 100644 --- a/src/emu/machine/steppers.h +++ b/src/emu/machine/steppers.h @@ -7,8 +7,6 @@ // // // // // TODO: add further types of stepper motors if needed (Konami/IGT?) // -// Someone who understands the device system may want to convert // -// this // /////////////////////////////////////////////////////////////////////////// @@ -49,17 +47,57 @@ extern const stepper_interface starpointrm20_interface_48step; extern const stepper_interface starpoint_interface_200step_reel; extern const stepper_interface ecoin_interface_200step_reel; -void stepper_config(running_machine &machine, int which, const stepper_interface *intf); -void stepper_reset_position(int id); /* reset a motor to position 0 */ +#define MCFG_STEPPER_OPTIC_CALLBACK(_write) \ + devcb = &stepper_device::set_optic_handler(*device, DEVCB_##_write); -int stepper_optic_state( int id); /* read a motor's optics */ +class stepper_device; +const device_type STEPPER = &device_creator; -int stepper_update(int id, UINT8 pattern); /* update a motor */ +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) + { } -int stepper_get_position(int id); /* get current position in half steps */ + template static devcb_base &set_optic_handler(device_t &device, _Object object) { return downcast(device).m_optic_cb.set_callback(object); } -int stepper_get_absolute_position(int id); /* get current absolute position in half steps */ + void configure(const stepper_interface *intf); + + /* update a motor */ + int update(UINT8 pattern); + + /* get current position in half steps */ + int get_position() { return m_step_pos; } + /* get current absolute position in half steps */ + int get_absolute_position() { return m_abs_step_pos; } + /* get maximum position in half steps */ + int get_max() { return m_max_steps; } + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + UINT8 m_pattern; /* coil pattern */ + UINT8 m_old_pattern; /* old coil pattern */ + UINT8 m_initphase; + UINT8 m_phase; /* motor phase */ + UINT8 m_old_phase; /* old phase */ + UINT8 m_type; /* reel type */ + INT16 m_step_pos; /* step position 0 - max_steps */ + INT16 m_max_steps; /* maximum step position */ + INT32 m_abs_step_pos; /* absolute step position */ + INT16 m_index_start; /* start position of index (in half steps) */ + INT16 m_index_end; /* end position of index (in half steps) */ + INT16 m_index_patt; /* pattern needed on coils (0=don't care) */ + UINT8 m_optic; + + void update_optic(); + devcb_write_line m_optic_cb; +}; -int stepper_get_max(int id); /* get maximum position in half steps */ #endif diff --git a/src/mame/drivers/aces1.c b/src/mame/drivers/aces1.c index 201b7bf3027..aea5c2dfca8 100644 --- a/src/mame/drivers/aces1.c +++ b/src/mame/drivers/aces1.c @@ -38,6 +38,10 @@ public: aces1_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_reel0(*this, "reel0"), + m_reel1(*this, "reel1"), + m_reel2(*this, "reel2"), + m_reel3(*this, "reel3"), m_io1_port(*this, "IO1"), m_io2_port(*this, "IO2"), m_io3_port(*this, "IO3"), @@ -53,6 +57,11 @@ public: int m_reel_clock[4]; int m_reel_phase[4]; int m_reel_count[4]; + 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_READ8_MEMBER( aces1_unk_r ) { @@ -148,7 +157,13 @@ public: { int sense = ((data & (4 + (1<update(phases[m_reel_phase[reel]]); break; + case 1: m_reel1->update(phases[m_reel_phase[reel]]); break; + case 2: m_reel2->update(phases[m_reel_phase[reel]]); break; + case 3: m_reel3->update(phases[m_reel_phase[reel]]); break; + } m_reel_clock[reel] = clock; if ( m_reel_phase[reel] % 4 ==0) { @@ -187,19 +202,21 @@ public: DECLARE_READ8_MEMBER( ic37_read_c ) { - int pattern =0; int action =0; for (int reel = 0; reel < 4; reel++) { - if (stepper_optic_state(reel)) pattern |= 1< m_maincpu; + required_device m_reel0; + required_device m_reel1; + required_device m_reel2; + required_device m_reel3; required_ioport m_io1_port; required_ioport m_io2_port; required_ioport m_io3_port; @@ -236,10 +253,10 @@ TIMER_CALLBACK_MEMBER(aces1_state::m_aces1_nmi_timer_callback) void aces1_state::machine_start() { - stepper_config(machine(), 0, &starpoint_interface_48step); - stepper_config(machine(), 1, &starpoint_interface_48step); - stepper_config(machine(), 2, &starpoint_interface_48step); - stepper_config(machine(), 3, &starpoint_interface_48step); + m_reel0->configure(&starpoint_interface_48step); + m_reel1->configure(&starpoint_interface_48step); + m_reel2->configure(&starpoint_interface_48step); + m_reel3->configure(&starpoint_interface_48step); for (int reel=0; reel <4; reel++) { @@ -452,6 +469,16 @@ static MACHINE_CONFIG_START( aces1, aces1_state ) MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSWA")) MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSWB")) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + + /* steppers */ + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel1_optic_cb)) + MCFG_DEVICE_ADD("reel2", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel3_optic_cb)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/bfm_sc1.c b/src/mame/drivers/bfm_sc1.c index 0e08a9c7e8e..22efd7e06c1 100644 --- a/src/mame/drivers/bfm_sc1.c +++ b/src/mame/drivers/bfm_sc1.c @@ -111,6 +111,12 @@ public: : driver_device(mconfig, type, tag), m_vfd0(*this, "vfd0"), m_maincpu(*this, "maincpu"), + m_reel0(*this, "reel0"), + m_reel1(*this, "reel1"), + m_reel2(*this, "reel2"), + m_reel3(*this, "reel3"), + m_reel4(*this, "reel4"), + m_reel5(*this, "reel5"), m_upd7759(*this, "upd") { } optional_device m_vfd0; @@ -120,6 +126,12 @@ public: int m_vfd_latch; int m_irq_status; 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; } int m_acia_status; int m_locked; int m_is_timer_enabled; @@ -181,6 +193,12 @@ public: int Scorpion1_GetSwitchState(int strobe, int data); int sc1_find_project_string( ); 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; optional_device m_upd7759; }; @@ -251,16 +269,11 @@ WRITE8_MEMBER(bfm_sc1_state::reel12_w) } else { - stepper_update(0, (data>>4)&0x0f); - stepper_update(1, data&0x0f ); - - 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; + m_reel0->update((data>>4)&0x0f); + m_reel1->update( data &0x0f); } - awp_draw_reel(0); - awp_draw_reel(1); + awp_draw_reel(0, m_reel0); + awp_draw_reel(1, m_reel1); } /////////////////////////////////////////////////////////////////////////// @@ -273,31 +286,22 @@ WRITE8_MEMBER(bfm_sc1_state::reel34_w) } else { - stepper_update(2, (data>>4)&0x0f); - stepper_update(3, data&0x0f ); - - 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_reel2->update((data>>4)&0x0f); + m_reel3->update( data &0x0f); } - awp_draw_reel(2); - awp_draw_reel(3); + awp_draw_reel(2, m_reel2); + awp_draw_reel(3, m_reel3); } /////////////////////////////////////////////////////////////////////////// WRITE8_MEMBER(bfm_sc1_state::reel56_w) { - stepper_update(4, (data>>4)&0x0f); - stepper_update(5, data&0x0f ); + m_reel4->update((data>>4)&0x0f); + m_reel5->update( data &0x0f); - if ( stepper_optic_state(4) ) m_optic_pattern |= 0x10; - else m_optic_pattern &= ~0x10; - if ( stepper_optic_state(5) ) m_optic_pattern |= 0x20; - else m_optic_pattern &= ~0x20; - awp_draw_reel(5); - awp_draw_reel(6); + awp_draw_reel(4, m_reel4); + awp_draw_reel(5, m_reel5); } /////////////////////////////////////////////////////////////////////////// @@ -612,20 +616,6 @@ void bfm_sc1_state::machine_reset() m_vfd0->reset(); -// reset stepper motors ///////////////////////////////////////////////////////////// - { - int pattern =0, i; - - for ( i = 0; i < 6; i++) - { - stepper_reset_position(i); - if ( stepper_optic_state(i) ) pattern |= 1<configure(&starpoint_interface_48step); + case 5: m_reel4->configure(&starpoint_interface_48step); + case 4: m_reel3->configure(&starpoint_interface_48step); + case 3: m_reel2->configure(&starpoint_interface_48step); + case 2: m_reel1->configure(&starpoint_interface_48step); + case 1: m_reel0->configure(&starpoint_interface_48step); } if (decrypt) bfm_decode_mainrom(machine(),"maincpu", m_codec_data); // decode main rom diff --git a/src/mame/drivers/bfm_sc2.c b/src/mame/drivers/bfm_sc2.c index 432612180ed..5a9eca3e5b8 100644 --- a/src/mame/drivers/bfm_sc2.c +++ b/src/mame/drivers/bfm_sc2.c @@ -181,12 +181,24 @@ public: bfm_sc2_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_reel0(*this, "reel0"), + m_reel1(*this, "reel1"), + m_reel2(*this, "reel2"), + m_reel3(*this, "reel3"), + m_reel4(*this, "reel4"), + m_reel5(*this, "reel5"), m_upd7759(*this, "upd"), m_vfd0(*this, "vfd0"), m_vfd1(*this, "vfd1"), 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_vfd0; optional_device m_vfd1; @@ -199,6 +211,12 @@ public: int m_mmtr_latch; int m_irq_status; 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; } int m_uart1_data; int m_uart2_data; int m_data_to_uart1; @@ -386,20 +404,6 @@ void bfm_sc2_state::on_scorpion2_reset() machine().device("ymsnd")->reset(); - // reset stepper motors ///////////////////////////////////////////////// - { - int pattern =0, i; - - for ( i = 0; i < m_reels; i++) - { - stepper_reset_position(i); - if ( stepper_optic_state(i) ) pattern |= 1<>4)&0x0f ); + m_reel0->update( data &0x0f); + m_reel1->update((data>>4)&0x0f); - 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; - - awp_draw_reel(0); - awp_draw_reel(1); + awp_draw_reel(0, m_reel0); + awp_draw_reel(1, m_reel1); } WRITE8_MEMBER(bfm_sc2_state::reel34_w) { m_reel34_latch = data; - stepper_update(2, data&0x0f ); - stepper_update(3, (data>>4)&0x0f); + m_reel2->update( data &0x0f); + m_reel3->update((data>>4)&0x0f); - 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; - - awp_draw_reel(2); - awp_draw_reel(3); + awp_draw_reel(2, m_reel2); + awp_draw_reel(3, m_reel3); } /////////////////////////////////////////////////////////////////////////// @@ -580,16 +574,11 @@ WRITE8_MEMBER(bfm_sc2_state::reel56_w) { m_reel56_latch = data; - stepper_update(4, data&0x0f ); - stepper_update(5, (data>>4)&0x0f); + m_reel4->update( data &0x0f); + m_reel5->update((data>>4)&0x0f); - if ( stepper_optic_state(4) ) m_optic_pattern |= 0x10; - else m_optic_pattern &= ~0x10; - if ( stepper_optic_state(5) ) m_optic_pattern |= 0x20; - else m_optic_pattern &= ~0x20; - - awp_draw_reel(4); - awp_draw_reel(5); + awp_draw_reel(4, m_reel4); + awp_draw_reel(5, m_reel5); } @@ -2174,6 +2163,20 @@ 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 @@ -3664,29 +3667,37 @@ MACHINE_CONFIG_END void bfm_sc2_state::sc2awp_common_init(int reels, int decrypt) { - int n; sc2_common_init(decrypt); /* setup n default 96 half step reels */ m_reels=reels; - for ( n = 0; n < reels; n++ ) + switch (reels) { - stepper_config(machine(), n, &starpoint_interface_48step); + case 6: m_reel5->configure(&starpoint_interface_48step); + case 5: m_reel4->configure(&starpoint_interface_48step); + case 4: m_reel3->configure(&starpoint_interface_48step); + case 3: m_reel2->configure(&starpoint_interface_48step); + case 2: m_reel1->configure(&starpoint_interface_48step); + case 1: m_reel0->configure(&starpoint_interface_48step); } } void bfm_sc2_state::sc2awpdmd_common_init(int reels, int decrypt) { - int n; sc2_common_init(decrypt); /* setup n default 96 half step reels */ m_reels=reels; - for ( n = 0; n < reels; n++ ) + switch (reels) { - stepper_config(machine(), n, &starpoint_interface_48step); + case 6: m_reel5->configure(&starpoint_interface_48step); + case 5: m_reel4->configure(&starpoint_interface_48step); + case 4: m_reel3->configure(&starpoint_interface_48step); + case 3: m_reel2->configure(&starpoint_interface_48step); + case 2: m_reel1->configure(&starpoint_interface_48step); + case 1: m_reel0->configure(&starpoint_interface_48step); } } diff --git a/src/mame/drivers/bfm_sc4h.c b/src/mame/drivers/bfm_sc4h.c index 212d003f904..e714ed4a906 100644 --- a/src/mame/drivers/bfm_sc4h.c +++ b/src/mame/drivers/bfm_sc4h.c @@ -517,40 +517,29 @@ void sc4_state::bfm_sc4_68307_porta_w(address_space &space, bool dedicated, UINT { m_reel12_latch = data; - stepper_update(0, data&0x0f ); - stepper_update(1, (data>>4)&0x0f ); + m_reel0->update( data &0x0f); + m_reel1->update((data>>4)&0x0f); - 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; - - awp_draw_reel(0); - awp_draw_reel(1); + awp_draw_reel(0, m_reel0); + awp_draw_reel(1, m_reel1); } WRITE8_MEMBER( sc4_state::bfm_sc4_reel3_w ) { m_reel3_latch = data; - stepper_update(2, data&0x0f ); + m_reel2->update(data&0x0f); - if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; - else m_optic_pattern &= ~0x04; - - awp_draw_reel(2); + awp_draw_reel(2, m_reel2); } WRITE8_MEMBER( sc4_state::bfm_sc4_reel4_w ) { m_reel4_latch = data; - stepper_update(3, data&0x0f ); + m_reel3->update(data&0x0f ); - if ( stepper_optic_state(3) ) m_optic_pattern |= 0x08; - else m_optic_pattern &= ~0x08; - - awp_draw_reel(3); + awp_draw_reel(3, m_reel3); } void sc4_state::bfm_sc4_68307_portb_w(address_space &space, bool dedicated, UINT16 data, UINT16 line_mask) @@ -591,17 +580,8 @@ UINT16 sc4_state::bfm_sc4_68307_portb_r(address_space &space, bool dedicated, UI MACHINE_RESET_MEMBER(sc4_state,sc4) { - int pattern =0, i; - - for ( i = 0; i < m_reels; i++) - { - stepper_reset_position(i); - if ( stepper_optic_state(i) ) pattern |= 1<configure(m_reel_setup[0]); + if (m_reel_setup[1]) m_reel1->configure(m_reel_setup[1]); + if (m_reel_setup[2]) m_reel2->configure(m_reel_setup[2]); + if (m_reel_setup[3]) m_reel3->configure(m_reel_setup[3]); + if (m_reel_setup[4]) m_reel4->configure(m_reel_setup[4]); + if (m_reel_setup[5]) m_reel5->configure(m_reel_setup[5]); } @@ -663,16 +645,11 @@ WRITE8_MEMBER(sc4_state::bfm_sc4_duart_output_w) // logerror("bfm_sc4_duart_output_w\n"); m_reel56_latch = data; - stepper_update(4, data&0x0f ); - stepper_update(5, (data>>4)&0x0f); + m_reel4->update( data &0x0f); + m_reel5->update((data>>4)&0x0f); - if ( stepper_optic_state(4) ) m_optic_pattern |= 0x10; - else m_optic_pattern &= ~0x10; - if ( stepper_optic_state(5) ) m_optic_pattern |= 0x20; - else m_optic_pattern &= ~0x20; - - awp_draw_reel(4); - awp_draw_reel(5); + awp_draw_reel(4, m_reel4); + awp_draw_reel(5, m_reel5); } @@ -728,6 +705,19 @@ MACHINE_CONFIG_START( sc4, sc4_state ) MCFG_SOUND_ADD("ymz", YMZ280B, 16000000) // ?? Mhz MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(sc4_state, bfm_sc4_irqhandler)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb)) + MCFG_DEVICE_ADD("reel2", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb)) + MCFG_DEVICE_ADD("reel4", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb)) + MCFG_DEVICE_ADD("reel5", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/bfmsys85.c b/src/mame/drivers/bfmsys85.c index a997c8bb768..3666be159c6 100644 --- a/src/mame/drivers/bfmsys85.c +++ b/src/mame/drivers/bfmsys85.c @@ -74,6 +74,10 @@ public: bfmsys85_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_reel0(*this, "reel0"), + m_reel1(*this, "reel1"), + m_reel2(*this, "reel2"), + m_reel3(*this, "reel3"), m_acia6850_0(*this, "acia6850_0") { } @@ -84,6 +88,10 @@ public: int m_alpha_clock; int m_irq_status; 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_locked; int m_is_timer_enabled; int m_coin_inhibits; @@ -117,6 +125,10 @@ public: INTERRUPT_GEN_MEMBER(timer_irq); int b85_find_project_string( ); required_device m_maincpu; + required_device m_reel0; + required_device m_reel1; + required_device m_reel2; + required_device m_reel3; required_device m_acia6850_0; }; @@ -158,17 +170,6 @@ void bfmsys85_state::machine_reset() m_vfd->reset(); // reset display1 -// reset stepper motors /////////////////////////////////////////////////// - { - int pattern =0, i; - - for ( i = 0; i < 6; i++) - { - stepper_reset_position(i); - if ( stepper_optic_state(i) ) pattern |= 1<>4)&0x0f); - stepper_update(1, data&0x0f ); + m_reel0->update((data>>4)&0x0f); + m_reel1->update( data &0x0f); - 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; - awp_draw_reel(0); - awp_draw_reel(1); + awp_draw_reel(0, m_reel0); + awp_draw_reel(1, m_reel1); } /////////////////////////////////////////////////////////////////////////// WRITE8_MEMBER(bfmsys85_state::reel34_w) { - stepper_update(2, (data>>4)&0x0f); - stepper_update(3, data&0x0f ); + m_reel2->update((data>>4)&0x0f); + m_reel3->update( data &0x0f); - 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; - awp_draw_reel(2); - awp_draw_reel(3); + awp_draw_reel(2, m_reel2); + awp_draw_reel(3, m_reel3); } /////////////////////////////////////////////////////////////////////////// @@ -353,12 +346,10 @@ READ8_MEMBER(bfmsys85_state::triac_r) void bfmsys85_state::machine_start() { - int i; - for ( i = 0; i < 4; i++ ) - { - stepper_config(machine(), i, &starpoint_interface_48step); - } - + m_reel0->configure(&starpoint_interface_48step); + m_reel1->configure(&starpoint_interface_48step); + m_reel2->configure(&starpoint_interface_48step); + m_reel3->configure(&starpoint_interface_48step); } // memory map for bellfruit system85 board //////////////////////////////// @@ -415,6 +406,15 @@ static MACHINE_CONFIG_START( bfmsys85, bfmsys85_state ) MCFG_NVRAM_ADD_0FILL("nvram") // load/save nv RAM + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel1_optic_cb)) + MCFG_DEVICE_ADD("reel2", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel3_optic_cb)) + MCFG_DEFAULT_LAYOUT(layout_bfmsys85) MACHINE_CONFIG_END diff --git a/src/mame/drivers/ecoinf2.c b/src/mame/drivers/ecoinf2.c index c5e4999fcc0..75b415c2c79 100644 --- a/src/mame/drivers/ecoinf2.c +++ b/src/mame/drivers/ecoinf2.c @@ -22,6 +22,10 @@ public: ecoinf2_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_reel0(*this, "reel0"), + m_reel1(*this, "reel1"), + m_reel2(*this, "reel2"), + m_reel3(*this, "reel3"), m_coins(*this, "COINS"), m_key(*this, "PERKEY"), m_panel(*this, "PANEL") @@ -31,6 +35,10 @@ public: } required_device m_maincpu; + required_device m_reel0; + required_device m_reel1; + required_device m_reel2; + required_device m_reel3; required_ioport m_coins; required_ioport m_key; required_ioport m_panel; @@ -40,6 +48,10 @@ public: //UINT16 m_chars[14]; // void update_display(); 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 strobe_addr; int strobe_amount; @@ -187,30 +199,20 @@ public: DECLARE_WRITE8_MEMBER(ppi8255_ic23_write_a_reel01) { - stepper_update(0, data&0x0f); - stepper_update(1, (data>>4)&0x0f); + m_reel0->update( data &0x0f); + m_reel1->update((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; - - awp_draw_reel(0); - awp_draw_reel(1); + awp_draw_reel(0, m_reel0); + awp_draw_reel(1, m_reel1); } DECLARE_WRITE8_MEMBER(ppi8255_ic23_write_b_reel23) { - stepper_update(2, data&0x0f); - stepper_update(3, (data>>4)&0x0f); + m_reel2->update( data &0x0f); + m_reel3->update((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; - - awp_draw_reel(2); - awp_draw_reel(3); + awp_draw_reel(2, m_reel2); + awp_draw_reel(3, m_reel3); } DECLARE_READ8_MEMBER(ppi8255_ic23_read_c_key) @@ -498,10 +500,10 @@ INPUT_PORTS_END MACHINE_START_MEMBER(ecoinf2_state,ecoinf2) { MechMtr_config(machine(),8); - 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); } @@ -541,6 +543,15 @@ static MACHINE_CONFIG_START( ecoinf2_oxo, ecoinf2_state ) MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf2_state, ppi8255_ic13_write_b_strobedat1)) MCFG_I8255_IN_PORTC_CB(READ8(ecoinf2_state, ppi8255_ic13_read_c_panel)) + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel1_optic_cb)) + MCFG_DEVICE_ADD("reel2", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel3_optic_cb)) + // MCFG_DEVICE_ADD("ic25_dips", I8255, 0) MACHINE_CONFIG_END 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 m_maincpu; + required_device m_reel0; + required_device m_reel1; + required_device m_reel2; + required_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); + m_reel0->update( data &0x0f); + m_reel1->update((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; - - 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); + m_reel2->update( data &0x0f); + m_reel3->update((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; - - 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 diff --git a/src/mame/drivers/ecoinfr.c b/src/mame/drivers/ecoinfr.c index bc3beda5ffb..e7d43757ec6 100644 --- a/src/mame/drivers/ecoinfr.c +++ b/src/mame/drivers/ecoinfr.c @@ -53,10 +53,19 @@ class ecoinfr_state : public driver_device public: ecoinfr_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") + { } int irq_toggle; 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; } UINT8 port09_value; UINT8 port10_value; @@ -108,6 +117,10 @@ public: DECLARE_MACHINE_START(ecoinfr); required_device m_maincpu; + required_device m_reel0; + required_device m_reel1; + required_device m_reel2; + required_device m_reel3; }; @@ -151,12 +164,9 @@ WRITE8_MEMBER(ecoinfr_state::ec_port00_out_w) printf("ec_port0a_out_w (reel 1 port) unk bits used %02x\n", data); } - stepper_update(0, data&0x0f); + m_reel0->update(data&0x0f); - if ( stepper_optic_state(0) ) m_optic_pattern |= 0x01; - else m_optic_pattern &= ~0x01; - - awp_draw_reel(0); + awp_draw_reel(0, m_reel0); } WRITE8_MEMBER(ecoinfr_state::ec_port01_out_w) @@ -166,12 +176,9 @@ WRITE8_MEMBER(ecoinfr_state::ec_port01_out_w) printf("ec_port01_out_w (reel 2 port) unk bits used %02x\n", data); } - stepper_update(1, data&0x0f); + m_reel1->update(data&0x0f); - if ( stepper_optic_state(1) ) m_optic_pattern |= 0x02; - else m_optic_pattern &= ~0x02; - - awp_draw_reel(1); + awp_draw_reel(1, m_reel1); } WRITE8_MEMBER(ecoinfr_state::ec_port02_out_w) @@ -181,12 +188,9 @@ WRITE8_MEMBER(ecoinfr_state::ec_port02_out_w) printf("ec_port02_out_w (reel 3 port) unk bits used %02x\n", data); } - stepper_update(2, data&0x0f); + m_reel2->update(data&0x0f); - if ( stepper_optic_state(2) ) m_optic_pattern |= 0x04; - else m_optic_pattern &= ~0x04; - - awp_draw_reel(2); + awp_draw_reel(2, m_reel2); } @@ -766,10 +770,10 @@ void ecoinfr_state::machine_reset() MACHINE_START_MEMBER(ecoinfr_state,ecoinfr) { - 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( ecoinfr, ecoinfr_state ) @@ -784,6 +788,13 @@ static MACHINE_CONFIG_START( ecoinfr, ecoinfr_state ) MCFG_MACHINE_START_OVERRIDE(ecoinfr_state, ecoinfr ) MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) + + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + 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)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/jpmimpct.c b/src/mame/drivers/jpmimpct.c index e04b3d43148..293b97e5136 100644 --- a/src/mame/drivers/jpmimpct.c +++ b/src/mame/drivers/jpmimpct.c @@ -965,13 +965,12 @@ MACHINE_START_MEMBER(jpmimpct_state,impctawp) save_item(NAME(m_duart_1.IMR)); save_item(NAME(m_duart_1.CT)); - stepper_config(machine(), 0, &starpoint_interface_48step); - stepper_config(machine(), 1, &starpoint_interface_48step); - stepper_config(machine(), 2, &starpoint_interface_48step); - stepper_config(machine(), 3, &starpoint_interface_48step); - stepper_config(machine(), 4, &starpoint_interface_48step); - stepper_config(machine(), 5, &starpoint_interface_48step); - stepper_config(machine(), 6, &starpoint_interface_48step); + m_reel0->configure(&starpoint_interface_48step); + m_reel1->configure(&starpoint_interface_48step); + m_reel2->configure(&starpoint_interface_48step); + m_reel3->configure(&starpoint_interface_48step); + m_reel4->configure(&starpoint_interface_48step); + m_reel5->configure(&starpoint_interface_48step); } MACHINE_RESET_MEMBER(jpmimpct_state,impctawp) @@ -1062,13 +1061,6 @@ READ16_MEMBER(jpmimpct_state::inputs1awp_r) READ16_MEMBER(jpmimpct_state::optos_r) { - int i; - - for (i=0; i<6; i++) - { - if ( stepper_optic_state(i) ) m_optic_pattern |= (1 << i); - else m_optic_pattern &= ~(1 << i); - } return m_optic_pattern; } @@ -1097,20 +1089,22 @@ WRITE16_MEMBER(jpmimpct_state::jpmioawp_w) case 0x02: { - for (i=0; i<4; i++) - { - stepper_update(i, (data >> i)& 0x0F ); - awp_draw_reel(i); - } + m_reel0->update((data >> 0)& 0x0F); + m_reel1->update((data >> 1)& 0x0F); + m_reel2->update((data >> 2)& 0x0F); + m_reel3->update((data >> 3)& 0x0F); + awp_draw_reel(0, m_reel0); + awp_draw_reel(1, m_reel1); + awp_draw_reel(2, m_reel2); + awp_draw_reel(3, m_reel3); break; } case 0x04: { - for (i=0; i<2; i++) - { - stepper_update(i+4, (data >> (i + 4)& 0x0F )); - awp_draw_reel(i+4); - } + m_reel4->update((data >> 4)& 0x0F); + m_reel5->update((data >> 5)& 0x0F); + awp_draw_reel(4, m_reel4); + awp_draw_reel(5, m_reel5); break; } case 0x06: diff --git a/src/mame/drivers/maygay1b.c b/src/mame/drivers/maygay1b.c index b83b157e9af..12558dfc7ab 100644 --- a/src/mame/drivers/maygay1b.c +++ b/src/mame/drivers/maygay1b.c @@ -81,21 +81,9 @@ // called if board is reset /////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// -void maygay1b_state::m1_stepper_reset() -{ - int pattern = 0,i; - for ( i = 0; i < 6; i++) - { - stepper_reset_position(i); - if ( stepper_optic_state(i) ) pattern |= 1<reset(); // reset display1 - m1_stepper_reset(); m_Vmm=false; } @@ -293,58 +281,43 @@ INPUT_PORTS_END void maygay1b_state::machine_start() { - int i; - // setup 8 mechanical meters //////////////////////////////////////////// MechMtr_config(machine(),8); // setup 6 default 96 half step reels /////////////////////////////////// - for ( i = 0; i < 6; i++ ) - { - stepper_config(machine(), i, &starpoint_interface_48step); - } + m_reel0->configure(&starpoint_interface_48step); + m_reel1->configure(&starpoint_interface_48step); + m_reel2->configure(&starpoint_interface_48step); + m_reel3->configure(&starpoint_interface_48step); + m_reel4->configure(&starpoint_interface_48step); + m_reel5->configure(&starpoint_interface_48step); } WRITE8_MEMBER(maygay1b_state::reel12_w) { - stepper_update(0, data & 0x0F ); - stepper_update(1, (data>>4) & 0x0F ); + m_reel0->update( data & 0x0F); + m_reel1->update((data>>4) & 0x0F); - 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; - - awp_draw_reel(0); - awp_draw_reel(1); + awp_draw_reel(0, m_reel0); + awp_draw_reel(1, m_reel1); } WRITE8_MEMBER(maygay1b_state::reel34_w) { - stepper_update(2, data & 0x0F ); - stepper_update(3, (data>>4) & 0x0F ); + m_reel2->update( data & 0x0F); + m_reel3->update((data>>4) & 0x0F); - 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; - - awp_draw_reel(2); - awp_draw_reel(3); + awp_draw_reel(2, m_reel2); + awp_draw_reel(3, m_reel3); } WRITE8_MEMBER(maygay1b_state::reel56_w) { - stepper_update(4, data & 0x0F ); - stepper_update(5, (data>>4) & 0x0F ); + m_reel4->update( data & 0x0F); + m_reel5->update((data>>4) & 0x0F); - if ( stepper_optic_state(4) ) m_optic_pattern |= 0x10; - else m_optic_pattern &= ~0x10; - if ( stepper_optic_state(5) ) m_optic_pattern |= 0x20; - else m_optic_pattern &= ~0x20; - - awp_draw_reel(4); - awp_draw_reel(5); + awp_draw_reel(4, m_reel4); + awp_draw_reel(5, m_reel5); } READ8_MEMBER(maygay1b_state::m1_duart_r) @@ -651,6 +624,19 @@ MACHINE_CONFIG_START( maygay_m1, maygay1b_state ) MCFG_DEVICE_ADD("i8279_2", I8279, M1_MASTER_CLOCK/4) // unknown clock MCFG_I8279_OUT_DISP_CB(WRITE8(maygay1b_state, lamp_data_2_w)) // display A&B + MCFG_DEVICE_ADD("reel0", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel0_optic_cb)) + MCFG_DEVICE_ADD("reel1", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel1_optic_cb)) + MCFG_DEVICE_ADD("reel2", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel2_optic_cb)) + MCFG_DEVICE_ADD("reel3", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel3_optic_cb)) + MCFG_DEVICE_ADD("reel4", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel4_optic_cb)) + MCFG_DEVICE_ADD("reel5", STEPPER, 0) + MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel5_optic_cb)) + MCFG_NVRAM_ADD_0FILL("nvram") MCFG_DEFAULT_LAYOUT(layout_maygay1b) 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 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 m_maincpu; + required_device m_reel0; + required_device m_reel1; + required_device m_reel2; + required_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<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) diff --git a/src/mame/drivers/mpu4dealem.c b/src/mame/drivers/mpu4dealem.c index 61cd45287b5..10aecd257ce 100644 --- a/src/mame/drivers/mpu4dealem.c +++ b/src/mame/drivers/mpu4dealem.c @@ -171,8 +171,6 @@ MACHINE_RESET_MEMBER(mpu4dealem_state,dealem_vid) { m_vfd->reset(); //for debug ports only - mpu4_stepper_reset(); - m_lamp_strobe = 0; m_lamp_strobe2 = 0; m_led_strobe = 0; diff --git a/src/mame/drivers/mpu4hw.c b/src/mame/drivers/mpu4hw.c index 18bfa93cbb5..2146d35ff02 100644 --- a/src/mame/drivers/mpu4hw.c +++ b/src/mame/drivers/mpu4hw.c @@ -375,41 +375,41 @@ void mpu4_state::update_meters() break; case FIVE_REEL_5TO8: - stepper_update(4, ((data >> 4) & 0x0f)); + m_reel4->update(((data >> 4) & 0x0f)); data = (data & 0x0F); //Strip reel data from meter drives, leaving active elements - awp_draw_reel(4); + awp_draw_reel(4, m_reel4); break; case FIVE_REEL_8TO5: - stepper_update(4, (((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ; + m_reel4->update((((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ; data = 0x00; //Strip all reel data from meter drives, nothing is connected - awp_draw_reel(4); + awp_draw_reel(4, m_reel4); break; case FIVE_REEL_3TO6: - stepper_update(4, ((data >> 2) & 0x0f)); + m_reel4->update(((data >> 2) & 0x0f)); data = 0x00; //Strip all reel data from meter drives - awp_draw_reel(4); + awp_draw_reel(4, m_reel4); break; case SIX_REEL_1TO8: - stepper_update(4, (data & 0x0f)); - stepper_update(5, ((data >> 4) & 0x0f)); + m_reel4->update( data & 0x0f); + m_reel5->update((data >> 4) & 0x0f); data = 0x00; //Strip all reel data from meter drives - awp_draw_reel(4); - awp_draw_reel(5); + awp_draw_reel(4, m_reel4); + awp_draw_reel(5, m_reel5); break; case SIX_REEL_5TO8: - stepper_update(4, ((data >> 4) & 0x0f)); + m_reel4->update(((data >> 4) & 0x0f)); data = 0x00; //Strip all reel data from meter drives - awp_draw_reel(4); + awp_draw_reel(4, m_reel4); break; case SEVEN_REEL: - stepper_update(0, (((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ; + m_reel0->update((((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ; data = 0x00; //Strip all reel data from meter drives - awp_draw_reel(0); + awp_draw_reel(0, m_reel0); break; case FLUTTERBOX: //The backbox fan assembly fits in a reel unit sized box, wired to the remote meter pin, so we can handle it here @@ -433,27 +433,10 @@ void mpu4_state::update_meters() } /* called if board is reset */ -void mpu4_state::mpu4_stepper_reset() -{ - int pattern = 0,reel; - for (reel = 0; reel < 6; reel++) - { - stepper_reset_position(reel); - if(!m_reel_mux) - { - if (stepper_optic_state(reel)) pattern |= 1<reset(); - mpu4_stepper_reset(); - m_lamp_strobe = 0; m_lamp_strobe2 = 0; m_led_strobe = 0; @@ -788,7 +771,7 @@ READ8_MEMBER(mpu4_state::pia_ic4_portb_r) } else { - if (stepper_optic_state(m_active_reel)) + if (m_optic_pattern & (1<> 4)&0x0F); - awp_draw_reel(4); - awp_draw_reel(5); + m_reel4->update( data &0x0F); + m_reel5->update((data >> 4)&0x0F); + awp_draw_reel(4, m_reel4); + awp_draw_reel(5, m_reel5); } else if (m_reel_mux == SEVEN_REEL) { - stepper_update(1, data&0x0F); - stepper_update(2, (data >> 4)&0x0F); - awp_draw_reel(1); - awp_draw_reel(2); + m_reel1->update( data &0x0F); + m_reel2->update((data >> 4)&0x0F); + awp_draw_reel(1, m_reel1); + awp_draw_reel(2, m_reel2); } if (core_stricmp(machine().system().name, "m4gambal") == 0) @@ -1139,26 +1122,17 @@ WRITE8_MEMBER(mpu4_state::pia_ic6_portb_w) if (m_reel_mux == SEVEN_REEL) { - stepper_update(3, data&0x0F); - stepper_update(4, (data >> 4)&0x0F); - awp_draw_reel(3); - awp_draw_reel(4); + m_reel3->update( data &0x0F); + m_reel4->update((data >> 4)&0x0F); + awp_draw_reel(3, m_reel3); + awp_draw_reel(4, m_reel4); } else if (m_reels) { - stepper_update(0, data & 0x0F ); - stepper_update(1, (data>>4) & 0x0F ); - awp_draw_reel(0); - awp_draw_reel(1); - } - - if (m_reel_flag && (m_reel_mux == STANDARD_REEL) && m_reels) - { - 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; + m_reel0->update( data &0x0F); + m_reel1->update((data >> 4)&0x0F); + awp_draw_reel(0, m_reel0); + awp_draw_reel(1, m_reel1); } } @@ -1204,25 +1178,17 @@ WRITE8_MEMBER(mpu4_state::pia_ic7_porta_w) LOG(("%s: IC7 PIA Port A Set to %2x (Reel C and D)\n", machine().describe_context(),data)); if (m_reel_mux == SEVEN_REEL) { - stepper_update(5, data&0x0F); - stepper_update(6, (data >> 4)&0x0F); - awp_draw_reel(5); - awp_draw_reel(6); + m_reel5->update( data &0x0F); + m_reel6->update((data >> 4)&0x0F); + awp_draw_reel(5, m_reel5); + awp_draw_reel(6, m_reel6); } else if (m_reels) { - stepper_update(2, data & 0x0F ); - stepper_update(3, (data>>4) & 0x0F ); - awp_draw_reel(2); - awp_draw_reel(3); - } - - if (m_reel_flag && (m_reel_mux == STANDARD_REEL) && m_reels) - { - 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_reel2->update( data &0x0F); + m_reel3->update((data >> 4)&0x0F); + awp_draw_reel(2, m_reel2); + awp_draw_reel(3, m_reel3); } } @@ -2230,16 +2196,6 @@ void mpu4_state::mpu4_config_common() } -void mpu4_state::mpu4_config_common_reels(int reels) -{ - int n; - /* setup n default 96 half step reels, using the standard optic flag */ - for ( n = 0; n < reels; n++ ) - { - stepper_config(machine(), n, &barcrest_reel_interface); - } -} - MACHINE_START_MEMBER(mpu4_state,mod2) { mpu4_config_common(); @@ -2368,12 +2324,12 @@ DRIVER_INIT_MEMBER(mpu4_state,m_oldtmr) m_reel_mux=SIX_REEL_1TO8; m_reels = 6; - stepper_config(machine(), 0, &barcrest_opto1_interface); - stepper_config(machine(), 1, &barcrest_opto1_interface); - stepper_config(machine(), 2, &barcrest_opto1_interface); - stepper_config(machine(), 3, &barcrest_opto1_interface); - stepper_config(machine(), 4, &barcrest_opto1_interface); - stepper_config(machine(), 5, &barcrest_opto1_interface); + m_reel0->configure(&barcrest_opto1_interface); + m_reel1->configure(&barcrest_opto1_interface); + m_reel2->configure(&barcrest_opto1_interface); + m_reel3->configure(&barcrest_opto1_interface); + m_reel4->configure(&barcrest_opto1_interface); + m_reel5->configure(&barcrest_opto1_interface); DRIVER_INIT_CALL(m4default_banks); m_current_chr_table = oldtmr_data; @@ -2384,12 +2340,12 @@ DRIVER_INIT_MEMBER(mpu4_state,m4altreels) m_reel_mux=SIX_REEL_1TO8; m_reels = 6; - stepper_config(machine(), 0, &barcrest_opto1_interface); - stepper_config(machine(), 1, &barcrest_opto1_interface); - stepper_config(machine(), 2, &barcrest_opto1_interface); - stepper_config(machine(), 3, &barcrest_opto1_interface); - stepper_config(machine(), 4, &barcrest_opto1_interface); - stepper_config(machine(), 5, &barcrest_opto1_interface); + m_reel0->configure(&barcrest_opto1_interface); + m_reel1->configure(&barcrest_opto1_interface); + m_reel2->configure(&barcrest_opto1_interface); + m_reel3->configure(&barcrest_opto1_interface); + m_reel4->configure(&barcrest_opto1_interface); + m_reel5->configure(&barcrest_opto1_interface); DRIVER_INIT_CALL(m4default_banks); } @@ -2412,7 +2368,11 @@ DRIVER_INIT_MEMBER(mpu4_state,m_grtecp) m_reels = 5; m_lamp_extender=SMALL_CARD; // setup 4 default 96 half step reels with the mux board - mpu4_config_common_reels(5); + m_reel0->configure(&barcrest_reel_interface); + m_reel1->configure(&barcrest_reel_interface); + m_reel2->configure(&barcrest_reel_interface); + m_reel3->configure(&barcrest_reel_interface); + m_reel4->configure(&barcrest_reel_interface); DRIVER_INIT_CALL(m4default_banks); m_current_chr_table = grtecp_data; @@ -2423,11 +2383,11 @@ DRIVER_INIT_MEMBER(mpu4_state,m_blsbys) m_bwb_bank=1; m_reel_mux=FIVE_REEL_5TO8; m_reels = 5; - stepper_config(machine(), 0, &bwb_opto1_interface); - stepper_config(machine(), 1, &bwb_opto1_interface); - stepper_config(machine(), 2, &bwb_opto1_interface); - stepper_config(machine(), 3, &bwb_opto1_interface); - stepper_config(machine(), 4, &bwb_opto1_interface); + m_reel0->configure(&bwb_opto1_interface); + m_reel1->configure(&bwb_opto1_interface); + m_reel2->configure(&bwb_opto1_interface); + m_reel3->configure(&bwb_opto1_interface); + m_reel4->configure(&bwb_opto1_interface); m_bwb_chr_table1 = blsbys_data1; m_current_chr_table = blsbys_data; DRIVER_INIT_CALL(m4default_big); @@ -2437,7 +2397,10 @@ DRIVER_INIT_MEMBER(mpu4_state,m4default_reels) { m_reel_mux=STANDARD_REEL; m_reels = 4; - mpu4_config_common_reels(4); + m_reel0->configure(&barcrest_reel_interface); + m_reel1->configure(&barcrest_reel_interface); + m_reel2->configure(&barcrest_reel_interface); + m_reel3->configure(&barcrest_reel_interface); m_bwb_bank=0; } @@ -2453,14 +2416,14 @@ DRIVER_INIT_MEMBER(mpu4_state,m4default_alt) { m_reel_mux=STANDARD_REEL; m_reels = 8; - stepper_config(machine(), 0, &barcrest_opto2_interface); - stepper_config(machine(), 1, &barcrest_opto2_interface); - stepper_config(machine(), 2, &barcrest_opto2_interface); - stepper_config(machine(), 3, &barcrest_opto2_interface); - stepper_config(machine(), 4, &barcrest_opto2_interface); - stepper_config(machine(), 5, &barcrest_opto2_interface); - stepper_config(machine(), 6, &barcrest_opto2_interface); - stepper_config(machine(), 7, &barcrest_opto2_interface); + m_reel0->configure(&barcrest_opto2_interface); + m_reel1->configure(&barcrest_opto2_interface); + m_reel2->configure(&barcrest_opto2_interface); + m_reel3->configure(&barcrest_opto2_interface); + m_reel4->configure(&barcrest_opto2_interface); + m_reel5->configure(&barcrest_opto2_interface); + m_reel6->configure(&barcrest_opto2_interface); + m_reel7->configure(&barcrest_opto2_interface); DRIVER_INIT_CALL(m4default_banks); m_bwb_bank=0; diff --git a/src/mame/drivers/mpu4vid.c b/src/mame/drivers/mpu4vid.c index 7b071ee7b79..ae51ce1a095 100644 --- a/src/mame/drivers/mpu4vid.c +++ b/src/mame/drivers/mpu4vid.c @@ -1263,8 +1263,6 @@ MACHINE_RESET_MEMBER(mpu4vid_state,mpu4_vid) { m_vfd->reset(); //for debug ports only - mpu4_stepper_reset(); - m_lamp_strobe = 0; m_lamp_strobe2 = 0; m_led_strobe = 0; diff --git a/src/mame/includes/bfm_sc45.h b/src/mame/includes/bfm_sc45.h index 3b8eaabca1c..cefd22fb394 100644 --- a/src/mame/includes/bfm_sc45.h +++ b/src/mame/includes/bfm_sc45.h @@ -101,6 +101,12 @@ public: m_maincpu(*this, "maincpu"), m_cpuregion(*this, "maincpu"), m_nvram(*this, "nvram"), + m_reel0(*this, "reel0"), + m_reel1(*this, "reel1"), + m_reel2(*this, "reel2"), + m_reel3(*this, "reel3"), + m_reel4(*this, "reel4"), + m_reel5(*this, "reel5"), m_io1(*this, "IN-0"), m_io2(*this, "IN-1"), m_io3(*this, "IN-2"), @@ -122,6 +128,12 @@ public: required_memory_region m_cpuregion; // devices required_device m_nvram; + required_device m_reel0; + required_device m_reel1; + required_device m_reel2; + required_device m_reel3; + required_device m_reel4; + required_device m_reel5; const stepper_interface **m_reel_setup; @@ -131,6 +143,12 @@ public: int m_reel4_latch; int m_reel56_latch; 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; } SEC sec; int m_meterstatus; diff --git a/src/mame/includes/jpmimpct.h b/src/mame/includes/jpmimpct.h index bfa6eeabe19..6058a9293d0 100644 --- a/src/mame/includes/jpmimpct.h +++ b/src/mame/includes/jpmimpct.h @@ -4,6 +4,7 @@ ****************************************************************************/ #include "machine/roc10937.h" +#include "machine/steppers.h" #include "cpu/tms34010/tms34010.h" #include "sound/upd7759.h" @@ -62,7 +63,14 @@ public: m_maincpu(*this, "maincpu"), m_upd7759(*this, "upd"), m_palette(*this, "palette"), - m_dsp(*this, "dsp") { } + m_dsp(*this, "dsp"), + m_reel0(*this, "reel0"), + m_reel1(*this, "reel1"), + m_reel2(*this, "reel2"), + m_reel3(*this, "reel3"), + m_reel4(*this, "reel4"), + m_reel5(*this, "reel5") + { } UINT8 m_tms_irq; UINT8 m_duart_1_irq; @@ -72,6 +80,12 @@ public: int m_lamp_strobe; UINT8 m_Lamps[256]; 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; } int m_payen; int m_alpha_clock; int m_hopinhibit; @@ -123,4 +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; }; diff --git a/src/mame/includes/maygay1b.h b/src/mame/includes/maygay1b.h index 423f7f82d17..0b37fef1537 100644 --- a/src/mame/includes/maygay1b.h +++ b/src/mame/includes/maygay1b.h @@ -44,7 +44,13 @@ public: m_s5_port(*this, "STROBE5"), m_s6_port(*this, "STROBE6"), m_s7_port(*this, "STROBE7"), - m_bank1(*this, "bank1") + m_bank1(*this, "bank1"), + m_reel0(*this, "reel0"), + m_reel1(*this, "reel1"), + m_reel2(*this, "reel2"), + m_reel3(*this, "reel3"), + m_reel4(*this, "reel4"), + m_reel5(*this, "reel5") {} required_device m_maincpu; @@ -63,6 +69,12 @@ public: required_ioport m_s6_port; required_ioport m_s7_port; required_memory_bank m_bank1; + required_device m_reel0; + required_device m_reel1; + required_device m_reel2; + required_device m_reel3; + required_device m_reel4; + required_device m_reel5; UINT8 m_lamppos; int m_lamp_strobe; @@ -79,6 +91,12 @@ public: TIMER_DEVICE_CALLBACK_MEMBER( maygay1b_nmitimer_callback ); UINT8 m_Lamps[256]; 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_WRITE8_MEMBER(scanlines_w); DECLARE_WRITE8_MEMBER(lamp_data_w); DECLARE_WRITE8_MEMBER(lamp_data_2_w); @@ -111,7 +129,6 @@ public: virtual void machine_reset(); void cpu0_firq(int data); void cpu0_nmi(); - void m1_stepper_reset(); }; MACHINE_CONFIG_EXTERN( maygay_m1 ); diff --git a/src/mame/includes/mpu4.h b/src/mame/includes/mpu4.h index babb3616f88..fa31e3ddd4c 100644 --- a/src/mame/includes/mpu4.h +++ b/src/mame/includes/mpu4.h @@ -113,6 +113,14 @@ public: m_aux2_port(*this, "AUX2"), m_bank1(*this, "bank1"), m_msm6376(*this, "msm6376"), + m_reel0(*this, "reel0"), + m_reel1(*this, "reel1"), + m_reel2(*this, "reel2"), + m_reel3(*this, "reel3"), + m_reel4(*this, "reel4"), + m_reel5(*this, "reel5"), + m_reel6(*this, "reel6"), + m_reel7(*this, "reel7"), m_palette(*this, "palette") {} @@ -212,7 +220,6 @@ protected: void lamp_extend_large(int data,int column,int active); void led_write_latch(int latch, int data, int column); void update_meters(); - void mpu4_stepper_reset(); void ic23_update(); void ic24_output(int data); void ic24_setup(); @@ -242,6 +249,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; enum { @@ -280,6 +295,14 @@ 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; diff --git a/src/mame/video/awpvid.c b/src/mame/video/awpvid.c index 06f2b43e41b..e04ba240985 100644 --- a/src/mame/video/awpvid.c +++ b/src/mame/video/awpvid.c @@ -18,13 +18,13 @@ static UINT16 reelpos[MAX_STEPPERS]; -void awp_draw_reel(int rno) +void awp_draw_reel(int rno, stepper_device &reel) { int x = rno + 1; char rg[16]; sprintf(rg,"reel%d", x); - reelpos[rno] = stepper_get_position(rno); + reelpos[rno] = reel.get_position(); if (reelpos[rno] == output_get_value(rg)) { // Not moved, no need to update. @@ -34,11 +34,11 @@ void awp_draw_reel(int rno) output_set_value(rg,(reelpos[rno])); // if the reel isn't configured don't do this, otherwise you'll get DIV0 - if (stepper_get_max(rno)) + if (reel.get_max()) { sprintf(rg,"sreel%d", x); // our new scrolling reels are called 'sreel' // normalize the value - int sreelpos = (reelpos[rno] * 0x10000) / stepper_get_max(rno); + int sreelpos = (reelpos[rno] * 0x10000) / reel.get_max(); output_set_value(rg,sreelpos); } diff --git a/src/mame/video/awpvid.h b/src/mame/video/awpvid.h index 2f40938dc3a..3cf81ee3c03 100644 --- a/src/mame/video/awpvid.h +++ b/src/mame/video/awpvid.h @@ -6,6 +6,8 @@ #ifndef AWP_VIDEO #define AWP_VIDEO -void awp_draw_reel(int rno); +#include "machine/steppers.h" + +void awp_draw_reel(int rno, stepper_device &reel); #endif