add hopper-like mode to ticket dispenser device
This commit is contained in:
parent
93638e1cc2
commit
98fb80a8ca
@ -256,14 +256,8 @@ WRITE8_MEMBER(stv_state::stvmp_ioga_w)
|
|||||||
|
|
||||||
WRITE8_MEMBER(stv_state::hop_ioga_w)
|
WRITE8_MEMBER(stv_state::hop_ioga_w)
|
||||||
{
|
{
|
||||||
if (offset == 7) {
|
if (offset == 7)
|
||||||
if ((data & 0x80) == 0) {
|
m_hopper->motor_w(data & 0x80);
|
||||||
m_hopper->motor_w(0); //
|
|
||||||
m_hopper->motor_w(0x80); // ugly hack to reset status of ticket dispenser device
|
|
||||||
m_hopper->motor_w(0);
|
|
||||||
} else
|
|
||||||
m_hopper->motor_w(0x80);
|
|
||||||
}
|
|
||||||
stv_ioga_w(space, offset, data);
|
stv_ioga_w(space, offset, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1141,7 +1135,7 @@ static MACHINE_CONFIG_DERIVED( stv_slot, stv )
|
|||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
static MACHINE_CONFIG_DERIVED( hopper, stv )
|
static MACHINE_CONFIG_DERIVED( hopper, stv )
|
||||||
MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
|
MCFG_HOPPER_ADD("hopper", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
MACHINE_RESET_MEMBER(stv_state,stv)
|
MACHINE_RESET_MEMBER(stv_state,stv)
|
||||||
|
@ -43,6 +43,7 @@ ticket_dispenser_device::ticket_dispenser_device(const machine_config &mconfig,
|
|||||||
m_motor_sense(TICKET_MOTOR_ACTIVE_LOW),
|
m_motor_sense(TICKET_MOTOR_ACTIVE_LOW),
|
||||||
m_status_sense(TICKET_STATUS_ACTIVE_LOW),
|
m_status_sense(TICKET_STATUS_ACTIVE_LOW),
|
||||||
m_period(attotime::from_msec(100)),
|
m_period(attotime::from_msec(100)),
|
||||||
|
m_hopper_type(false),
|
||||||
m_active_bit(0x80),
|
m_active_bit(0x80),
|
||||||
m_motoron(0),
|
m_motoron(0),
|
||||||
m_ticketdispensed(0),
|
m_ticketdispensed(0),
|
||||||
@ -83,11 +84,12 @@ void ticket_dispenser_device::static_set_period(device_t &device, const attotime
|
|||||||
// the motor and status bits
|
// the motor and status bits
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
void ticket_dispenser_device::static_set_senses(device_t &device, uint8_t motor_sense, uint8_t status_sense)
|
void ticket_dispenser_device::static_set_senses(device_t &device, uint8_t motor_sense, uint8_t status_sense, bool hopper_type)
|
||||||
{
|
{
|
||||||
ticket_dispenser_device &ticket = downcast<ticket_dispenser_device &>(device);
|
ticket_dispenser_device &ticket = downcast<ticket_dispenser_device &>(device);
|
||||||
ticket.m_motor_sense = motor_sense;
|
ticket.m_motor_sense = motor_sense;
|
||||||
ticket.m_status_sense = status_sense;
|
ticket.m_status_sense = status_sense;
|
||||||
|
ticket.m_hopper_type = hopper_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -139,10 +141,13 @@ WRITE8_MEMBER( ticket_dispenser_device::write )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_power)
|
if (m_power)
|
||||||
|
{
|
||||||
|
if (m_hopper_type == false || m_status == m_ticketnotdispensed)
|
||||||
{
|
{
|
||||||
LOG(("%s: Ticket Power Off\n", machine().describe_context()));
|
LOG(("%s: Ticket Power Off\n", machine().describe_context()));
|
||||||
m_timer->adjust(attotime::never);
|
m_timer->adjust(attotime::never);
|
||||||
machine().output().set_led_value(2, 0);
|
machine().output().set_led_value(2, 0);
|
||||||
|
}
|
||||||
m_power = 0;
|
m_power = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,6 +210,13 @@ void ticket_dispenser_device::device_timer(emu_timer &timer, device_timer_id id,
|
|||||||
LOG(("Ticket Status Changed to %02X\n", m_status));
|
LOG(("Ticket Status Changed to %02X\n", m_status));
|
||||||
m_timer->adjust(m_period);
|
m_timer->adjust(m_period);
|
||||||
}
|
}
|
||||||
|
else if (m_hopper_type)
|
||||||
|
{
|
||||||
|
m_status ^= m_active_bit;
|
||||||
|
LOG(("%s: Ticket Power Off\n", machine().describe_context()));
|
||||||
|
m_timer->adjust(attotime::never);
|
||||||
|
machine().output().set_led_value(2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// update LED status (fixme: should map to an output)
|
// update LED status (fixme: should map to an output)
|
||||||
machine().output().set_led_value(2, (m_status == m_ticketdispensed));
|
machine().output().set_led_value(2, (m_status == m_ticketdispensed));
|
||||||
|
@ -30,8 +30,12 @@ DECLARE_DEVICE_TYPE(TICKET_DISPENSER, ticket_dispenser_device)
|
|||||||
#define MCFG_TICKET_DISPENSER_ADD(_tag, _period_in_msec, _motor_sense, _status_sense) \
|
#define MCFG_TICKET_DISPENSER_ADD(_tag, _period_in_msec, _motor_sense, _status_sense) \
|
||||||
MCFG_DEVICE_ADD(_tag, TICKET_DISPENSER, 0) \
|
MCFG_DEVICE_ADD(_tag, TICKET_DISPENSER, 0) \
|
||||||
ticket_dispenser_device::static_set_period(*device, _period_in_msec); \
|
ticket_dispenser_device::static_set_period(*device, _period_in_msec); \
|
||||||
ticket_dispenser_device::static_set_senses(*device, _motor_sense, _status_sense);
|
ticket_dispenser_device::static_set_senses(*device, _motor_sense, _status_sense, false);
|
||||||
|
|
||||||
|
#define MCFG_HOPPER_ADD(_tag, _period_in_msec, _motor_sense, _status_sense) \
|
||||||
|
MCFG_DEVICE_ADD(_tag, TICKET_DISPENSER, 0) \
|
||||||
|
ticket_dispenser_device::static_set_period(*device, _period_in_msec); \
|
||||||
|
ticket_dispenser_device::static_set_senses(*device, _motor_sense, _status_sense, true);
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// CONSTANTS
|
// CONSTANTS
|
||||||
@ -60,7 +64,7 @@ public:
|
|||||||
|
|
||||||
// inline configuration helpers
|
// inline configuration helpers
|
||||||
static void static_set_period(device_t &device, const attotime &period);
|
static void static_set_period(device_t &device, const attotime &period);
|
||||||
static void static_set_senses(device_t &device, uint8_t motor_sense, uint8_t status_sense);
|
static void static_set_senses(device_t &device, uint8_t motor_sense, uint8_t status_sense, bool hopper_type);
|
||||||
|
|
||||||
// read/write handlers
|
// read/write handlers
|
||||||
DECLARE_READ8_MEMBER( read );
|
DECLARE_READ8_MEMBER( read );
|
||||||
@ -78,6 +82,7 @@ protected:
|
|||||||
uint8_t m_motor_sense;
|
uint8_t m_motor_sense;
|
||||||
uint8_t m_status_sense;
|
uint8_t m_status_sense;
|
||||||
attotime m_period;
|
attotime m_period;
|
||||||
|
bool m_hopper_type;
|
||||||
|
|
||||||
// active state
|
// active state
|
||||||
uint8_t m_active_bit;
|
uint8_t m_active_bit;
|
||||||
|
Loading…
Reference in New Issue
Block a user