Esempio n. 1
0
        // device-level overrides
        protected override void device_config_complete()
        {
            if (!m_divideo.has_screen())
            {
                return;
            }

            if (m_divideo.screen().refresh_attoseconds() == 0)
            {
                m_divideo.screen().set_raw(m_monitor.m_monitor_clock, (u16)m_monitor.htotal(), 0,
                                           (u16)m_monitor.htotal(), (u16)m_monitor.vtotal(), 0,
                                           (u16)m_monitor.vtotal());
            }

            if (!m_divideo.screen().has_screen_update())
            {
                m_divideo.screen().set_screen_update(screen_update);
            }

            LOG("config complete\n");
        }
Esempio n. 2
0
        //void apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t *mo, int x, int y);

        // memory access
        //uint16_t &slipram(int offset) { return m_slipram[offset]; }


        // device-level overrides

        //-------------------------------------------------
        //  device_start: Start up the device
        //-------------------------------------------------
        protected override void device_start()
        {
            // call parent
            base.device_start();

            // verify configuration
            gfx_element gfx = m_gfxdecode.op0.gfx(m_atari_motion_objects_config.m_gfxindex);

            if (gfx == null)
            {
                throw new emu_fatalerror("No gfxelement #{0}!", m_atari_motion_objects_config.m_gfxindex);
            }

            // determine the masks
            m_linkmask.set(m_atari_motion_objects_config.m_link_entry);
            m_codemask.set(m_atari_motion_objects_config.m_code_entry);
            m_colormask.set(m_atari_motion_objects_config.m_color_entry);
            m_xposmask.set(m_atari_motion_objects_config.m_xpos_entry);
            m_yposmask.set(m_atari_motion_objects_config.m_ypos_entry);
            m_widthmask.set(m_atari_motion_objects_config.m_width_entry);
            m_heightmask.set(m_atari_motion_objects_config.m_height_entry);
            m_hflipmask.set(m_atari_motion_objects_config.m_hflip_entry);
            m_vflipmask.set(m_atari_motion_objects_config.m_vflip_entry);
            m_prioritymask.set(m_atari_motion_objects_config.m_priority_entry);
            m_neighbormask.set(m_atari_motion_objects_config.m_neighbor_entry);
            m_absolutemask.set(m_atari_motion_objects_config.m_absolute_entry);

            // derive tile information
            m_tilewidth  = gfx.width();
            m_tileheight = gfx.height();
            m_tilexshift = compute_log(m_tilewidth);
            m_tileyshift = compute_log(m_tileheight);

            // derive bitmap information
            m_bitmapwidth  = round_to_powerof2(m_xposmask.mask());
            m_bitmapheight = round_to_powerof2(m_yposmask.mask());
            m_bitmapxmask  = m_bitmapwidth - 1;
            m_bitmapymask  = m_bitmapheight - 1;

            // derive sprite information
            m_entrycount    = round_to_powerof2(m_linkmask.mask());
            m_entrybits     = compute_log(m_entrycount);
            m_spriteramsize = m_atari_motion_objects_config.m_bankcount * m_entrycount;
            m_spriterammask = m_spriteramsize - 1;
            m_slipshift     = (m_atari_motion_objects_config.m_slipheight != 0) ? compute_log(m_atari_motion_objects_config.m_slipheight) : 0;
            m_slipramsize   = m_bitmapheight >> m_slipshift;
            m_sliprammask   = m_slipramsize - 1;
            if (m_atari_motion_objects_config.m_maxperline == 0)
            {
                m_atari_motion_objects_config.m_maxperline = MAX_PER_BANK;
            }

            // Get the slipram from the share if not already explicitly set
            if (m_slipram == null)
            {
                m_slipram = new Pointer <u16>(m_slipramshare.op);
            }

            // allocate and initialize the code lookup
            int codesize = round_to_powerof2((int)m_codemask.mask());

            m_codelookup.resize((size_t)codesize);
            for (int i = 0; i < codesize; i++)
            {
                m_codelookup[i] = (uint32_t)i;
            }

            // allocate and initialize the color lookup
            int colorsize = round_to_powerof2((int)m_colormask.mask());

            m_colorlookup.resize((size_t)colorsize);
            for (int i = 0; i < colorsize; i++)
            {
                m_colorlookup[i] = (uint8_t)i;
            }

            // allocate and the gfx lookup
            int gfxsize = codesize / 256;

            m_gfxlookup.resize((size_t)gfxsize);
            for (int i = 0; i < gfxsize; i++)
            {
                m_gfxlookup[i] = m_atari_motion_objects_config.m_gfxindex;
            }

            // allocate a timer to periodically force update
            m_force_update_timer = timer_alloc(TID_FORCE_UPDATE);
            m_force_update_timer.adjust(m_divideo.screen().time_until_pos(0));

            // register for save states
            save_item(NAME(new { m_bank }));
            save_item(NAME(new { m_xscroll }));
            save_item(NAME(new { m_yscroll }));
        }