diff options
Diffstat (limited to 'src/mame/machine/ticket.cpp')
-rw-r--r-- | src/mame/machine/ticket.cpp | 49 |
1 files changed, 12 insertions, 37 deletions
diff --git a/src/mame/machine/ticket.cpp b/src/mame/machine/ticket.cpp index bb7c4481f98..2180d4fd17e 100644 --- a/src/mame/machine/ticket.cpp +++ b/src/mame/machine/ticket.cpp @@ -44,7 +44,6 @@ ticket_dispenser_device::ticket_dispenser_device(const machine_config &mconfig, m_status_sense(TICKET_STATUS_ACTIVE_LOW), m_period(attotime::from_msec(100)), m_hopper_type(false), - m_active_bit(0x80), m_motoron(0), m_ticketdispensed(0), m_ticketnotdispensed(0), @@ -99,19 +98,7 @@ void ticket_dispenser_device::static_set_senses(device_t &device, uint8_t motor_ //************************************************************************** //------------------------------------------------- -// read - read the status line via the active bit -// (legacy method) -//------------------------------------------------- - -READ8_MEMBER( ticket_dispenser_device::read ) -{ - LOG(("%s: Ticket Status Read = %02X\n", machine().describe_context(), m_status)); - return m_status; -} - - -//------------------------------------------------- -// line_r - read the status line as a proper line +// line_r - read the status line //------------------------------------------------- READ_LINE_MEMBER( ticket_dispenser_device::line_r ) @@ -121,20 +108,19 @@ READ_LINE_MEMBER( ticket_dispenser_device::line_r ) //------------------------------------------------- -// write - write the control line via the active -// bit (legacy method) +// motor_w - write the control line //------------------------------------------------- -WRITE8_MEMBER( ticket_dispenser_device::write ) +WRITE_LINE_MEMBER( ticket_dispenser_device::motor_w ) { // On an activate signal, start dispensing! - if ((data & m_active_bit) == m_motoron) + if (bool(state) == m_motoron) { if (!m_power) { LOG(("%s: Ticket Power On\n", machine().describe_context())); m_timer->adjust(m_period); - m_power = 1; + m_power = true; m_status = m_ticketnotdispensed; } } @@ -148,21 +134,11 @@ WRITE8_MEMBER( ticket_dispenser_device::write ) m_timer->adjust(attotime::never); machine().output().set_led_value(2, 0); } - m_power = 0; + m_power = false; } } } -//------------------------------------------------- -// motor_w - write the control line as a proper -// line -//------------------------------------------------- - -WRITE_LINE_MEMBER( ticket_dispenser_device::motor_w ) -{ - write(machine().dummy_space(), 0, state ? m_active_bit : 0); -} - //************************************************************************** // DEVICE INTERFACE @@ -174,10 +150,9 @@ WRITE_LINE_MEMBER( ticket_dispenser_device::motor_w ) void ticket_dispenser_device::device_start() { - m_active_bit = 0x80; - m_motoron = (m_motor_sense == TICKET_MOTOR_ACTIVE_HIGH) ? m_active_bit : 0; - m_ticketdispensed = (m_status_sense == TICKET_STATUS_ACTIVE_HIGH) ? m_active_bit : 0; - m_ticketnotdispensed = m_ticketdispensed ^ m_active_bit; + m_motoron = (m_motor_sense == TICKET_MOTOR_ACTIVE_HIGH); + m_ticketdispensed = (m_status_sense == TICKET_STATUS_ACTIVE_HIGH); + m_ticketnotdispensed = !m_ticketdispensed; m_timer = timer_alloc(); @@ -193,7 +168,7 @@ void ticket_dispenser_device::device_start() void ticket_dispenser_device::device_reset() { m_status = m_ticketnotdispensed; - m_power = 0x00; + m_power = false; } @@ -206,13 +181,13 @@ void ticket_dispenser_device::device_timer(emu_timer &timer, device_timer_id id, // if we still have power, keep toggling ticket states if (m_power) { - m_status ^= m_active_bit; + m_status = !m_status; LOG(("Ticket Status Changed to %02X\n", m_status)); m_timer->adjust(m_period); } else if (m_hopper_type) { - m_status ^= m_active_bit; + m_status = !m_status; LOG(("%s: Ticket Power Off\n", machine().describe_context())); m_timer->adjust(attotime::never); machine().output().set_led_value(2, 0); |