diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp index d38ef8f2cd2..a860f15f4dd 100644 --- a/src/devices/machine/netlist.cpp +++ b/src/devices/machine/netlist.cpp @@ -29,7 +29,6 @@ const device_type NETLIST_SOUND = &device_creator; const device_type NETLIST_ANALOG_INPUT = &device_creator; const device_type NETLIST_INT_INPUT = &device_creator; -const device_type NETLIST_ROM_REGION = &device_creator; const device_type NETLIST_RAM_POINTER = &device_creator; const device_type NETLIST_LOGIC_INPUT = &device_creator; const device_type NETLIST_STREAM_INPUT = &device_creator; @@ -219,41 +218,6 @@ void netlist_mame_logic_input_t::device_start() } } -// ---------------------------------------------------------------------------------------- -// netlist_mame_rom_t -// ---------------------------------------------------------------------------------------- - -netlist_mame_rom_t::netlist_mame_rom_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, NETLIST_ROM_REGION, "Netlist ROM Region", tag, owner, clock, "netlist_rom_region", __FILE__) - , netlist_mame_sub_interface(*owner) - , m_name("") - , m_region_tag(nullptr) - , m_offset(0) - , m_size(0) -{ -} - -void netlist_mame_rom_t::static_set_params(device_t &device, const char *name, const char* region_tag, std::size_t offset, std::size_t size) -{ - netlist_mame_rom_t &r = downcast(device); - LOG_DEV_CALLS(("static_set_params %s\n", device.tag())); - r.m_name = pstring(name, pstring::UTF8); - r.m_region_tag = region_tag; - r.m_offset = offset; - r.m_size = size; -} - -void netlist_mame_rom_t::custom_netlist_additions(netlist::setup_t &setup) -{ - if (memregion(m_region_tag) == nullptr) - fatalerror("device %s region %s not found\n", basetag(), m_region_tag); - setup.register_source(plib::make_unique_base(setup, - m_name, memregion(m_region_tag)->base() + m_offset, m_size)); -} - -void netlist_mame_rom_t::device_start() -{ -} // ---------------------------------------------------------------------------------------- // netlist_ram_pointer_t @@ -452,6 +416,9 @@ void netlist_mame_device_t::device_start() } } + /* add default data provider for roms */ + setup().register_source(plib::make_unique_base(setup())); + m_setup_func(setup()); /* let sub-devices tweak the netlist */ @@ -787,11 +754,24 @@ std::unique_ptr netlist_source_memregion_t::stream(const pstring return plib::make_unique_base(mem->base(), mem->bytes()); } -std::unique_ptr netlist_data_memregion_t::stream(const pstring &name) +netlist_data_memregions_t::netlist_data_memregions_t(netlist::setup_t &setup) +: netlist::source_t(setup, netlist::source_t::DATA) { - if (name == m_name) - return plib::make_unique_base(m_ptr, m_size); - else - return std::unique_ptr(nullptr); +} + +std::unique_ptr netlist_data_memregions_t::stream(const pstring &name) +{ + memory_region *mem = downcast(setup().netlist()).parent().memregion(name.c_str()); + //memory_region *mem = downcast(setup().netlist()).machine().root_device().memregion(name.c_str()); + if (mem != nullptr) + { + return plib::make_unique_base(mem->base(), mem->bytes()); + } + else + { + // This should be the last data provider being called - last resort + fatalerror("data named %s not found in device rom regions\n", name.c_str()); + return std::unique_ptr(nullptr); + } } diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h index c3c58509089..9f484d8bdbf 100644 --- a/src/devices/machine/netlist.h +++ b/src/devices/machine/netlist.h @@ -49,10 +49,6 @@ MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_INT_INPUT, 0) \ netlist_mame_int_input_t::static_set_params(*device, _name, _mask, _shift); -#define MCFG_NETLIST_ROM_REGION(_basetag, _tag, _region, _name, _offset, _size) \ - MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_ROM_REGION, 0) \ - netlist_mame_rom_t::static_set_params(*device, _name, ":" _region, _offset, _size); - #define MCFG_NETLIST_RAM_POINTER(_basetag, _tag, _name) \ MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_RAM_POINTER, 0) \ netlist_ram_pointer_t::static_set_params(*device, _name ".m_RAM"); @@ -102,23 +98,12 @@ private: pstring m_name; }; -class netlist_data_memregion_t : public netlist::source_t +class netlist_data_memregions_t : public netlist::source_t { public: - netlist_data_memregion_t(netlist::setup_t &setup, - pstring name, uint8_t *ptr, std::size_t size) - : netlist::source_t(setup, netlist::source_t::DATA) - , m_name(name) - , m_ptr(ptr) - , m_size(size) - { - } + netlist_data_memregions_t(netlist::setup_t &setup); virtual std::unique_ptr stream(const pstring &name) override; -private: - pstring m_name; - uint8_t *m_ptr; - std::size_t m_size; }; class netlist_mame_device_t; @@ -563,33 +548,6 @@ private: pstring m_param_name; }; -// ---------------------------------------------------------------------------------------- -// netlist_mame_rom_t -// ---------------------------------------------------------------------------------------- - -class netlist_mame_rom_t : public device_t, - public netlist_mame_sub_interface -{ -public: - - // construction/destruction - netlist_mame_rom_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual ~netlist_mame_rom_t() { } - - static void static_set_params(device_t &device, const char *name, const char* region_tag, std::size_t offset, std::size_t size); - -protected: - // device-level overrides - virtual void device_start() override; - virtual void custom_netlist_additions(netlist::setup_t &setup) override; - -private: - pstring m_name; - const char* m_region_tag; - std::size_t m_offset; - std::size_t m_size; -}; - // ---------------------------------------------------------------------------------------- // netlist_ram_pointer_t // ---------------------------------------------------------------------------------------- @@ -929,7 +887,6 @@ extern const device_type NETLIST_SOUND; extern const device_type NETLIST_ANALOG_INPUT; extern const device_type NETLIST_LOGIC_INPUT; extern const device_type NETLIST_INT_INPUT; -extern const device_type NETLIST_ROM_REGION; extern const device_type NETLIST_RAM_POINTER; extern const device_type NETLIST_LOGIC_OUTPUT; diff --git a/src/mame/drivers/atarittl.cpp b/src/mame/drivers/atarittl.cpp index 1affab02180..b63e10a6a70 100644 --- a/src/mame/drivers/atarittl.cpp +++ b/src/mame/drivers/atarittl.cpp @@ -136,8 +136,6 @@ public: , m_maincpu(*this, "maincpu") //, m_video(*this, "fixfreq") , m_probe_screen(*this, "screen") - , m_hf1(*this, "maincpu:hf1") - , m_d7(*this, "maincpu:d7") , m_probe_bit0(0.0) , m_probe_bit1(0.0) , m_probe_bit2(0.0) @@ -174,8 +172,6 @@ private: required_device m_maincpu; //required_device m_video; required_device m_probe_screen; - required_device m_hf1; - required_device m_d7; int m_probe_bit0; int m_probe_bit1; @@ -331,9 +327,6 @@ static MACHINE_CONFIG_START( stuntcyc, stuntcyc_state ) MCFG_DEVICE_ADD("maincpu", NETLIST_CPU, STUNTCYC_NL_CLOCK) MCFG_NETLIST_SETUP(stuntcyc) - MCFG_NETLIST_ROM_REGION("maincpu", "hf1", "hf1", "004275.f1", 0x0000, 0x0200) - MCFG_NETLIST_ROM_REGION("maincpu", "d7", "d7", "004811.d7", 0x0000, 0x0020) - //MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "vid0", "VIDEO_OUT", fixedfreq_device, update_vid, "fixfreq") MCFG_NETLIST_LOGIC_OUTPUT("maincpu", "probe_bit0", "probe_bit0", stuntcyc_state, probe_bit0_cb, "") MCFG_NETLIST_LOGIC_OUTPUT("maincpu", "probe_bit1", "probe_bit1", stuntcyc_state, probe_bit1_cb, "") @@ -495,10 +488,10 @@ ROM_END ROM_START( stuntcyc ) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) - ROM_REGION( 0x0200, "hf1", ROMREGION_ERASE00 ) + ROM_REGION( 0x0200, "maincpu:004275.f1", ROMREGION_ERASE00 ) ROM_LOAD( "004275.f1", 0x0000, 0x0200, CRC(4ed5a99d) SHA1(1e5f439bce72e78dfff76fd8f61187c6ef484a64) ) // Motorcycle & Bus - ROM_REGION( 0x0020, "d7", ROMREGION_ERASE00 ) + ROM_REGION( 0x0020, "maincpu:004811.d7", ROMREGION_ERASE00 ) ROM_LOAD( "004811.d7", 0x0000, 0x0020, CRC(31a09efb) SHA1(fd5d538c9ec1234acf7c74ca0704113d220abbf6) ) // Score Translator ROM_END diff --git a/src/mame/drivers/hazeltin.cpp b/src/mame/drivers/hazeltin.cpp index c39d5f5a104..c72d9c87c42 100644 --- a/src/mame/drivers/hazeltin.cpp +++ b/src/mame/drivers/hazeltin.cpp @@ -44,10 +44,12 @@ References: #define MISCKEYS_TAG "misc_keys" #define SCREEN_TAG "screen" #define BAUD_PROM_TAG "u39" -#define NL_PROM_TAG "videobrd:u71" -#define NL_EPROM_TAG "videobrd:u78" -#define VIDEO_PROM_TAG "u71" -#define CHAR_EPROM_TAG "u78" +//#define NL_PROM_TAG "videobrd:u71" +//#define NL_EPROM_TAG "videobrd:u78" +// VIDEO_PROM at u71 +#define VIDEO_PROM_TAG NETLIST_TAG ":u90_702128_82s129.bin" +// CHAR_EPROM at u78 +#define CHAR_EPROM_TAG NETLIST_TAG ":u83_chr.bin" #define VIDEO_OUT_TAG "videobrd:video_out" #define VBLANK_OUT_TAG "videobrd:vblank" #define TVINTERQ_OUT_TAG "videobrd:tvinterq" @@ -79,8 +81,6 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, CPU_TAG) , m_video_board(*this, NETLIST_TAG) - , m_u71(*this, NL_PROM_TAG) - , m_u78(*this, NL_EPROM_TAG) , m_u9(*this, "videobrd:u9") , m_u10(*this, "videobrd:u10") , m_u11(*this, "videobrd:u11") @@ -164,8 +164,6 @@ public: private: required_device m_maincpu; required_device m_video_board; - required_device m_u71; - required_device m_u78; required_device m_u9; required_device m_u10; required_device m_u11; @@ -712,9 +710,6 @@ static MACHINE_CONFIG_START( hazl1500, hazl1500_state ) MCFG_DEVICE_ADD(NETLIST_TAG, NETLIST_CPU, VIDEOBRD_CLOCK) MCFG_NETLIST_SETUP(hazelvid) - MCFG_NETLIST_ROM_REGION(NETLIST_TAG, VIDEO_PROM_TAG, VIDEO_PROM_TAG, "u90_702128_82s129.bin", 0x0000, 0x0100) - MCFG_NETLIST_ROM_REGION(NETLIST_TAG, CHAR_EPROM_TAG, CHAR_EPROM_TAG, "u83_chr.bin", 0x0000, 0x0800) - // First 1K MCFG_NETLIST_RAM_POINTER(NETLIST_TAG, "u22", "u22") MCFG_NETLIST_RAM_POINTER(NETLIST_TAG, "u23", "u23")