diff options
Diffstat (limited to 'src/mame/video/starfield_05xx.cpp')
-rw-r--r-- | src/mame/video/starfield_05xx.cpp | 70 |
1 files changed, 33 insertions, 37 deletions
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); } |