From 0859b239939f93aeb1c0a8411dbd892cbea454c4 Mon Sep 17 00:00:00 2001 From: DavidHaywood <28625134+DavidHaywood@users.noreply.github.com> Date: Mon, 25 Mar 2019 16:55:31 +0000 Subject: [PATCH] tidy (nw) --- src/devices/machine/spg2xx.cpp | 47 +++++------------------- src/devices/machine/spg2xx.h | 66 +++++----------------------------- 2 files changed, 17 insertions(+), 96 deletions(-) diff --git a/src/devices/machine/spg2xx.cpp b/src/devices/machine/spg2xx.cpp index ff96082e958..21a38f23c44 100644 --- a/src/devices/machine/spg2xx.cpp +++ b/src/devices/machine/spg2xx.cpp @@ -1032,45 +1032,6 @@ void spg2xx_device::device_timer(emu_timer &timer, device_timer_id id, int param } -void spg2xx_device::check_irqs(const uint16_t changed) -{ - // { - // m_cpu->set_state_unsynced(UNSP_IRQ1_LINE, ASSERT_LINE); - // } - -#if 0 - if (changed & 0x0c00) // Timer A, Timer B IRQ - { - LOGMASKED(LOG_TIMERS, "%ssserting IRQ2 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00), changed); - m_cpu->set_state_unsynced(UNSP_IRQ2_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0c00) ? ASSERT_LINE : CLEAR_LINE); - } - - if (changed & 0x2100) // UART, ADC IRQ - { - LOGMASKED(LOG_UART, "%ssserting IRQ3 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x2100) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x2100), changed); - m_cpu->set_state_unsynced(UNSP_IRQ3_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x2100) ? ASSERT_LINE : CLEAR_LINE); - } - - if (changed & 0x1200) // External IRQ - { - LOGMASKED(LOG_UART, "%ssserting IRQ5 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200), changed); - m_cpu->set_state_unsynced(UNSP_IRQ5_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x1200) ? ASSERT_LINE : CLEAR_LINE); - } - - if (changed & 0x0070) // 1024Hz, 2048Hz, 4096Hz IRQ - { - LOGMASKED(LOG_TIMERS, "%ssserting IRQ6 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070), changed); - m_cpu->set_state_unsynced(UNSP_IRQ6_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x0070) ? ASSERT_LINE : CLEAR_LINE); - } - - if (changed & 0x008b) // TMB1, TMB2, 4Hz, key change IRQ - { - LOGMASKED(LOG_IRQS, "%ssserting IRQ7 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b), changed); - m_cpu->set_state_unsynced(UNSP_IRQ7_LINE, (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x008b) ? ASSERT_LINE : CLEAR_LINE); - } -#endif -} - void spg2xx_device::do_cpu_dma(uint32_t len) { address_space &mem = m_cpu->space(AS_PROGRAM); @@ -1100,5 +1061,13 @@ void spg2xx_device::device_add_mconfig(machine_config &config) m_spg_audio->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1); SPG24X_IO(config, m_spg_io, DERIVED_CLOCK(1, 1), m_cpu, m_screen); + m_spg_io->porta_in().set(FUNC(spg2xx_device::porta_r)); + m_spg_io->portb_in().set(FUNC(spg2xx_device::portb_r)); + m_spg_io->portc_in().set(FUNC(spg2xx_device::portc_r)); + m_spg_io->porta_out().set(FUNC(spg2xx_device::porta_w)); + m_spg_io->portb_out().set(FUNC(spg2xx_device::portb_w)); + m_spg_io->portc_out().set(FUNC(spg2xx_device::portc_w)); + + } diff --git a/src/devices/machine/spg2xx.h b/src/devices/machine/spg2xx.h index 8d97cd30135..4b79d3f0fb9 100644 --- a/src/devices/machine/spg2xx.h +++ b/src/devices/machine/spg2xx.h @@ -105,9 +105,6 @@ protected: DECLARE_READ16_MEMBER(video_r); DECLARE_WRITE16_MEMBER(video_w); -// virtual DECLARE_READ16_MEMBER(io_r); -// virtual DECLARE_WRITE16_MEMBER(io_w); - DECLARE_READ16_MEMBER(dma_r); DECLARE_WRITE16_MEMBER(dma_w); @@ -115,41 +112,17 @@ protected: DECLARE_READ16_MEMBER(space_r); // void check_extint_irq(int channel); - void check_irqs(const uint16_t changed); inline void check_video_irq(); void spg2xx_map(address_map &map); -// static const device_timer_id TIMER_TMB1 = 0; -// static const device_timer_id TIMER_TMB2 = 1; static const device_timer_id TIMER_SCREENPOS = 2; -// static const device_timer_id TIMER_BEAT = 3; -// static const device_timer_id TIMER_UART_TX = 4; -// static const device_timer_id TIMER_UART_RX = 5; -// static const device_timer_id TIMER_4KHZ = 6; -// static const device_timer_id TIMER_SRC_AB = 7; -// static const device_timer_id TIMER_SRC_C = 8; + virtual void device_start() override; virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; -// void update_porta_special_modes(); -// void update_portb_special_modes(); -// void do_gpio(uint32_t offset, bool write); -// uint16_t do_special_gpio(uint32_t index, uint16_t mask); - -// void update_timer_b_rate(); -// void update_timer_ab_src(); -// void update_timer_c_src(); -// void increment_timer_a(); - -// void uart_transmit_tick(); -// void uart_receive_tick(); - -// void system_timer_tick(); - -// void do_i2c(); void do_cpu_dma(uint32_t len); void do_sprite_dma(uint32_t len); @@ -195,18 +168,7 @@ protected: bool m_debug_palette; uint8_t m_sprite_index_to_debug; - -// uint16_t m_io_regs[0x100]; uint16_t m_dma_regs[0x4]; -// uint8_t m_uart_rx_fifo[8]; -// uint8_t m_uart_rx_fifo_start; -// uint8_t m_uart_rx_fifo_end; -// uint8_t m_uart_rx_fifo_count; -// bool m_uart_rx_available; -// bool m_uart_rx_irq; -// bool m_uart_tx_irq; - -// bool m_extint[2]; uint16_t m_video_regs[0x100]; uint32_t m_sprite_limit; @@ -229,31 +191,21 @@ protected: devcb_write8 m_chip_sel; -// uint16_t m_timer_a_preload; -// uint16_t m_timer_b_preload; -// uint16_t m_timer_b_divisor; -// uint16_t m_timer_b_tick_rate; - -// emu_timer *m_tmb1; -// emu_timer *m_tmb2; -// emu_timer *m_timer_src_ab; -// emu_timer *m_timer_src_c; emu_timer *m_screenpos_timer; -// emu_timer *m_4khz_timer; -// uint32_t m_2khz_divider; -// uint32_t m_1khz_divider; -// uint32_t m_4hz_divider; - -// uint32_t m_uart_baud_rate; -// emu_timer *m_uart_tx_timer; -// emu_timer *m_uart_rx_timer; - required_device m_cpu; required_device m_screen; required_shared_ptr m_scrollram; required_shared_ptr m_paletteram; required_shared_ptr m_spriteram; + + DECLARE_READ16_MEMBER(porta_r) { return m_porta_in(); }; + DECLARE_READ16_MEMBER(portb_r) { return m_portb_in(); }; + DECLARE_READ16_MEMBER(portc_r) { return m_portc_in(); }; + DECLARE_WRITE16_MEMBER(porta_w) { m_porta_out(offset, data, mem_mask); }; + DECLARE_WRITE16_MEMBER(portb_w) { m_portb_out(offset, data, mem_mask); }; + DECLARE_WRITE16_MEMBER(portc_w) { m_portc_out(offset, data, mem_mask); }; + }; class spg24x_device : public spg2xx_device