diff options
Diffstat (limited to 'src/devices/machine/ym3802.cpp')
-rw-r--r-- | src/devices/machine/ym3802.cpp | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/src/devices/machine/ym3802.cpp b/src/devices/machine/ym3802.cpp index 603a9d82f53..39008a2ea15 100644 --- a/src/devices/machine/ym3802.cpp +++ b/src/devices/machine/ym3802.cpp @@ -23,24 +23,20 @@ ym3802_device::ym3802_device(const machine_config &mconfig, const char *tag, dev , device_serial_interface(mconfig, *this) , m_irq_handler(*this) , m_txd_handler(*this) - , m_rxd_handler(*this) + , m_rxd_handler(*this, 0xff) , m_reg(REG_MAX) , m_wdr(0) , m_irq_status(0) , m_vector(0) , m_clkm_rate(500000) // TODO: make these configurable , m_clkf_rate(614400) - { - } +{ +} void ym3802_device::device_start() { - m_irq_handler.resolve_safe(); - m_txd_handler.resolve_safe(); - m_rxd_handler.resolve_safe(0xff); - m_clock_timer = timer_alloc(TIMER_SYSTEM_CLOCK); - m_midi_timer = timer_alloc(TIMER_TX_CLOCK); - m_midi_counter_timer = timer_alloc(TIMER_MIDI_CLOCK); + m_midi_timer = timer_alloc(FUNC(ym3802_device::transmit_clk), this); + m_midi_counter_timer = timer_alloc(FUNC(ym3802_device::midi_clk), this); save_item(NAME(m_reg)); } @@ -54,20 +50,6 @@ void ym3802_device::device_reset() set_comms_mode(); } -void ym3802_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - // TODO: support clock and timers - switch(id) - { - case TIMER_TX_CLOCK: - transmit_clk(); - break; - case TIMER_MIDI_CLOCK: - midi_clk(); - break; - } -} - void ym3802_device::set_irq(uint8_t irq) { uint8_t x; @@ -90,7 +72,7 @@ void ym3802_device::reset_irq(uint8_t irq) m_irq_handler(CLEAR_LINE); } -void ym3802_device::transmit_clk() +TIMER_CALLBACK_MEMBER(ym3802_device::transmit_clk) { if(m_reg[REG_TCR] & 0x01) // Tx Enable { @@ -116,7 +98,7 @@ void ym3802_device::transmit_clk() } } -void ym3802_device::midi_clk() +TIMER_CALLBACK_MEMBER(ym3802_device::midi_clk) { if(m_midi_counter_base > 1) // counter is not guaranteed to work if set to 0 or 1. { @@ -188,7 +170,7 @@ void ym3802_device::set_comms_mode() logerror("MIDI comms set to 1 start bit, %i data bits, %s, parity = %i\n",data_bits, (stop_bits == STOP_BITS_2) ? "2 stop bits" : "1 stop bit", parity); } -READ8_MEMBER(ym3802_device::read) +uint8_t ym3802_device::read(offs_t offset) { if(offset < 4) { @@ -225,7 +207,7 @@ READ8_MEMBER(ym3802_device::read) } } -WRITE8_MEMBER(ym3802_device::write) +void ym3802_device::write(offs_t offset, uint8_t data) { m_wdr = data; if(offset == 1) |