From 8b69ca54e27136efa1d8ac8db85e1f3d69d6c9ef Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 11 Jun 2020 18:00:25 +0200 Subject: namco5*: set_input_line is synced, don't need extra synchronize (nw) --- src/mame/audio/namco52.cpp | 8 ++++- src/mame/audio/namco52.h | 3 ++ src/mame/audio/namco54.cpp | 10 +++++- src/mame/audio/namco54.h | 3 ++ src/mame/drivers/galaga.cpp | 7 ++++ src/mame/drivers/polepos.cpp | 2 ++ src/mame/machine/namco50.cpp | 7 +--- src/mame/machine/namco50.h | 1 - src/mame/machine/namco51.cpp | 9 ++--- src/mame/machine/namco51.h | 1 - src/mame/machine/namco53.cpp | 7 +--- src/mame/machine/namco53.h | 2 -- src/mame/video/starfield_05xx.cpp | 70 ++++++++++++++++++--------------------- 13 files changed, 68 insertions(+), 62 deletions(-) diff --git a/src/mame/audio/namco52.cpp b/src/mame/audio/namco52.cpp index 0b960a69604..557c2f74148 100644 --- a/src/mame/audio/namco52.cpp +++ b/src/mame/audio/namco52.cpp @@ -116,9 +116,14 @@ void namco_52xx_device::write(uint8_t data) // TODO: should use chip_select line for this m_cpu->set_input_line(0, ASSERT_LINE); - machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(namco_52xx_device::irq_clear),this), 0); + machine().scheduler().timer_set(m_irq_duration, timer_expired_delegate(FUNC(namco_52xx_device::irq_clear),this), 0); } +WRITE_LINE_MEMBER( namco_52xx_device::chip_select ) +{ + // TODO: broken sound when using this + //m_cpu->set_input_line(0, state); +} TIMER_CALLBACK_MEMBER( namco_52xx_device::external_clock_pulse ) { @@ -143,6 +148,7 @@ namco_52xx_device::namco_52xx_device(const machine_config &mconfig, const char * : device_t(mconfig, NAMCO_52XX, tag, owner, clock), m_cpu(*this, "mcu"), m_discrete(*this, finder_base::DUMMY_TAG), + m_irq_duration(attotime::from_usec(100)), m_basenode(0), m_extclock(0), m_romread(*this), diff --git a/src/mame/audio/namco52.h b/src/mame/audio/namco52.h index 514c25d9c31..a2589186a80 100644 --- a/src/mame/audio/namco52.h +++ b/src/mame/audio/namco52.h @@ -16,8 +16,10 @@ public: void set_extclock(attoseconds_t clk) { m_extclock = clk; } auto romread_callback() { return m_romread.bind(); } auto si_callback() { return m_si.bind(); } + namco_52xx_device &set_irq_duration(attotime t) { m_irq_duration = t; return *this; } DECLARE_WRITE_LINE_MEMBER( reset ); + WRITE_LINE_MEMBER( chip_select ); void write(uint8_t data); protected: @@ -35,6 +37,7 @@ private: required_device m_cpu; required_device m_discrete; + attotime m_irq_duration; int m_basenode; attoseconds_t m_extclock; emu_timer *m_extclock_pulse_timer; diff --git a/src/mame/audio/namco54.cpp b/src/mame/audio/namco54.cpp index d81b48acd21..c86712c76e3 100644 --- a/src/mame/audio/namco54.cpp +++ b/src/mame/audio/namco54.cpp @@ -101,7 +101,13 @@ void namco_54xx_device::write(uint8_t data) // TODO: should use chip_select line for this m_cpu->set_input_line(0, ASSERT_LINE); - machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(namco_54xx_device::irq_clear),this), 0); + machine().scheduler().timer_set(m_irq_duration, timer_expired_delegate(FUNC(namco_54xx_device::irq_clear),this), 0); +} + +WRITE_LINE_MEMBER( namco_54xx_device::chip_select ) +{ + // TODO: broken sound when using this + //m_cpu->set_input_line(0, state); } @@ -120,10 +126,12 @@ namco_54xx_device::namco_54xx_device(const machine_config &mconfig, const char * : device_t(mconfig, NAMCO_54XX, tag, owner, clock), m_cpu(*this, "mcu"), m_discrete(*this, finder_base::DUMMY_TAG), + m_irq_duration(attotime::from_usec(100)), m_basenode(0), m_latched_cmd(0) { } + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- diff --git a/src/mame/audio/namco54.h b/src/mame/audio/namco54.h index d1c015ad5c5..b9b929a43ed 100644 --- a/src/mame/audio/namco54.h +++ b/src/mame/audio/namco54.h @@ -14,8 +14,10 @@ public: template void set_discrete(T &&tag) { m_discrete.set_tag(std::forward(tag)); } void set_basenote(int node) { m_basenode = node; } + namco_54xx_device &set_irq_duration(attotime t) { m_irq_duration = t; return *this; } DECLARE_WRITE_LINE_MEMBER( reset ); + WRITE_LINE_MEMBER( chip_select ); void write(uint8_t data); protected: @@ -32,6 +34,7 @@ private: required_device m_cpu; required_device m_discrete; + attotime m_irq_duration; int m_basenode; uint8_t m_latched_cmd; diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp index ac803164eb9..e9b9f9bb531 100644 --- a/src/mame/drivers/galaga.cpp +++ b/src/mame/drivers/galaga.cpp @@ -1612,6 +1612,7 @@ void bosco_state::bosco(machine_config &config) namco_54xx_device &n54xx(NAMCO_54XX(config, "54xx", MASTER_CLOCK/6/2)); /* 1.536 MHz */ n54xx.set_discrete("discrete"); n54xx.set_basenote(NODE_01); + n54xx.set_irq_duration(attotime::from_usec(200)); namco_06xx_device &n06xx_0(NAMCO_06XX(config, "06xx_0", MASTER_CLOCK/6/64)); n06xx_0.set_maincpu(m_maincpu); @@ -1624,6 +1625,7 @@ void bosco_state::bosco(machine_config &config) n06xx_0.rw_callback<2>().set("50xx_1", FUNC(namco_50xx_device::rw)); n06xx_0.write_callback<2>().set("50xx_1", FUNC(namco_50xx_device::write)); n06xx_0.write_callback<3>().set("54xx", FUNC(namco_54xx_device::write)); + n06xx_0.chip_select_callback<3>().set("54xx", FUNC(namco_54xx_device::chip_select)); namco_06xx_device &n06xx_1(NAMCO_06XX(config, "06xx_1", MASTER_CLOCK/6/64)); n06xx_1.set_maincpu(m_subcpu); @@ -1632,6 +1634,7 @@ void bosco_state::bosco(machine_config &config) n06xx_1.rw_callback<2>().set("50xx_2", FUNC(namco_50xx_device::rw)); n06xx_1.write_callback<0>().set("50xx_2", FUNC(namco_50xx_device::write)); n06xx_1.write_callback<1>().set("52xx", FUNC(namco_52xx_device::write)); + n06xx_1.chip_select_callback<1>().set("52xx", FUNC(namco_52xx_device::chip_select)); LS259(config, m_videolatch); // 1B on video board m_videolatch->q_out_cb<0>().set(FUNC(galaga_state::flip_screen_w)).invert(); @@ -1645,6 +1648,7 @@ void bosco_state::bosco(machine_config &config) SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(MASTER_CLOCK/3, 384, 0, 288, 264, 16, 224+16); m_screen->set_screen_update(FUNC(bosco_state::screen_update_bosco)); + m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE); // starfield lfsr m_screen->screen_vblank().set(FUNC(bosco_state::screen_vblank_bosco)); m_screen->screen_vblank().append(FUNC(galaga_state::vblank_irq)); m_screen->screen_vblank().append("51xx", FUNC(namco_51xx_device::vblank)); @@ -1709,6 +1713,7 @@ void galaga_state::galaga(machine_config &config) n06xx.read_callback<0>().set("51xx", FUNC(namco_51xx_device::read)); n06xx.write_callback<0>().set("51xx", FUNC(namco_51xx_device::write)); n06xx.write_callback<3>().set("54xx", FUNC(namco_54xx_device::write)); + n06xx.chip_select_callback<3>().set("54xx", FUNC(namco_54xx_device::chip_select)); LS259(config, m_videolatch); // 5K on video board // Q0-Q5 to 05XX for starfield control @@ -1720,6 +1725,7 @@ void galaga_state::galaga(machine_config &config) SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(MASTER_CLOCK/3, 384, 0, 288, 264, 0, 224); m_screen->set_screen_update(FUNC(galaga_state::screen_update_galaga)); + m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE); // starfield lfsr m_screen->screen_vblank().set(FUNC(galaga_state::screen_vblank_galaga)); m_screen->screen_vblank().append(FUNC(galaga_state::vblank_irq)); m_screen->screen_vblank().append("51xx", FUNC(namco_51xx_device::vblank)); @@ -1829,6 +1835,7 @@ void xevious_state::xevious(machine_config &config) n06xx.read_callback<2>().set("50xx", FUNC(namco_50xx_device::read)); n06xx.write_callback<2>().set("50xx", FUNC(namco_50xx_device::write)); n06xx.write_callback<3>().set("54xx", FUNC(namco_54xx_device::write)); + n06xx.chip_select_callback<3>().set("54xx", FUNC(namco_54xx_device::chip_select)); WATCHDOG_TIMER(config, "watchdog").set_vblank_count(m_screen, 8); diff --git a/src/mame/drivers/polepos.cpp b/src/mame/drivers/polepos.cpp index ad7c1eef25e..ce713c5868a 100644 --- a/src/mame/drivers/polepos.cpp +++ b/src/mame/drivers/polepos.cpp @@ -893,7 +893,9 @@ void polepos_state::polepos(machine_config &config) n06xx.read_callback<1>().set("53xx", FUNC(namco_53xx_device::read)); n06xx.chip_select_callback<1>().set("53xx", FUNC(namco_53xx_device::chip_select)); n06xx.write_callback<2>().set("52xx", FUNC(namco_52xx_device::write)); + n06xx.chip_select_callback<2>().set("52xx", FUNC(namco_52xx_device::chip_select)); n06xx.write_callback<3>().set("54xx", FUNC(namco_54xx_device::write)); + n06xx.chip_select_callback<3>().set("54xx", FUNC(namco_54xx_device::chip_select)); WATCHDOG_TIMER(config, "watchdog").set_vblank_count(m_screen, 16); // 128V clocks the same as VBLANK diff --git a/src/mame/machine/namco50.cpp b/src/mame/machine/namco50.cpp index 3a18a39cfb8..d9dad75941e 100644 --- a/src/mame/machine/namco50.cpp +++ b/src/mame/machine/namco50.cpp @@ -178,12 +178,7 @@ TIMER_CALLBACK_MEMBER( namco_50xx_device::rw_sync ) WRITE_LINE_MEMBER( namco_50xx_device::chip_select ) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(namco_50xx_device::chip_select_sync),this), state); -} - -TIMER_CALLBACK_MEMBER( namco_50xx_device::chip_select_sync ) -{ - m_cpu->set_input_line(0, param); + m_cpu->set_input_line(0, state); } void namco_50xx_device::write(uint8_t data) diff --git a/src/mame/machine/namco50.h b/src/mame/machine/namco50.h index d73cf0fdb64..28d8b4eed04 100644 --- a/src/mame/machine/namco50.h +++ b/src/mame/machine/namco50.h @@ -32,7 +32,6 @@ private: uint8_t m_cmd; uint8_t m_portO; - TIMER_CALLBACK_MEMBER( chip_select_sync ); TIMER_CALLBACK_MEMBER( rw_sync ); TIMER_CALLBACK_MEMBER( write_sync ); diff --git a/src/mame/machine/namco51.cpp b/src/mame/machine/namco51.cpp index 64e30c825e2..c21a0e17b54 100644 --- a/src/mame/machine/namco51.cpp +++ b/src/mame/machine/namco51.cpp @@ -61,7 +61,7 @@ #include "screen.h" -WRITE_LINE_MEMBER( namco_51xx_device::reset ) // make active low in the name +WRITE_LINE_MEMBER( namco_51xx_device::reset ) { // Reset line is active low. m_cpu->set_input_line(INPUT_LINE_RESET, !state); @@ -85,12 +85,7 @@ TIMER_CALLBACK_MEMBER( namco_51xx_device::rw_sync ) WRITE_LINE_MEMBER( namco_51xx_device::chip_select ) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(namco_51xx_device::chip_select_sync),this), state); -} - -TIMER_CALLBACK_MEMBER( namco_51xx_device::chip_select_sync ) -{ - m_cpu->set_input_line(0, param); + m_cpu->set_input_line(0, state); } uint8_t namco_51xx_device::read() diff --git a/src/mame/machine/namco51.h b/src/mame/machine/namco51.h index 73db7965ed0..4f8740e1f1c 100644 --- a/src/mame/machine/namco51.h +++ b/src/mame/machine/namco51.h @@ -46,7 +46,6 @@ private: uint8_t R3_r(); void O_w(uint8_t data); - TIMER_CALLBACK_MEMBER( chip_select_sync ); TIMER_CALLBACK_MEMBER( rw_sync ); TIMER_CALLBACK_MEMBER( write_sync ); }; diff --git a/src/mame/machine/namco53.cpp b/src/mame/machine/namco53.cpp index 88cc5185e65..7a6a8ea9181 100644 --- a/src/mame/machine/namco53.cpp +++ b/src/mame/machine/namco53.cpp @@ -107,12 +107,7 @@ void namco_53xx_device::P_w(uint8_t data) WRITE_LINE_MEMBER(namco_53xx_device::chip_select) { -machine().scheduler().synchronize(timer_expired_delegate(FUNC(namco_53xx_device::chip_select_sync),this), state); -} - -TIMER_CALLBACK_MEMBER( namco_53xx_device::chip_select_sync ) -{ - m_cpu->set_input_line(0, param); + m_cpu->set_input_line(0, state); } uint8_t namco_53xx_device::read() diff --git a/src/mame/machine/namco53.h b/src/mame/machine/namco53.h index 067c15e941e..2cd473b3c05 100644 --- a/src/mame/machine/namco53.h +++ b/src/mame/machine/namco53.h @@ -19,7 +19,6 @@ public: DECLARE_WRITE_LINE_MEMBER( reset ); DECLARE_WRITE_LINE_MEMBER( chip_select ); - DECLARE_WRITE_LINE_MEMBER(read_request); uint8_t read(); protected: @@ -43,7 +42,6 @@ private: uint8_t R3_r(); void O_w(uint8_t data); void P_w(uint8_t data); - TIMER_CALLBACK_MEMBER( chip_select_sync ); }; DECLARE_DEVICE_TYPE(NAMCO_53XX, namco_53xx_device) diff --git a/src/mame/video/starfield_05xx.cpp b/src/mame/video/starfield_05xx.cpp index f2137fc2fe9..2fb46fd0b24 100644 --- a/src/mame/video/starfield_05xx.cpp +++ b/src/mame/video/starfield_05xx.cpp @@ -1,7 +1,5 @@ // license:BSD-3-Clause // copyright-holders:Robert Hildinger - - /*************************************************************************** Starfield generator documentation @@ -485,7 +483,7 @@ #include "starfield_05xx.h" -DEFINE_DEVICE_TYPE(STARFIELD_05XX, starfield_05xx_device, "starfield_05xx_stars", "Galaga/Bosconian starfield") +DEFINE_DEVICE_TYPE(STARFIELD_05XX, starfield_05xx_device, "namco_05xx_starfield", "Namco 05xx Starfield") @@ -607,58 +605,56 @@ uint16_t starfield_05xx_device::get_next_lfsr_state(uint16_t lfsr) void starfield_05xx_device::draw_starfield(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip) { + if (!m_enable) + return; + uint16_t pre_vis_cycle_count = m_pre_vis_cycle_count; uint16_t post_vis_cycle_count = m_post_vis_cycle_count; - if (m_enable) - { - int x,y; + // Advance the LFSR during the pre-visible portion of the frame + do { m_lfsr = get_next_lfsr_state(m_lfsr); } while (--pre_vis_cycle_count); - // Advance the LFSR during the pre-visible portion of the frame - do { m_lfsr = get_next_lfsr_state(m_lfsr); } while (--pre_vis_cycle_count); - - // Now we are in visible portion of the frame - Output all LFSR hits here - for (y = m_offset_y; y < VISIBLE_LINES + m_offset_y; y++) + // Now we are in visible portion of the frame - Output all LFSR hits here + for (int y = m_offset_y; y < VISIBLE_LINES + m_offset_y; y++) + { + for (int x = m_offset_x; x < STARFIELD_PIXEL_WIDTH + m_offset_x; x++) { - for (x = m_offset_x; x < STARFIELD_PIXEL_WIDTH + m_offset_x; x++) + // Check lfsr for hit + if ((m_lfsr&LFSR_HIT_MASK) == LFSR_HIT_VALUE) { - // Check lfsr for hit - if ((m_lfsr&LFSR_HIT_MASK) == LFSR_HIT_VALUE) - { - uint8_t star_set = bitswap<2>(m_lfsr, 10, 8); + uint8_t star_set = bitswap<2>(m_lfsr, 10, 8); - if ((m_set_a == star_set) || (m_set_b == star_set)) + if ((m_set_a == star_set) || (m_set_b == star_set)) + { + // don't draw the stars that are beyond the X limit + if (x < m_limit_x) { - // don't draw the stars that are beyond the X limit - if (x < m_limit_x) - { - int dx = x; + int dx = x; - if (flip) dx += 64; + if (flip) dx += 64; - if (cliprect.contains(dx, y)) - { - uint8_t color; + if (cliprect.contains(dx, y)) + { + uint8_t color; - color = (m_lfsr>>5)&0x7; - color |= (m_lfsr<<3)&0x18; - color |= (m_lfsr<<2)&0x20; - color = (~color)&0x3F; + color = (m_lfsr>>5)&0x7; + color |= (m_lfsr<<3)&0x18; + color |= (m_lfsr<<2)&0x20; + color = (~color)&0x3F; - bitmap.pix16(y, dx) = STARS_COLOR_BASE + color; - } + bitmap.pix16(y, dx) = STARS_COLOR_BASE + color; } } } - - // Advance LFSR - m_lfsr = get_next_lfsr_state(m_lfsr); } - } - // Advance the LFSR during the post-visible portion of the frame - do { m_lfsr = get_next_lfsr_state(m_lfsr); } while (--post_vis_cycle_count); + // Advance LFSR + m_lfsr = get_next_lfsr_state(m_lfsr); + } } + + // Advance the LFSR during the post-visible portion of the frame + do { m_lfsr = get_next_lfsr_state(m_lfsr); } while (--post_vis_cycle_count); } -- cgit v1.2.3