Ejemplo n.º 1
0
        //std::tuple<const char *, device_t *, device_t *> prepare_replace(const char *tag);


        //-------------------------------------------------
        //  add_device - add a new device at the correct
        //  point in the hierarchy
        //-------------------------------------------------
        device_t add_device(device_t device, device_t owner)
        {
            using (current_device_stack context = new current_device_stack(this))  //current_device_stack context = this;
            {
                if (owner != null)
                {
                    // allocate the new device and append it to the owner's list
                    device_t result = owner.subdevices().m_list.append(device.release());
                    result.add_machine_configuration(this);
                    return(result);
                }
                else
                {
                    // allocate the root device directly
                    assert(m_root_device == null);
                    m_root_device = device;
                    driver_device driver = (driver_device)m_root_device.get();
                    if (driver != null)
                    {
                        driver.set_game_driver(m_gamedrv);
                    }
                    m_root_device.add_machine_configuration(this);
                    return(m_root_device);
                }
            }
        }
Ejemplo n.º 2
0
        //device_t &replace_device(std::unique_ptr<device_t> &&device, device_t &owner, device_t *existing);


        //-------------------------------------------------
        //  remove_references - globally remove references
        //  to a device about to be removed from the tree
        //-------------------------------------------------
        void remove_references(device_t device)
        {
            // remove default layouts for subdevices
            string tag    = device.tag();
            int    taglen = strlen(tag);

            throw new emu_unimplemented();
#if false
            default_layout_map.iterator it = m_default_layouts.lower_bound(tag);
            while ((m_default_layouts.end() != it) && !global.strncmp(tag, it.first, taglen))
            {
                if (!it.first[taglen] || (':' == it.first[taglen]))
                {
                    it = m_default_layouts.erase(it);
                }
                else
                {
                    ++it;
                }
            }
#endif

            // iterate over all devices and remove any references
            foreach (device_t scan in new device_iterator(root_device()))
            {
                scan.subdevices().m_tagmap.clear();
            }
        }
Ejemplo n.º 3
0
        emu_timer m_timer;   // timer for triggering reset


        // construction/destruction
        //-------------------------------------------------
        //  watchdog_timer_device - constructor
        //-------------------------------------------------
        watchdog_timer_device(machine_config mconfig, string tag, device_t owner, uint32_t clock = 0)
            : base(mconfig, WATCHDOG_TIMER, tag, owner, clock)
        {
            m_vblank_count = 0;
            m_time         = attotime.zero;
            m_screen       = new optional_device <screen_device>(this, finder_base.DUMMY_TAG);
        }
Ejemplo n.º 4
0
 // construction/destruction
 //template <typename T>
 public gfxdecode_device(machine_config mconfig, string tag, device_t owner, string palette_tag, gfx_decode_entry [] gfxinfo)
     : this(mconfig, tag, owner, 0)
 {
     m_digfx = GetClassInterface <device_gfx_interface>();
     m_digfx.set_palette(palette_tag);
     m_digfx.set_info(gfxinfo);
 }
Ejemplo n.º 5
0
        protected m6805_base_device(
            machine_config mconfig,
            string tag,
            device_t owner,
            uint32_t clock,
            device_type type,
            configuration_params params_,
            address_map_constructor internal_map)
            : base(mconfig, type, tag, owner, clock)
        {
            //m_class_interfaces.Add(new device_execute_interface_m6805_base(mconfig, this));
            m_class_interfaces.Add(new device_memory_interface_m6805_base(mconfig, this));
            m_class_interfaces.Add(new device_state_interface_m6805_base(mconfig, this));
            //m_class_interfaces.Add(new device_disasm_interface_m6805_base(mconfig, this));

            m_dimemory = GetClassInterface <device_memory_interface_m6805_base>();
            m_distate  = GetClassInterface <device_state_interface_m6805_base>();


            init_s_hmos_s_ops();


            m_params         = params_;
            m_program_config = new address_space_config("program", ENDIANNESS_BIG, 8, (u8)params_.m_addr_width, 0, internal_map);
        }
Ejemplo n.º 6
0
        UInt32 m_length;  //size_t m_length;


        // construction/destruction
        public region_ptr_finder(bool required, device_t basedevice, string tag, UInt32 length = 0)
            : base(required, basedevice, tag)
        {
            Required = required;

            m_length = length;
        }
Ejemplo n.º 7
0
 public static void LOGMASKED(int mask, device_t device, string format, params object [] args)
 {
     if ((VERBOSE & mask) != 0)
     {
         LOG_OUTPUT_FUNC(device, format, args);
     }
 }                                                                                                                                                                    //#define LOGMASKED(mask, ...) do { if (VERBOSE & (mask)) (LOG_OUTPUT_FUNC)(__VA_ARGS__); } while (false)
Ejemplo n.º 8
0
            //static INPUT_PORTS_START(fixedfreq_base_ports)
            void construct_ioport_fixedfreq_base_ports(device_t owner, ioport_list portlist, ref string errorbuf)
            {
                INPUT_PORTS_START(owner, portlist, ref errorbuf);

                PORT_START("ENABLE");
                PORT_CONFNAME(0x01, 0x00, "Display Monitor sliders");
                PORT_CONFSETTING(0x00, DEF_STR(Off));
                PORT_CONFSETTING(0x01, DEF_STR(On));
                PORT_CONFNAME(0x02, 0x00, "Visual Timing Debug");
                PORT_CONFSETTING(0x00, DEF_STR(Off));
                PORT_CONFSETTING(0x02, DEF_STR(On));
                PORT_CONFNAME(0x04, 0x00, "Display gray test pattern"); PORT_CONDITION("VECTOR", 0x01, ioport_condition.condition_t.EQUALS, 0x00);
                PORT_CONFSETTING(0x00, DEF_STR(Off));
                PORT_CONFSETTING(0x04, DEF_STR(On));

                PORT_ADJUSTERX(fixedfreq_tag_id_e.HVISIBLE, "H Visible", 10, 1000);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.HFRONTPORCH, "H Front porch width", 1, 100);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.HSYNC, "H Sync width", 1, 100);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.HBACKPORCH, "H Back porch width", 1, 1000);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.VVISIBLE, "V Visible", 1, 1000);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.VFRONTPORCH, "V Front porch width", 0, 100);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.VSYNC, "V Sync width", 1, 100);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.VBACKPORCH, "V Back porch width", 1, 100);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.SYNCTHRESHOLD, "Sync threshold mV", 10, 2000);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.VSYNCTHRESHOLD, "V Sync threshold mV", 10, 1000);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.GAIN, "Signal Gain", 10, 1000);
                PORT_ADJUSTERX(fixedfreq_tag_id_e.SCANLINE_HEIGHT, "Scanline Height", 10, 300);

                INPUT_PORTS_END();
            }
Ejemplo n.º 9
0
        // construction/destruction
        public mb88_cpu_device(machine_config mconfig, device_type type, string tag, device_t owner, uint32_t clock, int program_width, int data_width)
            : base(mconfig, type, tag, owner, clock)
        {
            m_class_interfaces.Add(new device_execute_interface_mb88(mconfig, this));
            m_class_interfaces.Add(new device_memory_interface_mb88(mconfig, this));
            m_class_interfaces.Add(new device_state_interface_mb88(mconfig, this));
            m_class_interfaces.Add(new device_disasm_interface_mb88(mconfig, this));


            m_program_config = new address_space_config("program", endianness_t.ENDIANNESS_BIG, 8, (byte)program_width, 0, (program_width == 9) ? program_9bit : (program_width == 10) ? program_10bit : (address_map_constructor)program_11bit);
            m_data_config    = new address_space_config("data", endianness_t.ENDIANNESS_BIG, 8, (byte)data_width, 0, (data_width == 4) ? data_4bit : (data_width == 5) ? data_5bit : (data_width == 6) ? data_6bit : (address_map_constructor)data_7bit);
            m_PLA            = null;
            m_read_k         = new devcb_read8(this);
            m_write_o        = new devcb_write8(this);
            m_write_p        = new devcb_write8(this);
            for (int i = 0; i < 4; i++)
            {
                m_read_r[i] = new devcb_read8(this);
            }
            for (int i = 0; i < 4; i++)
            {
                m_write_r[i] = new devcb_write8(this);
            }
            m_read_si  = new devcb_read_line(this);
            m_write_so = new devcb_write_line(this);
        }
Ejemplo n.º 10
0
        public device_execute_interface perfect_quantum_device()
        {
            if (m_perfect_quantum_device.first == null)
            {
                return(null);
            }

            device_t found = m_perfect_quantum_device.first.subdevice(m_perfect_quantum_device.second);

            if (found == null)
            {
                throw new emu_fatalerror(
                          "Device {0} relative to {1} specified for perfect interleave is not present!\n",
                          m_perfect_quantum_device.second,
                          m_perfect_quantum_device.first.tag());
            }

            device_execute_interface result;

            if (!found.interface_(out result))
            {
                throw new emu_fatalerror("Device {0} ({1}) specified for perfect interleave does not implement device_execute_interface!\n",
                                         found.tag(),
                                         found.shortname());
            }

            return(result);
        }
Ejemplo n.º 11
0
        protected m6805_hmos_device(machine_config mconfig, string tag, device_t owner, u32 clock, device_type type, u32 addr_width, unsigned ram_size)
            : base(mconfig, tag, owner, clock, type, new configuration_params(addr_width > 13 ? s_hmos_b_ops : s_hmos_s_ops, s_hmos_cycles, addr_width, 0x007f, 0x0060, M6805_VECTOR_SWI), null)  //map)
        {
            m6805_base_device_after_ctor(map);


            //m_class_interfaces.Add(new device_execute_interface_m6805_hmos(mconfig, this));


            m_timer           = new m6805_timer(this);
            m_port_open_drain = new bool [PORT_COUNT] {
                false, false, false, false
            };
            m_port_mask = new u8 [PORT_COUNT] {
                0x00, 0x00, 0x00, 0x00
            };
            m_port_input = new u8 [PORT_COUNT] {
                0xff, 0xff, 0xff, 0xff
            };
            m_port_latch = new u8 [PORT_COUNT] {
                0xff, 0xff, 0xff, 0xff
            };
            m_port_ddr = new u8 [PORT_COUNT] {
                0x00, 0x00, 0x00, 0x00
            };
            m_port_cb_r = new devcb_read8.array <u64_const_PORT_COUNT>(this, () => { return(new devcb_read8(this)); });
            m_port_cb_w = new devcb_write8.array <u64_const_PORT_COUNT>(this, () => { return(new devcb_write8(this)); });
            m_ram_size  = ram_size;
        }
Ejemplo n.º 12
0
        intref m_icount = new intref();  //int m_icount;


        // construction/destruction
        i8257_device(machine_config mconfig, string tag, device_t owner, uint32_t clock)
            : base(mconfig, I8257, tag, owner, clock)
        {
            m_class_interfaces.Add(new device_execute_interface_i8257(mconfig, this));  //device_execute_interface(mconfig, *this),


            m_icount.i        = 0;
            m_reverse_rw      = false;
            m_tc              = false;
            m_msb             = 0;
            m_hreq            = CLEAR_LINE;
            m_hack            = 0;
            m_ready           = 1;
            m_state           = 0;
            m_current_channel = 0;
            m_last_channel    = 0;
            m_transfer_mode   = 0;
            m_status          = 0;
            m_request         = 0;
            m_temp            = 0;
            m_out_hrq_cb      = new devcb_write_line(this);
            m_out_tc_cb       = new devcb_write_line(this);
            m_in_memr_cb      = new devcb_read8(this);
            m_out_memw_cb     = new devcb_write8(this);
            m_in_ior_cb       = new devcb_read8.array <u64_const_4>(this, () => { return(new devcb_read8(this)); });
            m_out_iow_cb      = new devcb_write8.array <u64_const_4>(this, () => { return(new devcb_write8(this)); });
            m_out_dack_cb     = new devcb_write_line.array <u64_const_4>(this, () => { return(new devcb_write_line(this)); });
        }
Ejemplo n.º 13
0
        /*************************************
        *
        *  Special shifter circuit
        *
        *************************************/
        //u8 mw8080bw_state::mw8080bw_shift_result_rev_r()


        /*************************************
        *
        *  Main CPU memory handlers
        *
        *************************************/
        void main_map(address_map map, device_t device)
        {
            map.global_mask(0x7fff);
            map.op(0x0000, 0x1fff).rom().nopw();
            map.op(0x2000, 0x3fff).mirror(0x4000).ram().share("main_ram");
            map.op(0x4000, 0x5fff).rom().nopw();
        }
Ejemplo n.º 14
0
        /*************************************
        *
        *  Main CPU port handlers
        *
        *************************************/

        void writeport(address_map map, device_t device)
        {
            pacman_state state = (pacman_state)device;

            map.global_mask(0xff);
            map.op(0x00, 0x00).w(state.pacman_interrupt_vector_w);    /* Pac-Man only */
        }
Ejemplo n.º 15
0
        atari_motion_objects_device(machine_config mconfig, string tag, device_t owner, uint32_t clock)
            : base(mconfig, ATARI_MOTION_OBJECTS, tag, owner)
        {
            m_divideo = new device_video_interface(mconfig, this);  //, device_video_interface(mconfig, *this)


            m_tilewidth     = 0;
            m_tileheight    = 0;
            m_tilexshift    = 0;
            m_tileyshift    = 0;
            m_bitmapwidth   = 0;
            m_bitmapheight  = 0;
            m_bitmapxmask   = 0;
            m_bitmapymask   = 0;
            m_entrycount    = 0;
            m_entrybits     = 0;
            m_spriterammask = 0;
            m_spriteramsize = 0;
            m_slipshift     = 0;
            m_sliprammask   = 0;
            m_slipramsize   = 0;
            m_bank          = 0;
            m_xscroll       = 0;
            m_yscroll       = 0;
            m_slipram       = null;
            m_slipramshare  = new optional_shared_ptr <u16>(this, "slip");
            m_activelast    = null;
            m_last_xpos     = 0;
            m_next_xpos     = 0;
            m_xoffset       = 0;
            m_gfxdecode     = new required_device <gfxdecode_device>(this, finder_base.DUMMY_TAG);
        }
Ejemplo n.º 16
0
        //static INPUT_PORTS_START( dkong_dsw0 )
        void construct_ioport_dkong_dsw0(device_t owner, ioport_list portlist, ref string errorbuf)
        {
            INPUT_PORTS_START(owner, portlist, ref errorbuf);

            PORT_START("DSW0");      /* DSW0 */
            PORT_DIPNAME(0x03, 0x00, DEF_STR(Lives));        PORT_DIPLOCATION("SW1:!1,!2");
            PORT_DIPSETTING(0x00, "3");
            PORT_DIPSETTING(0x01, "4");
            PORT_DIPSETTING(0x02, "5");
            PORT_DIPSETTING(0x03, "6");
            PORT_DIPNAME(0x0c, 0x00, DEF_STR(Bonus_Life));   PORT_DIPLOCATION("SW1:!3,!4");
            PORT_DIPSETTING(0x00, "7000");
            PORT_DIPSETTING(0x04, "10000");
            PORT_DIPSETTING(0x08, "15000");
            PORT_DIPSETTING(0x0c, "20000");
            PORT_DIPNAME(0x70, 0x00, DEF_STR(Coinage));      PORT_DIPLOCATION("SW1:!5,!6,!7");
            PORT_DIPSETTING(0x70, DEF_STR(_5C_1C));
            PORT_DIPSETTING(0x50, DEF_STR(_4C_1C));
            PORT_DIPSETTING(0x30, DEF_STR(_3C_1C));
            PORT_DIPSETTING(0x10, DEF_STR(_2C_1C));
            PORT_DIPSETTING(0x00, DEF_STR(_1C_1C));
            PORT_DIPSETTING(0x20, DEF_STR(_1C_2C));
            PORT_DIPSETTING(0x40, DEF_STR(_1C_3C));
            PORT_DIPSETTING(0x60, DEF_STR(_1C_4C));
            PORT_DIPNAME(0x80, 0x80, DEF_STR(Cabinet));      PORT_DIPLOCATION("SW1:!8");
            PORT_DIPSETTING(0x80, DEF_STR(Upright));
            PORT_DIPSETTING(0x00, DEF_STR(Cocktail));

            INPUT_PORTS_END();
        }
Ejemplo n.º 17
0
        void mspacman_map(address_map map, device_t device)
        {
            /* start with 0000-3fff and 8000-bfff mapped to the ROMs */
            map.op(0x0000, 0xffff).bankr("bank1");
            map.op(0x4000, 0x7fff).mirror(0x8000).unmaprw();

            map.op(0x4000, 0x43ff).mirror(0xa000).ram().w(pacman_videoram_w).share("videoram");
            map.op(0x4400, 0x47ff).mirror(0xa000).ram().w(pacman_colorram_w).share("colorram");
            map.op(0x4800, 0x4bff).mirror(0xa000).r(pacman_read_nop).nopw();
            map.op(0x4c00, 0x4fef).mirror(0xa000).ram();
            map.op(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
            map.op(0x5000, 0x5007).mirror(0xaf38).w(m_mainlatch, (offset, data) => { m_mainlatch.op0.write_d0(offset, data); });           //FUNC(ls259_device::write_d0));
            map.op(0x5040, 0x505f).mirror(0xaf00).w(m_namco_sound, (offset, data) => { m_namco_sound.op0.pacman_sound_w(offset, data); }); //FUNC(namco_device::pacman_sound_w));
            map.op(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
            map.op(0x5070, 0x507f).mirror(0xaf00).nopw();
            map.op(0x5080, 0x5080).mirror(0xaf3f).nopw();
            map.op(0x50c0, 0x50c0).mirror(0xaf3f).w(m_watchdog, (data) => { m_watchdog.op0.reset_w(data); });  //FUNC(watchdog_timer_device::reset_w));
            map.op(0x5000, 0x5000).mirror(0xaf3f).portr("IN0");
            map.op(0x5040, 0x5040).mirror(0xaf3f).portr("IN1");
            map.op(0x5080, 0x5080).mirror(0xaf3f).portr("DSW1");
            map.op(0x50c0, 0x50c0).mirror(0xaf3f).portr("DSW2");

            /* overlay decode enable/disable on top */
            map.op(0x0038, 0x003f).rw(mspacman_disable_decode_r_0x0038, mspacman_disable_decode_w);
            map.op(0x03b0, 0x03b7).rw(mspacman_disable_decode_r_0x03b0, mspacman_disable_decode_w);
            map.op(0x1600, 0x1607).rw(mspacman_disable_decode_r_0x1600, mspacman_disable_decode_w);
            map.op(0x2120, 0x2127).rw(mspacman_disable_decode_r_0x2120, mspacman_disable_decode_w);
            map.op(0x3ff0, 0x3ff7).rw(mspacman_disable_decode_r_0x3ff0, mspacman_disable_decode_w);
            map.op(0x3ff8, 0x3fff).rw(mspacman_enable_decode_r_0x3ff8, mspacman_enable_decode_w);
            map.op(0x8000, 0x8007).rw(mspacman_disable_decode_r_0x8000, mspacman_disable_decode_w);
            map.op(0x97f0, 0x97f7).rw(mspacman_disable_decode_r_0x97f0, mspacman_disable_decode_w);
        }
Ejemplo n.º 18
0
        public u32 m_specified_inputs_mask;                                     // mask of inputs explicitly specified (not counting auto-allocated)


        // construction/destruction
        //-------------------------------------------------
        //  device_sound_interface - constructor
        //-------------------------------------------------
        public device_sound_interface(machine_config mconfig, device_t device)
            : base(device, "sound")
        {
            m_outputs = 0;
            m_auto_allocated_inputs = 0;
            m_specified_inputs_mask = 0;
        }
Ejemplo n.º 19
0
        /*************************************
        *
        *  Address maps
        *
        *************************************/

        /* complete address map verified from Moon Patrol/10 Yard Fight schematics */
        /* large map uses 8k ROMs, small map uses 4k ROMs; this is selected via a jumper */
        protected void m52_small_sound_map(address_map map, device_t device)
        {
            map.global_mask(0x7fff);
            map.op(0x0000, 0x0fff).w(m52_adpcm_w);
            map.op(0x1000, 0x1fff).w(sound_irq_ack_w);
            map.op(0x2000, 0x7fff).rom();
        }
Ejemplo n.º 20
0
        protected static void m6803_mem(address_map map, device_t owner)
        {
            m6801_cpu_device m6801 = (m6801_cpu_device)owner;

            m6801_io(map, m6801);
            map.op(0x0080, 0x00ff).ram();        /* 6803 internal RAM */
        }
Ejemplo n.º 21
0
        //template <typename Creator>
        //device_t *device_add(const char *tag, Creator &&type, u32 clock)
        //{
        //    return device_add(tag, device_type(type), clock);
        //}
        //template <typename Creator, typename... Params>

        //auto device_add(const char *tag, Creator &&type, Params &&... args)
        //{
        //    std::pair<const char *, device_t *> const owner(resolve_owner(tag));
        //    auto device(type.create(*this, owner.first, owner.second, std::forward<Params>(args)...));
        //    auto &result(*device);
        //    assert(type.type() == typeid(result));
        //    add_device(std::move(device), owner.second);
        //    return &result;
        //}

        //template <typename Creator, typename... Params>
        //auto device_add(const char *tag, Creator &&type, XTAL clock, Params &&... args)
        //{
        //    clock.validate(std::string("Instantiating device ") + tag);
        //    return device_add(tag, std::forward<Creator>(type), clock.value(), std::forward<Params>(args)...);
        //}


        //device_t *device_replace(const char *tag, device_type type, u32 clock);
        //template <typename Creator>
        //device_t *device_replace(const char *tag, Creator &&type, u32 clock)
        //{
        //    return device_replace(tag, device_type(type), clock);
        //}
        //template <typename Creator, typename... Params>
        //auto device_replace(const char *tag, Creator &&type, Params &&... args)
        //{
        //    std::tuple<const char *, device_t *, device_t *> const existing(prepare_replace(tag));
        //    auto device(type.create(*this, std::get<0>(existing), std::get<1>(existing), std::forward<Params>(args)...));
        //    auto &result(*device);
        //    assert(type.type() == typeid(result));
        //    replace_device(std::move(device), *std::get<1>(existing), std::get<2>(existing));
        //    return &result;
        //}
        //template <typename Creator, typename... Params>
        //auto device_replace(const char *tag, Creator &&type, XTAL clock, Params &&... args)
        //{
        //    clock.validate(std::string("Replacing device ") + tag);
        //    return device_replace(tag, std::forward<Creator>(type), clock.value(), std::forward<Params>(args)...);
        //}


        //-------------------------------------------------
        //  device_remove - configuration helper to
        //  remove a device
        //-------------------------------------------------
        public device_t device_remove(string tag)
        {
            // find the original device by relative tag (must exist)
            assert(m_current_device != null);
            device_t device = m_current_device.subdevice(tag);

            if (device == null)
            {
                osd_printf_warning("Warning: attempting to remove non-existent device '{0}'\n", tag);
            }
            else
            {
                // make sure we have the old device's actual owner
                device_t owner = device.owner();
                assert(owner != null);

                // remove references to the old device
                remove_references(device);

                // let the device's owner do the work
                owner.subdevices().m_list.remove(device);
            }

            return(null);
        }
Ejemplo n.º 22
0
        memory_array m_paletteram_ext = new memory_array(); // extended memory


        // construction/destruction

        palette_device(machine_config mconfig, string tag, device_t owner, init_delegate init, u32 entries = 0U, u32 indirect = 0U)
            : this(mconfig, tag, owner, 0U)
        {
            set_entries(entries);
            set_indirect_entries(indirect);
            set_init(init);
        }
Ejemplo n.º 23
0
        // internal helpers

        //-------------------------------------------------
        //  resolve_owner - get the actual owner and base
        //  tag given tag relative to current context
        //-------------------------------------------------
        KeyValuePair <string, device_t> resolve_owner(string tag)
        {
            //throw new emu_unimplemented();
#if false
            global.assert(m_current_device == m_root_device);
#endif

            string orig_tag = string.Copy(tag);

            device_t owner = m_current_device;

            // if the device path is absolute, start from the root
            if (tag[0] == ':')
            {
                tag   = tag.Remove(0); //tag++;
                owner = m_root_device.get();
            }

            // go down the path until we're done with it
            while (tag.IndexOf(':', 0) != -1)                        //while (global.strchr(tag, ':'))
            {
                string next = tag.Substring(tag.IndexOf(':', 0));    //const char *next = strchr(tag, ':');
                assert(next != tag);
                string part = tag.Substring(0, tag.IndexOf(':', 0)); //std::string part(tag, next-tag);
                owner = owner.subdevices().find(part);
                if (owner == null)
                {
                    throw new emu_fatalerror("Could not find {0} when looking up path for device {1}\n", part.c_str(), orig_tag);
                }
                tag = next.Substring(1);        //tag = next + 1;
            }
            assert(!string.IsNullOrEmpty(tag)); //global.assert(tag[0] != '\0');

            return(std.make_pair(tag, owner));
        }
Ejemplo n.º 24
0
        //static INPUT_PORTS_START( pong )
        void construct_ioport_pong(device_t owner, ioport_list portlist, ref string errorbuf)
        {
            INPUT_PORTS_START(owner, portlist, ref errorbuf);

            pong_state pong_state = (pong_state)owner;

            PORT_START("PADDLE0");   /* fake input port for player 1 paddle */
            PORT_BIT(0xff, 0x00, IPT_PADDLE); PORT_SENSITIVITY(2); PORT_KEYDELTA(100); PORT_CENTERDELTA(0);   NETLIST_ANALOG_PORT_CHANGED("maincpu", "pot0", (field, param, oldval, newval) => { ((netlist_mame_analog_input_device)pong_state.subdevice("maincpu:pot0")).input_changed(field, param, oldval, newval); });

            PORT_START("PADDLE1");   /* fake input port for player 2 paddle */
            PORT_BIT(0xff, 0x00, IPT_PADDLE); PORT_SENSITIVITY(2); PORT_KEYDELTA(100); PORT_CENTERDELTA(0); PORT_PLAYER(2); NETLIST_ANALOG_PORT_CHANGED("maincpu", "pot1", (field, param, oldval, newval) => { ((netlist_mame_analog_input_device)pong_state.subdevice("maincpu:pot1")).input_changed(field, param, oldval, newval); });

            PORT_START("IN0"); /* fake as well */
            PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1);     NETLIST_LOGIC_PORT_CHANGED("maincpu", "coinsw", (field, param, oldval, newval) => { ((netlist_mame_logic_input_device)pong_state.subdevice("maincpu:coinsw")).input_changed(field, param, oldval, newval); });

            PORT_DIPNAME(0x06, 0x00, "Game Won");          PORT_DIPLOCATION("SW1A:1,SW1B:1"); PORT_CHANGED_MEMBER(DEVICE_SELF, pong_state.input_changed, (u32)pong_state.input_changed_enum.IC_SWITCH);
            PORT_DIPSETTING(0x00, "11");
            PORT_DIPSETTING(0x06, "15");

            PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SERVICE);  PORT_NAME("Antenna"); NETLIST_LOGIC_PORT_CHANGED("maincpu", "antenna", (field, param, oldval, newval) => { ((netlist_mame_logic_input_device)pong_state.subdevice("maincpu:antenna")).input_changed(field, param, oldval, newval); });

            PORT_START("VR1");
            PORT_ADJUSTER(50, "VR1 - 50k, Paddle 1 adjustment");   NETLIST_ANALOG_PORT_CHANGED("maincpu", "vr0", (field, param, oldval, newval) => { ((netlist_mame_analog_input_device)pong_state.subdevice("maincpu:vr0")).input_changed(field, param, oldval, newval); });
            PORT_START("VR2");
            PORT_ADJUSTER(50, "VR2 - 50k, Paddle 2 adjustment");   NETLIST_ANALOG_PORT_CHANGED("maincpu", "vr1", (field, param, oldval, newval) => { ((netlist_mame_analog_input_device)pong_state.subdevice("maincpu:vr1")).input_changed(field, param, oldval, newval); });

            INPUT_PORTS_END();
        }
Ejemplo n.º 25
0
        //static INPUT_PORTS_START( dkong_in2 )
        void construct_ioport_dkong_in2(device_t owner, ioport_list portlist, ref string errorbuf)
        {
            INPUT_PORTS_START(owner, portlist, ref errorbuf);

            dkong_state dkong_state = (dkong_state)owner;

            /* Bit 0x80 is (SERVICE OR COIN) !
             * Bit 0x40 mcu status (sound feedback) is inverted bit4 from port B (8039)
             * Bit 0x01 is going to the connector but it is not labeled
             */
            PORT_START("IN2");                           /* IN2 */
            PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SERVICE); /* connection not labeled in schematics - diagnostic rom */
            PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN); /* connection not labeled in schematics - freeze or reset */
            PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1);
            PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_START2);
            PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN);                                                                                                                                /* not connected - held to high */
            PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN);                                                                                                                                /* not connected - held to high */
            PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_CUSTOM); PORT_READ_LINE_DEVICE_MEMBER("virtual_p2", () => { return(((latch8_device)dkong_state.subdevice("virtual_p2")).bit4_q_r()); }); //latch8_device, bit4_q_r) /* status from sound cpu */
            PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_COIN1);

            PORT_START("SERVICE1");
            PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SERVICE1);

            INPUT_PORTS_END();
        }
Ejemplo n.º 26
0
        // stream creation
        //-------------------------------------------------
        //  stream_alloc - allocate a new stream
        //-------------------------------------------------
        public sound_stream stream_alloc(device_t device, int inputs, int outputs, int sample_rate, stream_update_delegate callback = null)
        {
            var stream = new sound_stream(device, inputs, outputs, sample_rate, callback);

            m_stream_list.push_back(stream);
            return(stream);
        }
Ejemplo n.º 27
0
        void mspacman_map(address_map map, device_t device)
        {
            pacman_state pacman_state = (pacman_state)device;

            /* start with 0000-3fff and 8000-bfff mapped to the ROMs */
            map.op(0x0000, 0xffff).bankr("bank1");
            map.op(0x4000, 0x7fff).mirror(0x8000).unmaprw();

            map.op(0x4000, 0x43ff).mirror(0xa000).ram().w(pacman_state.pacman_videoram_w).share("videoram");
            map.op(0x4400, 0x47ff).mirror(0xa000).ram().w(pacman_state.pacman_colorram_w).share("colorram");
            map.op(0x4800, 0x4bff).mirror(0xa000).r(pacman_state.pacman_read_nop).nopw();
            map.op(0x4c00, 0x4fef).mirror(0xa000).ram();
            map.op(0x4ff0, 0x4fff).mirror(0xa000).ram().share("spriteram");
            map.op(0x5000, 0x5007).mirror(0xaf38).w(pacman_state.mainlatch.target, pacman_state.ls259_device_write_d0_mainlatch);
            map.op(0x5040, 0x505f).mirror(0xaf00).w(pacman_state.namco_sound.target, pacman_state.namco_device_pacman_sound_w);
            map.op(0x5060, 0x506f).mirror(0xaf00).writeonly().share("spriteram2");
            map.op(0x5070, 0x507f).mirror(0xaf00).nopw();
            map.op(0x5080, 0x5080).mirror(0xaf3f).nopw();
            map.op(0x50c0, 0x50c0).mirror(0xaf3f).w(pacman_state.watchdog.target, pacman_state.watchdog_timer_device_reset_w);
            map.op(0x5000, 0x5000).mirror(0xaf3f).portr("IN0");
            map.op(0x5040, 0x5040).mirror(0xaf3f).portr("IN1");
            map.op(0x5080, 0x5080).mirror(0xaf3f).portr("DSW1");
            map.op(0x50c0, 0x50c0).mirror(0xaf3f).portr("DSW2");

            /* overlay decode enable/disable on top */
            map.op(0x0038, 0x003f).rw(pacman_state.mspacman_disable_decode_r_0x0038, pacman_state.mspacman_disable_decode_w);
            map.op(0x03b0, 0x03b7).rw(pacman_state.mspacman_disable_decode_r_0x03b0, pacman_state.mspacman_disable_decode_w);
            map.op(0x1600, 0x1607).rw(pacman_state.mspacman_disable_decode_r_0x1600, pacman_state.mspacman_disable_decode_w);
            map.op(0x2120, 0x2127).rw(pacman_state.mspacman_disable_decode_r_0x2120, pacman_state.mspacman_disable_decode_w);
            map.op(0x3ff0, 0x3ff7).rw(pacman_state.mspacman_disable_decode_r_0x3ff0, pacman_state.mspacman_disable_decode_w);
            map.op(0x3ff8, 0x3fff).rw(pacman_state.mspacman_enable_decode_r_0x3ff8, pacman_state.mspacman_enable_decode_w);
            map.op(0x8000, 0x8007).rw(pacman_state.mspacman_disable_decode_r_0x8000, pacman_state.mspacman_disable_decode_w);
            map.op(0x97f0, 0x97f7).rw(pacman_state.mspacman_disable_decode_r_0x97f0, pacman_state.mspacman_disable_decode_w);
        }
Ejemplo n.º 28
0
        // allocation and re-use

        //-------------------------------------------------
        //  init - completely initialize the state when
        //  re-allocated as a non-device timer
        //-------------------------------------------------
        public emu_timer init(running_machine machine, timer_expired_delegate callback, object o, bool temporary)
        {
            // ensure the entire timer state is clean
            m_machine   = machine;
            m_next      = null;
            m_prev      = null;
            m_callback  = callback;
            m_param     = 0;
            m_ptr       = o;
            m_enabled   = false;
            m_temporary = temporary;
            m_period    = attotime.never;
            m_start     = machine.time();
            m_expire    = attotime.never;
            m_device    = null;
            m_id        = 0;

            // if we're not temporary, register ourselves with the save state system
            if (!m_temporary)
            {
                register_save();
            }

            // insert into the list
            machine.scheduler().timer_list_insert(this);

            return(this);
        }
Ejemplo n.º 29
0
        //-------------------------------------------------
        //  init - completely initialize the state when
        //  re-allocated as a device timer
        //-------------------------------------------------
        public emu_timer init(device_t device, device_timer_id id, object ptr, bool temporary)
        {
            // ensure the entire timer state is clean
            m_machine   = device.machine();
            m_next      = null;
            m_prev      = null;
            m_callback  = null;
            m_param     = 0;
            m_ptr       = ptr;
            m_enabled   = false;
            m_temporary = temporary;
            m_period    = attotime.never;
            m_start     = machine().time();
            m_expire    = attotime.never;
            m_device    = device;
            m_id        = id;

            // if we're not temporary, register ourselves with the save state system
            if (!m_temporary)
            {
                register_save();
            }

            // insert into the list
            machine().scheduler().timer_list_insert(this);

            return(this);
        }
Ejemplo n.º 30
0
Archivo: digfx.cs Proyecto: kwanboy/mcs
        bool m_decoded;                  // have we processed our decode info yet?


        // construction/destruction
        //-------------------------------------------------
        //  device_gfx_interface - constructor
        //-------------------------------------------------
        public device_gfx_interface(machine_config mconfig, device_t device, gfx_decode_entry [] gfxinfo = null, string palette_tag = finder_base.DUMMY_TAG)
            : base(device, "gfx")
        {
            m_paletteDevice       = new optional_device <palette_device>(this.device(), palette_tag); //m_palette(*this, palette_tag),
            m_gfxdecodeinfo       = gfxinfo;
            m_palette_is_disabled = false;
            m_decoded             = false;
        }