diff options
author | Ivan Vangelista <mesgnet@yahoo.it> | 2018-12-12 18:14:46 +0100 |
---|---|---|
committer | Ivan Vangelista <mesgnet@yahoo.it> | 2018-12-12 18:14:46 +0100 |
commit | 37502d5584184dc9c183e6782011a402a4a71ab6 (patch) | |
tree | 3b3de54ef2bb6caf98879442f6e275ab236a90a9 | |
parent | 8d8646a5b1f9ea5d6c681bbf2d1b281362b398da (diff) |
src/mame/machine: some more MCFG removal (nw)
-rw-r--r-- | src/mame/drivers/chihiro.cpp | 10 | ||||
-rw-r--r-- | src/mame/drivers/naomi.cpp | 59 | ||||
-rw-r--r-- | src/mame/drivers/segasp.cpp | 13 | ||||
-rw-r--r-- | src/mame/drivers/triforce.cpp | 8 | ||||
-rw-r--r-- | src/mame/machine/awboard.cpp | 7 | ||||
-rw-r--r-- | src/mame/machine/awboard.h | 12 | ||||
-rw-r--r-- | src/mame/machine/naomibd.cpp | 9 | ||||
-rw-r--r-- | src/mame/machine/naomibd.h | 11 | ||||
-rw-r--r-- | src/mame/machine/naomig1.h | 6 | ||||
-rw-r--r-- | src/mame/machine/naomigd.cpp | 8 | ||||
-rw-r--r-- | src/mame/machine/naomigd.h | 26 | ||||
-rw-r--r-- | src/mame/machine/naomim1.h | 9 | ||||
-rw-r--r-- | src/mame/machine/naomim2.h | 10 | ||||
-rw-r--r-- | src/mame/machine/naomim4.h | 13 | ||||
-rw-r--r-- | src/mame/machine/naomirom.h | 10 |
15 files changed, 117 insertions, 94 deletions
diff --git a/src/mame/drivers/chihiro.cpp b/src/mame/drivers/chihiro.cpp index 5ec11b46ef9..d8ec1a30ca5 100644 --- a/src/mame/drivers/chihiro.cpp +++ b/src/mame/drivers/chihiro.cpp @@ -1876,11 +1876,13 @@ MACHINE_CONFIG_START(chihiro_state::chihiro_base) MCFG_SEGA_837_13551_DEVICE_ADD("837_13551", "jvs_master", ":TILT", ":P1", ":P2", ":A0", ":A1", ":A2", ":A3", ":A4", ":A5", ":A6", ":A7", ":OUTPUT") MACHINE_CONFIG_END -MACHINE_CONFIG_START(chihiro_state::chihirogd) +void chihiro_state::chihirogd(machine_config &config) +{ chihiro_base(config); - MCFG_NAOMI_GDROM_BOARD_ADD("rom_board", ":gdrom", "^pic", nullptr, NOOP) - MCFG_DEVICE_ADD("network", SEGA_NETWORK_BOARD, 0) -MACHINE_CONFIG_END + NAOMI_GDROM_BOARD(config, m_dimmboard, 0, ":gdrom", "pic"); + m_dimmboard->irq_callback().set_nop(); + SEGA_NETWORK_BOARD(config, "network", 0); +} #define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \ ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_BIOS(bios)) diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index fd674df3c9e..5168aed6a24 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -2968,46 +2968,56 @@ MACHINE_CONFIG_END * Naomi 1, unprotected ROM sub-board */ -MACHINE_CONFIG_START(naomi_state::naomi) +void naomi_state::naomi(machine_config &config) +{ naomi_base(config); - MCFG_NAOMI_ROM_BOARD_ADD("rom_board", "naomibd_eeprom", WRITE8(*this, dc_state, g1_irq)) -MACHINE_CONFIG_END + naomi_rom_board &rom_board(NAOMI_ROM_BOARD(config, "rom_board", 0, "naomibd_eeprom")); + rom_board.irq_callback().set(FUNC(dc_state::g1_irq)); +} /* * Naomi 1 GD-Rom */ -MACHINE_CONFIG_START(naomi_state::naomigd) +void naomi_state::naomigd(machine_config &config) +{ naomi_base(config); - MCFG_NAOMI_GDROM_BOARD_ADD("rom_board", ":gdrom", ":pic", "naomibd_eeprom", WRITE8(*this, dc_state, g1_irq)) -MACHINE_CONFIG_END + naomi_gdrom_board &rom_board(NAOMI_GDROM_BOARD(config, "rom_board", 0, "naomibd_eeprom", ":gdrom", "pic")); + rom_board.irq_callback().set(FUNC(dc_state::g1_irq)); +} /* * Naomi 1, M1 sub-board */ -MACHINE_CONFIG_START(naomi_state::naomim1) +void naomi_state::naomim1(machine_config &config) +{ naomi_base(config); - MCFG_NAOMI_M1_BOARD_ADD("rom_board", "naomibd_eeprom", WRITE8(*this, dc_state, g1_irq)) -MACHINE_CONFIG_END + naomi_m1_board &rom_board(NAOMI_M1_BOARD(config, "rom_board", 0, "naomibd_eeprom")); + rom_board.irq_callback().set(FUNC(dc_state::g1_irq)); +} /* * Naomi 1, M2/3 sub-board */ -MACHINE_CONFIG_START(naomi_state::naomim2) +void naomi_state::naomim2(machine_config &config) +{ naomi_base(config); - MCFG_NAOMI_M2_BOARD_ADD("rom_board", "naomibd_eeprom", WRITE8(*this, dc_state, g1_irq)) -MACHINE_CONFIG_END + naomi_m2_board &rom_board(NAOMI_M2_BOARD(config, "rom_board", 0, "naomibd_eeprom")); + rom_board.irq_callback().set(FUNC(dc_state::g1_irq)); +} /* * Naomi 1, M4 sub-board */ -MACHINE_CONFIG_START(naomi_state::naomim4) +void naomi_state::naomim4(machine_config &config) +{ naomi_base(config); - MCFG_NAOMI_M4_BOARD_ADD("rom_board", "pic_readout", "naomibd_eeprom", WRITE8(*this, dc_state, g1_irq)) -MACHINE_CONFIG_END + naomi_m4_board &rom_board(NAOMI_M4_BOARD(config, "rom_board", 0, "naomibd_eeprom", "pic_readout")); + rom_board.irq_callback().set(FUNC(dc_state::g1_irq)); +} /* * Naomi M2 with Keyboard controllers @@ -3052,13 +3062,13 @@ void naomi2_state::naomi2_base(machine_config &config) // TODO: ELAN device } -MACHINE_CONFIG_START(naomi2_state::naomi2gd) +void naomi2_state::naomi2gd(machine_config &config) +{ naomigd(config); naomi2_base(config); - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(naomi2_map) -MACHINE_CONFIG_END + m_maincpu->set_addrmap(AS_PROGRAM, &naomi2_state::naomi2_map); +} /* * Naomi 2, M1 sub-board @@ -3076,13 +3086,13 @@ MACHINE_CONFIG_END * Naomi 2, M2/3 sub-board */ -MACHINE_CONFIG_START(naomi2_state::naomi2m2) +void naomi2_state::naomi2m2(machine_config &config) +{ naomim2(config); naomi2_base(config); - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(naomi2_map) -MACHINE_CONFIG_END + m_maincpu->set_addrmap(AS_PROGRAM, &naomi2_state::naomi2_map); +} /* * Atomiswave @@ -3095,7 +3105,8 @@ MACHINE_CONFIG_START(atomiswave_state::aw_base) MCFG_DEVICE_PROGRAM_MAP(aw_map) MCFG_DEVICE_IO_MAP(aw_port) MACRONIX_29L001MC(config, "awflash"); - MCFG_AW_ROM_BOARD_ADD("rom_board", "rom_key", WRITE8(*this, dc_state, g1_irq)) + aw_rom_board &rom_board(AW_ROM_BOARD(config, "rom_board", 0, "rom_key")); + rom_board.irq_callback().set(FUNC(dc_state::g1_irq)); MCFG_MACHINE_RESET_OVERRIDE(dc_state,dc_console) NVRAM(config, "sram", nvram_device::DEFAULT_ALL_0); diff --git a/src/mame/drivers/segasp.cpp b/src/mame/drivers/segasp.cpp index 5dd358870d8..0b80de4614f 100644 --- a/src/mame/drivers/segasp.cpp +++ b/src/mame/drivers/segasp.cpp @@ -302,19 +302,20 @@ INPUT_PORTS_START( segasp ) INPUT_PORTS_END -MACHINE_CONFIG_START(segasp_state::segasp) +void segasp_state::segasp(machine_config &config) +{ naomi_aw_base(config); - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(segasp_map) - MCFG_DEVICE_IO_MAP(onchip_port) + m_maincpu->set_addrmap(AS_PROGRAM, &segasp_state::segasp_map); + m_maincpu->set_addrmap(AS_IO, &segasp_state::onchip_port); EEPROM_93C46_16BIT(config, "main_eeprom"); EEPROM_93C46_16BIT(config, "sp_eeprom"); // todo, not exactly NaomiM4 (see notes at top of driver) use custom board type here instead X76F100(config, "naomibd_eeprom"); // actually not present - MCFG_NAOMI_M4_BOARD_ADD("rom_board", "pic_readout", "naomibd_eeprom", WRITE8(*this, dc_state, g1_irq)) -MACHINE_CONFIG_END + naomi_m4_board &rom_board(NAOMI_M4_BOARD(config, "rom_board", 0, "naomibd_eeprom", "pic_readout")); + rom_board.irq_callback().set(FUNC(dc_state::g1_irq)); +} void segasp_state::init_segasp() { diff --git a/src/mame/drivers/triforce.cpp b/src/mame/drivers/triforce.cpp index 327e63f9505..1c2e7af09cf 100644 --- a/src/mame/drivers/triforce.cpp +++ b/src/mame/drivers/triforce.cpp @@ -591,10 +591,12 @@ MACHINE_CONFIG_START(triforce_state::triforce_base) MACHINE_CONFIG_END -MACHINE_CONFIG_START(triforce_state::triforcegd) +void triforce_state::triforcegd(machine_config &config) +{ triforce_base(config); - MCFG_NAOMI_GDROM_BOARD_ADD("rom_board", ":gdrom", ":pic", nullptr, NOOP) -MACHINE_CONFIG_END + naomi_gdrom_board &rom_board(NAOMI_GDROM_BOARD(config, "rom_board", 0, ":gdrom", "pic")); + rom_board.irq_callback().set_nop(); +} #define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \ diff --git a/src/mame/machine/awboard.cpp b/src/mame/machine/awboard.cpp index 7dd54c246d7..ee6fb7d5b73 100644 --- a/src/mame/machine/awboard.cpp +++ b/src/mame/machine/awboard.cpp @@ -177,13 +177,6 @@ aw_rom_board::aw_rom_board(const machine_config &mconfig, const char *tag, devic { } -void aw_rom_board::static_set_keyregion(device_t &device, const char *keyregion) -{ - aw_rom_board &dev = downcast<aw_rom_board &>(device); - dev.m_keyregion.set_tag(keyregion); -} - - /* We are using 20 bits keys with the following subfields' structure: bits 0-15 is a 16-bits XOR diff --git a/src/mame/machine/awboard.h b/src/mame/machine/awboard.h index 821e1c869da..f991c5dcbc5 100644 --- a/src/mame/machine/awboard.h +++ b/src/mame/machine/awboard.h @@ -7,16 +7,18 @@ #include "naomig1.h" -#define MCFG_AW_ROM_BOARD_ADD(_tag, _keyregion, _irq_cb) \ - MCFG_NAOMI_G1_ADD(_tag, AW_ROM_BOARD, _irq_cb) \ - aw_rom_board::static_set_keyregion(*device, _keyregion); class aw_rom_board : public naomi_g1_device { public: - aw_rom_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + aw_rom_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&keyregion_tag) + : aw_rom_board(mconfig, tag, owner, clock) + { + m_keyregion.set_tag(std::forward<T>(keyregion_tag)); + } - static void static_set_keyregion(device_t &device, const char *keyregion); + aw_rom_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual void submap(address_map &map) override; diff --git a/src/mame/machine/naomibd.cpp b/src/mame/machine/naomibd.cpp index ccff9807234..d0550d6f1c6 100644 --- a/src/mame/machine/naomibd.cpp +++ b/src/mame/machine/naomibd.cpp @@ -75,9 +75,9 @@ void naomi_board::submap(address_map &map) } naomi_board::naomi_board(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : naomi_g1_device(mconfig, type, tag, owner, clock) + : naomi_g1_device(mconfig, type, tag, owner, clock), + eeprom(*this, finder_base::DUMMY_TAG) { - eeprom_tag = nullptr; } void naomi_board::device_start() @@ -90,11 +90,6 @@ void naomi_board::device_start() save_item(NAME(dma_cur_offset)); save_item(NAME(pio_ready)); save_item(NAME(dma_ready)); - - if (eeprom_tag != nullptr) - eeprom = owner()->subdevice<x76f100_device>(eeprom_tag); - else - eeprom = nullptr; } void naomi_board::device_reset() diff --git a/src/mame/machine/naomibd.h b/src/mame/machine/naomibd.h index b6258ad16a6..1786120bd76 100644 --- a/src/mame/machine/naomibd.h +++ b/src/mame/machine/naomibd.h @@ -8,15 +8,9 @@ #include "machine/naomig1.h" #include "machine/x76f100.h" -#define MCFG_NAOMI_BOARD_ADD(_tag, type, _eeprom_tag, _irq_cb) \ - MCFG_NAOMI_G1_ADD(_tag, type, _irq_cb) \ - downcast<naomi_board &>(*device).set_eeprom_tag(_eeprom_tag); - class naomi_board : public naomi_g1_device { public: - void set_eeprom_tag(const char *_eeprom_tag) { eeprom_tag = _eeprom_tag; } - // Can be patched in the underlying class virtual void submap(address_map &map) override; @@ -51,13 +45,12 @@ protected: virtual void board_write(offs_t offset, uint16_t data); uint32_t rom_offset; + optional_device<x76f100_device> eeprom; + private: uint32_t dma_offset, dma_cur_offset; uint16_t dma_count; bool pio_ready, dma_ready; - - const char *eeprom_tag; - x76f100_device *eeprom; }; #endif // MAME_MACHINE_NAOMIBD_H diff --git a/src/mame/machine/naomig1.h b/src/mame/machine/naomig1.h index 0458246d815..8533b72b66e 100644 --- a/src/mame/machine/naomig1.h +++ b/src/mame/machine/naomig1.h @@ -7,10 +7,6 @@ #include "cpu/sh/sh4.h" -#define MCFG_NAOMI_G1_ADD(_tag, type, _irq_cb) \ - MCFG_DEVICE_ADD(_tag, type, 0) \ - downcast<naomi_g1_device *>(device)->set_irq_cb(DEVCB_ ## _irq_cb); - class naomi_g1_device : public device_t { public: @@ -20,7 +16,7 @@ public: typedef delegate<void (uint32_t main_adr, void *dma_ptr, uint32_t length, uint32_t size, bool to_mainram)> dma_cb; - template <class Object> void set_irq_cb(Object &&cb) { irq_cb.set_callback(std::forward<Object>(cb)); } + auto irq_callback() { return irq_cb.bind(); } void set_dma_cb(dma_cb cb) { _dma_cb = cb; } void amap(address_map &map); diff --git a/src/mame/machine/naomigd.cpp b/src/mame/machine/naomigd.cpp index b25db732944..ddf8716bd40 100644 --- a/src/mame/machine/naomigd.cpp +++ b/src/mame/machine/naomigd.cpp @@ -402,10 +402,10 @@ void naomi_gdrom_board::write_from_qword(uint8_t *region, uint64_t qword) } naomi_gdrom_board::naomi_gdrom_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : naomi_board(mconfig, NAOMI_GDROM_BOARD, tag, owner, clock) + : naomi_board(mconfig, NAOMI_GDROM_BOARD, tag, owner, clock), + picdata(*this, finder_base::DUMMY_TAG) { image_tag = nullptr; - pic_tag = nullptr; } void naomi_gdrom_board::find_file(const char *name, const uint8_t *dir_sector, uint32_t &file_start, uint32_t &file_size) @@ -465,11 +465,9 @@ void naomi_gdrom_board::device_start() uint64_t key; uint8_t netpic = 0; - memory_region *mr = memregion(pic_tag); - const uint8_t *picdata = mr->base(); if(picdata) { - if(memregion(pic_tag)->bytes() >= 0x4000) { + if(picdata.length() >= 0x4000) { printf("Real PIC binary found\n"); for(int i=0;i<7;i++) name[i] = picdata[0x7c0+i*2]; diff --git a/src/mame/machine/naomigd.h b/src/mame/machine/naomigd.h index 4736d274b66..c220e5a77eb 100644 --- a/src/mame/machine/naomigd.h +++ b/src/mame/machine/naomigd.h @@ -7,19 +7,32 @@ #include "machine/naomibd.h" -#define MCFG_NAOMI_GDROM_BOARD_ADD(_tag, _image_tag, _pic_tag, _eeprom_tag, _irq_cb) \ - MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_GDROM_BOARD, _eeprom_tag, _irq_cb) \ - downcast<naomi_gdrom_board &>(*device).set_tags(_image_tag, _pic_tag); class naomi_gdrom_board : public naomi_board { public: + template <typename T, typename U> + naomi_gdrom_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&eeprom_tag, const char *_image_tag, U &&picregion_tag) + : naomi_gdrom_board(mconfig, tag, owner, clock) + { + eeprom.set_tag(std::forward<T>(eeprom_tag)); + set_image_tag(_image_tag); + picdata.set_tag(std::forward<U>(picregion_tag)); + } + + template <typename T> + naomi_gdrom_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, const char *_image_tag, T &&picregion_tag) + : naomi_gdrom_board(mconfig, tag, owner, clock) + { + picdata.set_tag(std::forward<T>(picregion_tag)); + set_image_tag(_image_tag); + } + naomi_gdrom_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - void set_tags(const char *_image_tag, const char *_pic_tag) + void set_image_tag(const char *_image_tag) { image_tag = _image_tag; - pic_tag = _pic_tag; } uint8_t *memory(uint32_t &size) { size = dimm_data_size; return dimm_data; } @@ -37,7 +50,8 @@ protected: private: enum { FILENAME_LENGTH=24 }; - const char *image_tag, *pic_tag; + const char *image_tag; + optional_region_ptr<uint8_t> picdata; uint32_t dimm_cur_address; diff --git a/src/mame/machine/naomim1.h b/src/mame/machine/naomim1.h index ffad96cb947..b0702b7c772 100644 --- a/src/mame/machine/naomim1.h +++ b/src/mame/machine/naomim1.h @@ -7,12 +7,17 @@ #include "naomibd.h" -#define MCFG_NAOMI_M1_BOARD_ADD(_tag, _eeprom_tag, _irq_cb) \ - MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M1_BOARD, _eeprom_tag, _irq_cb) class naomi_m1_board : public naomi_board { public: + template <typename T> + naomi_m1_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&eeprom_tag) + : naomi_m1_board(mconfig, tag, owner, clock) + { + eeprom.set_tag(std::forward<T>(eeprom_tag)); + } + naomi_m1_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual void submap(address_map &map) override; diff --git a/src/mame/machine/naomim2.h b/src/mame/machine/naomim2.h index 3c8a3fba553..e94a5c26c8c 100644 --- a/src/mame/machine/naomim2.h +++ b/src/mame/machine/naomim2.h @@ -9,12 +9,16 @@ #include "315-5881_crypt.h" -#define MCFG_NAOMI_M2_BOARD_ADD(_tag, _eeprom_tag, _irq_cb) \ - MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M2_BOARD, _eeprom_tag, _irq_cb) - class naomi_m2_board : public naomi_board { public: + template <typename T> + naomi_m2_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&eeprom_tag) + : naomi_m2_board(mconfig, tag, owner, clock) + { + eeprom.set_tag(std::forward<T>(eeprom_tag)); + } + naomi_m2_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); uint32_t rom_cur_address; static const int RAM_SIZE = 65536; diff --git a/src/mame/machine/naomim4.h b/src/mame/machine/naomim4.h index 28ef730a1b3..1ecab27a87b 100644 --- a/src/mame/machine/naomim4.h +++ b/src/mame/machine/naomim4.h @@ -5,16 +5,19 @@ #include "naomibd.h" -#define MCFG_NAOMI_M4_BOARD_ADD(_tag, _key_tag, _eeprom_tag, _irq_cb) \ - MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_M4_BOARD, _eeprom_tag, _irq_cb) \ - downcast<naomi_m4_board &>(*device).set_tags(_key_tag); class naomi_m4_board : public naomi_board { public: - naomi_m4_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T, typename U> + naomi_m4_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&eeprom_tag, U &&keyregion_tag) + : naomi_m4_board(mconfig, tag, owner, clock) + { + eeprom.set_tag(std::forward<T>(eeprom_tag)); + m_key_data.set_tag(std::forward<U>(keyregion_tag)); + } - void set_tags(const char *key_tag) { m_key_data.set_tag(key_tag); } + naomi_m4_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual void submap(address_map &map) override; diff --git a/src/mame/machine/naomirom.h b/src/mame/machine/naomirom.h index fc23b604058..76dad495ba9 100644 --- a/src/mame/machine/naomirom.h +++ b/src/mame/machine/naomirom.h @@ -5,12 +5,16 @@ #include "naomibd.h" -#define MCFG_NAOMI_ROM_BOARD_ADD(_tag, _eeprom_tag, _irq_cb) \ - MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_ROM_BOARD, _eeprom_tag, _irq_cb) - class naomi_rom_board : public naomi_board { public: + template <typename T> + naomi_rom_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&eeprom_tag) + : naomi_rom_board(mconfig, tag, owner, clock) + { + eeprom.set_tag(std::forward<T>(eeprom_tag)); + } + naomi_rom_board(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: |