コード例 #1
0
 public void set(memory_array array)
 {
     set(array.baseptr(), array.bytes(), array.membits(), array.endianness(), array.bytes_per_entry());
 }
コード例 #2
0
        //void write16_ext(offs_t offset, u16 data, u16 mem_mask = u16(~0));
        //u32 read32(offs_t offset);
        //void write32(offs_t offset, u32 data, u32 mem_mask = u32(~0));


        // helper to update palette when data changed
        //void update() { if (!m_init.isnull()) m_init(*this); }


        // device-level overrides

        //-------------------------------------------------
        //  device_start - start up the device
        //-------------------------------------------------
        protected override void device_start()
        {
            // bind the init function
            //m_init.resolve();

            // find the memory, if present
            memory_share share = memshare(tag());

            if (share != null)
            {
                // find the extended (split) memory, if present
                string       tag_ext   = tag() + "_ext";
                memory_share share_ext = memshare(tag_ext);

                // make sure we have specified a format
                if (m_raw_to_rgb.bytes_per_entry() <= 0)
                {
                    throw new emu_fatalerror("palette_device({0}): Palette has memory share but no format specified", tag());
                }

                // determine bytes per entry and configure
                int bytes_per_entry = m_raw_to_rgb.bytes_per_entry();
                if (share_ext == null)
                {
                    m_paletteram.set(share, bytes_per_entry);
                }
                else
                {
                    m_paletteram.set(share, bytes_per_entry / 2);
                    m_paletteram_ext.set(share_ext, bytes_per_entry / 2);
                }

                // override membits if provided
                if (m_membits_supplied)
                {
                    // forcing width only makes sense when narrower than the native bus width
                    if (m_membits >= share.bitwidth())
                    {
                        throw new emu_fatalerror("palette_device({0}): Improper use of MCFG_PALETTE_MEMBITS", tag());
                    }

                    m_paletteram.set_membits(m_membits);
                    if (share_ext != null)
                    {
                        m_paletteram_ext.set_membits(m_membits);
                    }
                }

                // override endianness if provided
                if (m_endianness_supplied)
                {
                    // forcing endianness only makes sense when the RAM is narrower than the palette format and not split
                    if (share_ext != null || (m_paletteram.membits() / 8) >= bytes_per_entry)
                    {
                        throw new emu_fatalerror("palette_device({0}): Improper use of MCFG_PALETTE_ENDIANNESS", tag());
                    }

                    m_paletteram.set_endianness(m_endianness);
                }
            }

            // call the initialization helper if present
            if (m_init != null)
            {
                m_init(this);
            }
        }