示例#1
0
        /*************************************
        *
        *  Main refresh
        *
        *************************************/
        uint32_t screen_update_atarisy2(screen_device screen, bitmap_ind16 bitmap, rectangle cliprect)
        {
            // start drawing
            m_mob.op0.draw_async(cliprect);

            // reset priorities
            bitmap_ind8 priority_bitmap = screen.priority();

            priority_bitmap.fill(0, cliprect);

            // draw the playfield
            m_playfield_tilemap.op0.tilemap.draw(screen, bitmap, cliprect, 0, 0);
            m_playfield_tilemap.op0.tilemap.draw(screen, bitmap, cliprect, 1, 1);
            m_playfield_tilemap.op0.tilemap.draw(screen, bitmap, cliprect, 2, 2);
            m_playfield_tilemap.op0.tilemap.draw(screen, bitmap, cliprect, 3, 3);

            // draw and merge the MO
            bitmap_ind16 mobitmap = m_mob.op0.bitmap();

            for (sparse_dirty_rect rect = m_mob.op0.first_dirty_rect(cliprect); rect != null; rect = rect.next())
            {
                for (int y = rect.m_rect.top(); y <= rect.m_rect.bottom(); y++)
                {
                    PointerU16 mo  = mobitmap.pix(y);        //uint16_t const *const mo = &mobitmap.pix(y);
                    PointerU16 pf  = bitmap.pix(y);          //uint16_t *const pf = &bitmap.pix(y);
                    PointerU8  pri = priority_bitmap.pix(y); //uint8_t const *const pri = &priority_bitmap.pix(y);
                    for (int x = rect.m_rect.left(); x <= rect.m_rect.right(); x++)
                    {
                        if (mo[x] != 0xffff)
                        {
                            int mopriority = mo[x] >> atari_motion_objects_device.PRIORITY_SHIFT;

                            // high priority PF?
                            if (((mopriority + pri[x]) & 2) != 0)
                            {
                                // only gets priority if PF pen is less than 8
                                if ((pf[x] & 0x08) == 0)
                                {
                                    pf[x] = (uint16_t)(mo[x] & atari_motion_objects_device.DATA_MASK);
                                }
                            }

                            // low priority
                            else
                            {
                                pf[x] = (uint16_t)(mo[x] & atari_motion_objects_device.DATA_MASK);
                            }
                        }
                    }
                }
            }

            // add the alpha on top
            m_alpha_tilemap.op0.tilemap.draw(screen, bitmap, cliprect, 0, 0);
            return(0);
        }
示例#2
0
        public void draw_starfield(bitmap_ind16 bitmap, rectangle cliprect, int flip)
        {
            if (m_enable == 0)
            {
                return;
            }

            uint16_t pre_vis_cycle_count  = m_pre_vis_cycle_count;
            uint16_t post_vis_cycle_count = m_post_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) != 0);

            // 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++)
                {
                    // Check lfsr for hit
                    if ((m_lfsr & LFSR_HIT_MASK) == LFSR_HIT_VALUE)
                    {
                        uint8_t star_set = (uint8_t)bitswap(m_lfsr, 10, 8);

                        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)
                            {
                                int dx = x;

                                if (flip != 0)
                                {
                                    dx += 64;
                                }

                                if (cliprect.contains(dx, y))
                                {
                                    uint8_t color;

                                    color  = (uint8_t)((m_lfsr >> 5) & 0x7);
                                    color |= (uint8_t)((m_lfsr << 3) & 0x18);
                                    color |= (uint8_t)((m_lfsr << 2) & 0x20);
                                    color  = (uint8_t)((~color) & 0x3F);

                                    bitmap.pix(y, dx)[0] = (uint16_t)(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) != 0);
        }