From 349cb3cd64773ea37e0b6d931c15e7f5ec9df8c6 Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Mon, 28 May 2018 20:14:49 +0200 Subject: n64, pc1251, model2, midyunit, konamigx, k054338: Remove machine().device lookups, nw --- src/mame/audio/williams.h | 6 ++++ src/mame/drivers/asterix.cpp | 2 +- src/mame/drivers/bishi.cpp | 4 +-- src/mame/drivers/dbz.cpp | 2 +- src/mame/drivers/djmain.cpp | 2 +- src/mame/drivers/giclassic.cpp | 4 +-- src/mame/drivers/gijoe.cpp | 2 +- src/mame/drivers/konamigx.cpp | 29 +++++++++---------- src/mame/drivers/konmedal.cpp | 4 +-- src/mame/drivers/konmedal68k.cpp | 2 +- src/mame/drivers/lethal.cpp | 2 +- src/mame/drivers/moo.cpp | 4 +-- src/mame/drivers/mystwarr.cpp | 5 ++-- src/mame/drivers/pinball2k.cpp | 8 +++--- src/mame/drivers/piratesh.cpp | 30 ++++++++++--------- src/mame/drivers/qdrmfgp.cpp | 4 +-- src/mame/drivers/tasman.cpp | 2 +- src/mame/drivers/xexex.cpp | 2 +- src/mame/drivers/zr107.cpp | 2 +- src/mame/includes/konamigx.h | 15 ++++++---- src/mame/includes/midyunit.h | 2 ++ src/mame/includes/model2.h | 15 ++++++---- src/mame/includes/n64.h | 6 ++-- src/mame/includes/pc1251.h | 8 +++++- src/mame/machine/midyunit.cpp | 11 ++++--- src/mame/machine/n64.cpp | 46 ++++++++++++++++-------------- src/mame/machine/nes.cpp | 2 +- src/mame/machine/pc1251.cpp | 8 +++--- src/mame/video/k054156_k054157_k056832.cpp | 8 +----- src/mame/video/k054156_k054157_k056832.h | 22 +++++++------- src/mame/video/k054338.cpp | 4 +-- src/mame/video/k054338.h | 16 +++++------ src/mame/video/konamigx.cpp | 4 +-- src/mame/video/midyunit.cpp | 2 +- src/mame/video/model2.cpp | 14 ++++----- 35 files changed, 156 insertions(+), 143 deletions(-) diff --git a/src/mame/audio/williams.h b/src/mame/audio/williams.h index 2f75d3da043..00c6d1082de 100644 --- a/src/mame/audio/williams.h +++ b/src/mame/audio/williams.h @@ -49,6 +49,9 @@ public: DECLARE_WRITE8_MEMBER(cvsd_clock_set_w); void williams_cvsd_map(address_map &map); + + mc6809e_device *get_cpu() { return m_cpu; } + protected: // device-level overrides virtual void device_add_mconfig(machine_config &config) override; @@ -98,6 +101,9 @@ public: void williams_narc_master_map(address_map &map); void williams_narc_slave_map(address_map &map); + + mc6809e_device *get_cpu() { return m_cpu0; } + protected: // device-level overrides virtual void device_add_mconfig(machine_config &config) override; diff --git a/src/mame/drivers/asterix.cpp b/src/mame/drivers/asterix.cpp index 172cb33d2c6..f7f76be939c 100644 --- a/src/mame/drivers/asterix.cpp +++ b/src/mame/drivers/asterix.cpp @@ -286,7 +286,7 @@ MACHINE_CONFIG_START(asterix_state::asterix) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(asterix_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 1, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 1) MCFG_K056832_PALETTE("palette") MCFG_DEVICE_ADD("k053244", K053244, 0) diff --git a/src/mame/drivers/bishi.cpp b/src/mame/drivers/bishi.cpp index 019cc9df5c1..b3ea65f8c71 100644 --- a/src/mame/drivers/bishi.cpp +++ b/src/mame/drivers/bishi.cpp @@ -468,7 +468,7 @@ MACHINE_CONFIG_START(bishi_state::bishi) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(bishi_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_DEVICE_ADD("k054338", K054338, 0) @@ -491,7 +491,7 @@ MACHINE_CONFIG_START(bishi_state::dobouchn) // TODO: change accordingly (ASCII charset definitely not 8bpp, 5bpp perhaps?) MCFG_DEVICE_MODIFY("k056832") // MCFG_K056832_CB(bishi_state, dobouchn_tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 1, 0) MACHINE_CONFIG_END // ROM definitions diff --git a/src/mame/drivers/dbz.cpp b/src/mame/drivers/dbz.cpp index ad93902728a..f39270004d9 100644 --- a/src/mame/drivers/dbz.cpp +++ b/src/mame/drivers/dbz.cpp @@ -356,7 +356,7 @@ MACHINE_CONFIG_START(dbz_state::dbz) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(dbz_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 1, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 1) MCFG_K056832_PALETTE("palette") MCFG_DEVICE_ADD("k053246", K053246, 0) diff --git a/src/mame/drivers/djmain.cpp b/src/mame/drivers/djmain.cpp index 0a12b56f27e..1e4c24c1a59 100644 --- a/src/mame/drivers/djmain.cpp +++ b/src/mame/drivers/djmain.cpp @@ -1405,7 +1405,7 @@ MACHINE_CONFIG_START(djmain_state::djmainj) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(djmain_state, tile_callback) - MCFG_K056832_CONFIG("gfx2", K056832_BPP_4dj, 1, 1, "none") + MCFG_K056832_CONFIG("gfx2", K056832_BPP_4dj, 1, 1) MCFG_K056832_PALETTE("palette") MCFG_K055555_ADD("k055555") diff --git a/src/mame/drivers/giclassic.cpp b/src/mame/drivers/giclassic.cpp index 8875c59c84c..fe033ae3a32 100644 --- a/src/mame/drivers/giclassic.cpp +++ b/src/mame/drivers/giclassic.cpp @@ -316,7 +316,7 @@ MACHINE_CONFIG_START(giclassic_state::giclassic) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(giclassic_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4PIRATESH, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4PIRATESH, 1, 0) MCFG_K056832_PALETTE("palette") MACHINE_CONFIG_END @@ -342,7 +342,7 @@ MACHINE_CONFIG_START(giclassicsvr_state::giclassvr) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(giclassicsvr_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4PIRATESH, 0, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4PIRATESH, 0, 0) MCFG_K056832_PALETTE("palette") MCFG_DEVICE_ADD("k055673", K055673, 0) diff --git a/src/mame/drivers/gijoe.cpp b/src/mame/drivers/gijoe.cpp index 6cc940e1307..4e0e7fd0086 100644 --- a/src/mame/drivers/gijoe.cpp +++ b/src/mame/drivers/gijoe.cpp @@ -319,7 +319,7 @@ MACHINE_CONFIG_START(gijoe_state::gijoe) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(gijoe_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_DEVICE_ADD("k053246", K053246, 0) diff --git a/src/mame/drivers/konamigx.cpp b/src/mame/drivers/konamigx.cpp index 3971fd667bc..42c60706af5 100644 --- a/src/mame/drivers/konamigx.cpp +++ b/src/mame/drivers/konamigx.cpp @@ -1655,14 +1655,13 @@ MACHINE_CONFIG_START(konamigx_state::konamigx) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(konamigx_state, type2_tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 0, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 0, 0) MCFG_K056832_PALETTE("palette") MCFG_K055555_ADD("k055555") - MCFG_DEVICE_ADD("k054338", K054338, 0) - MCFG_K054338_MIXER("k055555") - MCFG_K054338_SET_SCREEN("screen") + MCFG_DEVICE_ADD("k054338", K054338, 0, "k055555") + MCFG_VIDEO_SET_SCREEN("screen") MCFG_K054338_ALPHAINV(1) MCFG_DEVICE_ADD("k055673", K055673, 0) @@ -1703,7 +1702,7 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(konamigx_state::konamigx_bios) konamigx(config); MCFG_DEVICE_MODIFY("k056832") - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 0, 0, "k055555") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 0, 0) MACHINE_CONFIG_END MACHINE_CONFIG_START(konamigx_state::gokuparo) @@ -1724,7 +1723,7 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(konamigx_state::tbyahhoo) konamigx(config); MCFG_DEVICE_MODIFY("k056832") - MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 0, 0, "k055555") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 0, 0) MACHINE_CONFIG_END MACHINE_CONFIG_START(konamigx_state::dragoonj) @@ -1736,7 +1735,7 @@ MACHINE_CONFIG_START(konamigx_state::dragoonj) MCFG_K053252_OFFSETS(24+16, 16) MCFG_DEVICE_MODIFY("k056832") - MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 1, 0) MCFG_DEVICE_MODIFY("k055673") MCFG_K055673_CB(konamigx_state, dragoonj_sprite_callback) @@ -1749,7 +1748,7 @@ MACHINE_CONFIG_START(konamigx_state::le2) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", konamigx_state, konamigx_type2_scanline, "screen", 0, 1) MCFG_DEVICE_MODIFY("k056832") - MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 1, 0) MCFG_DEVICE_MODIFY("k055673") MCFG_K055673_CB(konamigx_state, le2_sprite_callback) @@ -1761,7 +1760,7 @@ MACHINE_CONFIG_START(konamigx_state::konamigx_6bpp) MCFG_VIDEO_START_OVERRIDE(konamigx_state, konamigx_6bpp) MCFG_DEVICE_MODIFY("k056832") - MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 0, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 0, 0) MCFG_DEVICE_MODIFY("k055673") MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -46, -23) @@ -1770,7 +1769,7 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(konamigx_state::salmndr2) konamigx(config); MCFG_DEVICE_MODIFY("k056832") - MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 1, 0) MCFG_DEVICE_MODIFY("k055673") MCFG_K055673_CB(konamigx_state, salmndr2_sprite_callback) @@ -1809,7 +1808,7 @@ MACHINE_CONFIG_START(konamigx_state::racinfrc) MCFG_K053252_OFFSETS(24-8+16, 0) MCFG_DEVICE_MODIFY("k056832") - MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 0, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 0, 0) MCFG_DEVICE_MODIFY("k055673") MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -53, -23) @@ -1838,7 +1837,7 @@ MACHINE_CONFIG_START(konamigx_state::gxtype3) MCFG_K053252_SET_SLAVE_SCREEN("screen2") MCFG_DEVICE_MODIFY("k056832") - MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 0, 2, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_6, 0, 2) MCFG_DEVICE_MODIFY("k055673") MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX6, -132, -23) @@ -1898,7 +1897,7 @@ MACHINE_CONFIG_START(konamigx_state::gxtype4) MCFG_DEVICE_MODIFY("k056832") - MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 0, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 0, 0) MCFG_DEVICE_MODIFY("k055673") MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX6, -79, -24) // -23 looks better in intro @@ -1923,7 +1922,7 @@ MACHINE_CONFIG_START(konamigx_state::gxtype4_vsn) MCFG_VIDEO_START_OVERRIDE(konamigx_state, konamigx_type4_vsn) MCFG_DEVICE_MODIFY("k056832") - MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 0, 2, "none") // set djmain_hack to 2 to kill layer association or half the tilemaps vanish on screen 0 + MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 0, 2) // set djmain_hack to 2 to kill layer association or half the tilemaps vanish on screen 0 MCFG_DEVICE_MODIFY("k055673") MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX6, -132, -23) @@ -1947,7 +1946,7 @@ MACHINE_CONFIG_START(konamigx_state::winspike) MCFG_DEVICE_MODIFY("k056832") MCFG_K056832_CB(konamigx_state, alpha_tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 0, 2, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_8, 0, 2) MCFG_DEVICE_MODIFY("k055673") MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_LE2, -53, -23) diff --git a/src/mame/drivers/konmedal.cpp b/src/mame/drivers/konmedal.cpp index 938582bc444..8aa0cbb2932 100644 --- a/src/mame/drivers/konmedal.cpp +++ b/src/mame/drivers/konmedal.cpp @@ -401,7 +401,7 @@ MACHINE_CONFIG_START(konmedal_state::tsukande) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(konmedal_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0) MCFG_K056832_PALETTE("palette") /* sound hardware */ @@ -435,7 +435,7 @@ MACHINE_CONFIG_START(konmedal_state::ddboy) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(konmedal_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0) MCFG_K056832_PALETTE("palette") /* sound hardware */ diff --git a/src/mame/drivers/konmedal68k.cpp b/src/mame/drivers/konmedal68k.cpp index 68e6b1ca3f9..1761144ce98 100644 --- a/src/mame/drivers/konmedal68k.cpp +++ b/src/mame/drivers/konmedal68k.cpp @@ -313,7 +313,7 @@ MACHINE_CONFIG_START(konmedal68k_state::kzaurus) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(konmedal68k_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4dj, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4dj, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_K055555_ADD("k055555") diff --git a/src/mame/drivers/lethal.cpp b/src/mame/drivers/lethal.cpp index 081e63c2aa7..0d1b03ae885 100644 --- a/src/mame/drivers/lethal.cpp +++ b/src/mame/drivers/lethal.cpp @@ -523,7 +523,7 @@ MACHINE_CONFIG_START(lethal_state::lethalen) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(lethal_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_8LE, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_8LE, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_DEVICE_ADD("k053244", K053244, 0) diff --git a/src/mame/drivers/moo.cpp b/src/mame/drivers/moo.cpp index 82b83c6782c..86a3a9ae445 100644 --- a/src/mame/drivers/moo.cpp +++ b/src/mame/drivers/moo.cpp @@ -535,7 +535,7 @@ MACHINE_CONFIG_START(moo_state::moo) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(moo_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_K053251_ADD("k053251") @@ -592,7 +592,7 @@ MACHINE_CONFIG_START(moo_state::moobl) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(moo_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_K053251_ADD("k053251") diff --git a/src/mame/drivers/mystwarr.cpp b/src/mame/drivers/mystwarr.cpp index e1b526456f7..d68df389012 100644 --- a/src/mame/drivers/mystwarr.cpp +++ b/src/mame/drivers/mystwarr.cpp @@ -977,7 +977,7 @@ MACHINE_CONFIG_START(mystwarr_state::mystwarr) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(mystwarr_state, mystwarr_tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 0, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_5, 0, 0) MCFG_K056832_PALETTE("palette") MCFG_K055555_ADD("k055555") @@ -987,9 +987,8 @@ MACHINE_CONFIG_START(mystwarr_state::mystwarr) MCFG_K055673_CONFIG("gfx2", K055673_LAYOUT_GX, -48, -24) MCFG_K055673_PALETTE("palette") - MCFG_DEVICE_ADD("k054338", K054338, 0) + MCFG_DEVICE_ADD("k054338", K054338, 0, "k055555") MCFG_K054338_ALPHAINV(1) - MCFG_K054338_MIXER("k055555") MCFG_VIDEO_START_OVERRIDE(mystwarr_state, mystwarr) diff --git a/src/mame/drivers/pinball2k.cpp b/src/mame/drivers/pinball2k.cpp index b7819d525db..2b10854c90c 100644 --- a/src/mame/drivers/pinball2k.cpp +++ b/src/mame/drivers/pinball2k.cpp @@ -40,6 +40,7 @@ public: m_vram(*this, "vram"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), + m_ramdac(*this, "ramdac"), m_palette(*this, "palette") { } required_shared_ptr m_main_ram; @@ -48,6 +49,7 @@ public: required_shared_ptr m_vram; required_device m_gfxdecode; required_device m_screen; + required_device m_ramdac; required_device m_palette; uint8_t m_pal[768]; @@ -342,8 +344,6 @@ WRITE32_MEMBER(pinball2k_state::memory_ctrl_w) // printf("memory_ctrl_w %08X, %08X, %08X\n", data, offset*4, mem_mask); if (offset == 0x20/4) { - ramdac_device *ramdac = machine().device("ramdac"); - if((m_disp_ctrl_reg[DC_GENERAL_CFG] & 0x00e00000) == 0x00400000) { // guess: crtc params? @@ -352,7 +352,7 @@ WRITE32_MEMBER(pinball2k_state::memory_ctrl_w) else if((m_disp_ctrl_reg[DC_GENERAL_CFG] & 0x00f00000) == 0x00000000) { m_pal_index = data; - ramdac->index_w( space, 0, data ); + m_ramdac->index_w( space, 0, data ); } else if((m_disp_ctrl_reg[DC_GENERAL_CFG] & 0x00f00000) == 0x00100000) { @@ -362,7 +362,7 @@ WRITE32_MEMBER(pinball2k_state::memory_ctrl_w) { m_pal_index = 0; } - ramdac->pal_w( space, 0, data ); + m_ramdac->pal_w( space, 0, data ); } } else diff --git a/src/mame/drivers/piratesh.cpp b/src/mame/drivers/piratesh.cpp index cda2f74ea77..79e03eb0260 100644 --- a/src/mame/drivers/piratesh.cpp +++ b/src/mame/drivers/piratesh.cpp @@ -29,19 +29,19 @@ #include "emu.h" #include "speaker.h" -#include "video/k053250_ps.h" -#include "machine/nvram.h" -#include "machine/timer.h" #include "cpu/m68000/m68000.h" -#include "sound/k054539.h" #include "includes/konamigx.h" // TODO: WHY? -#include "video/konami_helper.h" -#include "machine/ticket.h" #include "machine/gen_latch.h" #include "machine/k053252.h" -#include "video/k055555.h" -#include "video/k054000.h" +#include "machine/nvram.h" +#include "machine/ticket.h" +#include "machine/timer.h" +#include "sound/k054539.h" #include "video/k053246_k053247_k055673.h" +#include "video/k053250_ps.h" +#include "video/k054000.h" +#include "video/k055555.h" +#include "video/konami_helper.h" class piratesh_state : public driver_device { @@ -56,6 +56,8 @@ public: m_k055555(*this, "k055555"), // m_k053246(*this, "k053246"), m_k054539(*this, "k054539"), + m_tickets(*this, "ticket"), + m_hopper(*this, "hopper"), m_spriteram(*this,"spriteram") { } @@ -69,6 +71,9 @@ public: required_device m_k054539; // required_device m_k053246; + required_device m_tickets; + required_device m_hopper; + optional_shared_ptr m_spriteram; int m_layer_colorbase[6]; @@ -376,8 +381,8 @@ WRITE16_MEMBER(piratesh_state::control3_w) printf("CTRL1 W: %x %x %x\n", offset, data, mem_mask); // printf("CTRL 1: %x\n", data & 0x0010); - machine().device("ticket")->motor_w(data & 0x0010 ? 1 : 0); - machine().device("hopper")->motor_w(data & 0x0020 ? 1 : 0); + m_tickets->motor_w(data & 0x0010 ? 1 : 0); + m_hopper->motor_w(data & 0x0020 ? 1 : 0); m_control = data; } @@ -618,7 +623,7 @@ MACHINE_CONFIG_START(piratesh_state::piratesh) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(piratesh_state, piratesh_tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4PIRATESH, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4PIRATESH, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_K055555_ADD("k055555") @@ -636,9 +641,8 @@ MACHINE_CONFIG_START(piratesh_state::piratesh) //MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, -48+1, 23) //MCFG_K053246_PALETTE("palette") - MCFG_DEVICE_ADD("k054338", K054338, 0) + MCFG_DEVICE_ADD("k054338", K054338, 0, "k055555") MCFG_K054338_ALPHAINV(1) - MCFG_K054338_MIXER("k055555") MCFG_VIDEO_START_OVERRIDE(piratesh_state, piratesh) diff --git a/src/mame/drivers/qdrmfgp.cpp b/src/mame/drivers/qdrmfgp.cpp index e7e8fa54c73..c6c22972b60 100644 --- a/src/mame/drivers/qdrmfgp.cpp +++ b/src/mame/drivers/qdrmfgp.cpp @@ -552,7 +552,7 @@ MACHINE_CONFIG_START(qdrmfgp_state::qdrmfgp) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(qdrmfgp_state, qdrmfgp_tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4dj, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4dj, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_DEVICE_ADD("k053252", K053252, XTAL(32'000'000)/4) @@ -598,7 +598,7 @@ MACHINE_CONFIG_START(qdrmfgp_state::qdrmfgp2) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(qdrmfgp_state, qdrmfgp2_tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4dj, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4dj, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_DEVICE_ADD("k053252", K053252, XTAL(32'000'000)/4) diff --git a/src/mame/drivers/tasman.cpp b/src/mame/drivers/tasman.cpp index 4aa1a1d4175..ff1571c4ff4 100644 --- a/src/mame/drivers/tasman.cpp +++ b/src/mame/drivers/tasman.cpp @@ -679,7 +679,7 @@ MACHINE_CONFIG_START(kongambl_state::kongambl) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(kongambl_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_8TASMAN, 0, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_8TASMAN, 0, 0) MCFG_K056832_PALETTE("palette") SPEAKER(config, "lspeaker").front_left(); diff --git a/src/mame/drivers/xexex.cpp b/src/mame/drivers/xexex.cpp index 0ccf33025dd..53b5c956ed4 100644 --- a/src/mame/drivers/xexex.cpp +++ b/src/mame/drivers/xexex.cpp @@ -501,7 +501,7 @@ MACHINE_CONFIG_START(xexex_state::xexex) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(xexex_state, tile_callback) - MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none") + MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_DEVICE_ADD("k053246", K053246, 0) diff --git a/src/mame/drivers/zr107.cpp b/src/mame/drivers/zr107.cpp index 31d8a16626c..96cf06c2ba4 100644 --- a/src/mame/drivers/zr107.cpp +++ b/src/mame/drivers/zr107.cpp @@ -806,7 +806,7 @@ MACHINE_CONFIG_START(zr107_state::zr107) MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(zr107_state, tile_callback) - MCFG_K056832_CONFIG("gfx2", K056832_BPP_8, 1, 0, "none") + MCFG_K056832_CONFIG("gfx2", K056832_BPP_8, 1, 0) MCFG_K056832_PALETTE("palette") MCFG_DEVICE_ADD("k001005", K001005, 0, "k001006_1") diff --git a/src/mame/includes/konamigx.h b/src/mame/includes/konamigx.h index 3ef4a65f967..a1514381173 100644 --- a/src/mame/includes/konamigx.h +++ b/src/mame/includes/konamigx.h @@ -3,17 +3,18 @@ #ifndef MAME_INCLUDES_KONAMIGX_H #define MAME_INCLUDES_KONAMIGX_H -#include "sound/k056800.h" -#include "sound/k054539.h" #include "cpu/tms57002/tms57002.h" #include "machine/adc083x.h" #include "machine/k053252.h" #include "machine/timer.h" -#include "video/k054156_k054157_k056832.h" +#include "sound/k056800.h" +#include "sound/k054539.h" #include "video/k053246_k053247_k055673.h" -#include "video/k055555.h" -#include "video/k054338.h" +#include "video/k053250.h" #include "video/k053936.h" +#include "video/k054156_k054157_k056832.h" +#include "video/k054338.h" +#include "video/k055555.h" #include "screen.h" class konamigx_state : public driver_device @@ -32,6 +33,8 @@ public: , m_k056800(*this, "k056800") , m_k054539_1(*this, "k054539_1") , m_k054539_2(*this, "k054539_2") + , m_k053250_1(*this, "k053250_1") + , m_k053250_2(*this, "k053250_2") , m_gfxdecode(*this, "gfxdecode") , m_screen(*this, "screen") , m_palette(*this, "palette") @@ -198,6 +201,8 @@ protected: optional_device m_k056800; optional_device m_k054539_1; optional_device m_k054539_2; + optional_device m_k053250_1; + optional_device m_k053250_2; optional_device m_gfxdecode; required_device m_screen; required_device m_palette; diff --git a/src/mame/includes/midyunit.h b/src/mame/includes/midyunit.h index a582129c94b..cdb4b27fdf6 100644 --- a/src/mame/includes/midyunit.h +++ b/src/mame/includes/midyunit.h @@ -55,6 +55,7 @@ public: , m_adpcm_sound(*this, "adpcm") , m_soundlatch(*this, "soundlatch") , m_term2_adc(*this, "adc") + , m_nvram(*this, "nvram") , m_generic_paletteram_16(*this, "paletteram") , m_gfx_rom(*this, "gfx_rom", 16) , m_mainram(*this, "mainram") @@ -72,6 +73,7 @@ public: optional_device m_adpcm_sound; optional_device m_soundlatch; optional_device m_term2_adc; + required_device m_nvram; required_shared_ptr m_generic_paletteram_16; optional_shared_ptr m_gfx_rom; diff --git a/src/mame/includes/model2.h b/src/mame/includes/model2.h index 7e06084787d..c622b1150f4 100644 --- a/src/mame/includes/model2.h +++ b/src/mame/includes/model2.h @@ -1,21 +1,22 @@ // license:BSD-3-Clause // copyright-holders:R. Belmont, Olivier Galibert, ElSemi, Angelo Salese -#include "video/poly.h" #include "audio/dsbz80.h" #include "audio/segam1audio.h" -#include "machine/eepromser.h" -#include "machine/i8251.h" #include "cpu/i960/i960.h" #include "cpu/mb86233/mb86233.h" #include "cpu/sharc/sharc.h" #include "cpu/mb86235/mb86235.h" -#include "machine/bankdev.h" -#include "machine/gen_fifo.h" -#include "sound/scsp.h" #include "machine/315-5881_crypt.h" #include "machine/315-5838_317-0229_comp.h" +#include "machine/bankdev.h" +#include "machine/eepromser.h" +#include "machine/gen_fifo.h" +#include "machine/i8251.h" #include "machine/m2comm.h" #include "machine/timer.h" +#include "sound/scsp.h" +#include "video/segaic24.h" +#include "video/poly.h" #include "screen.h" class model2_renderer; @@ -43,6 +44,7 @@ public: m_copro_fifo_out(*this, "copro_fifo_out"), m_drivecpu(*this, "drivecpu"), m_eeprom(*this, "eeprom"), + m_tiles(*this, "tile"), m_screen(*this, "screen"), m_palette(*this, "palette"), m_scsp(*this, "scsp"), @@ -100,6 +102,7 @@ protected: required_device m_copro_fifo_out; optional_device m_drivecpu; optional_device m_eeprom; + required_device m_tiles; required_device m_screen; required_device m_palette; optional_device m_scsp; diff --git a/src/mame/includes/n64.h b/src/mame/includes/n64.h index 1351db0e469..042e87d3b49 100644 --- a/src/mame/includes/n64.h +++ b/src/mame/includes/n64.h @@ -174,8 +174,8 @@ protected: private: n64_state* m_n64; address_space *m_mem_map; - mips3_device *m_vr4300; - rsp_device *m_rsp; + required_device m_vr4300; + required_device m_rsp; uint32_t *m_rdram; uint32_t *m_sram; @@ -200,7 +200,7 @@ private: void ai_fifo_pop(); bool ai_delayed_carry; - dmadac_sound_device *ai_dac[2]; + required_device_array ai_dac; uint32_t ai_dram_addr; uint32_t ai_len; uint32_t ai_control; diff --git a/src/mame/includes/pc1251.h b/src/mame/includes/pc1251.h index 18d86ad0c70..85232087e55 100644 --- a/src/mame/includes/pc1251.h +++ b/src/mame/includes/pc1251.h @@ -30,7 +30,9 @@ public: : pocketc_state(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_cpu_nvram(*this, "cpu_nvram"), + m_ram_nvram(*this, "ram_nvram") { } uint8_t m_outa; uint8_t m_outb; @@ -65,8 +67,12 @@ public: void pc1255_mem(address_map &map); void pc1260_mem(address_map &map); void pc1261_mem(address_map &map); + protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + + required_device m_cpu_nvram; + required_device m_ram_nvram; }; #endif // MAME_INCLUDES_PC1251_H diff --git a/src/mame/machine/midyunit.cpp b/src/mame/machine/midyunit.cpp index 85e5de73663..efcbffcf8b7 100644 --- a/src/mame/machine/midyunit.cpp +++ b/src/mame/machine/midyunit.cpp @@ -236,11 +236,10 @@ void midyunit_state::init_generic(int bpp, int sound, int prot_start, int prot_e { offs_t gfx_chunk = m_gfx_rom.bytes() / 4; uint8_t d1, d2, d3, d4, d5, d6; - uint8_t *base; int i; /* load graphics ROMs */ - base = memregion("gfx1")->base(); + uint8_t *base = memregion("gfx1")->base(); switch (bpp) { case 4: @@ -287,20 +286,20 @@ void midyunit_state::init_generic(int bpp, int sound, int prot_start, int prot_e switch (sound) { case SOUND_CVSD_SMALL: - machine().device("cvsd:cpu")->memory().space(AS_PROGRAM).install_write_handler(prot_start, prot_end, write8_delegate(FUNC(midyunit_state::cvsd_protection_w), this)); + m_cvsd_sound->get_cpu()->space(AS_PROGRAM).install_write_handler(prot_start, prot_end, write8_delegate(FUNC(midyunit_state::cvsd_protection_w), this)); m_cvsd_protection_base = memregion("cvsd:cpu")->base() + 0x10000 + (prot_start - 0x8000); break; case SOUND_CVSD: - machine().device("cvsd:cpu")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end); + m_cvsd_sound->get_cpu()->space(AS_PROGRAM).install_ram(prot_start, prot_end); break; case SOUND_ADPCM: - machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end); + m_adpcm_sound->get_cpu()->space(AS_PROGRAM).install_ram(prot_start, prot_end); break; case SOUND_NARC: - machine().device("narcsnd:cpu0")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end); + m_narc_sound->get_cpu()->space(AS_PROGRAM).install_ram(prot_start, prot_end); break; case SOUND_YAWDIM: diff --git a/src/mame/machine/n64.cpp b/src/mame/machine/n64.cpp index eb4e2cd7443..26f62632c8b 100644 --- a/src/mame/machine/n64.cpp +++ b/src/mame/machine/n64.cpp @@ -19,6 +19,9 @@ n64_periphs::n64_periphs(const machine_config &mconfig, const char *tag, device_ , dd_present(false) , disk_present(false) , cart_present(false) + , m_vr4300(*this, ":maincpu") + , m_rsp(*this, ":rsp") + , ai_dac(*this, "dac%u", 1U) { for (int32_t i = 0; i < 256; i++) { @@ -123,8 +126,6 @@ void n64_periphs::device_reset() { uint32_t *cart = (uint32_t*)machine().root_device().memregion("user2")->base(); - m_vr4300 = machine().device("maincpu"); - m_rsp = machine().device("rsp"); m_mem_map = &m_vr4300->space(AS_PROGRAM); m_rdram = m_n64->rdram(); @@ -158,8 +159,6 @@ void n64_periphs::device_reset() vi_xscale = 0; vi_yscale = 0; - ai_dac[0] = machine().device("dac1"); - ai_dac[1] = machine().device("dac2"); ai_timer->adjust(attotime::never); memset(ai_fifo, 0, sizeof(ai_fifo)); ai_fifo_wpos = 0; @@ -1271,7 +1270,8 @@ void n64_periphs::ai_dma() //osd_printf_debug("DACDMA: %x for %x bytes\n", current->address, current->length); - dmadac_transfer(&ai_dac[0], 2, 1, 2, current->length/4, ram); + ai_dac[0]->transfer(0, 1, 2, current->length/4, ram); + ai_dac[1]->transfer(1, 1, 2, current->length/4, ram); ai_status |= 0x40000000; @@ -1287,7 +1287,7 @@ void n64_periphs::ai_dma() TIMER_CALLBACK_MEMBER(n64_periphs::ai_timer_callback) { - machine().device("rcp")->ai_timer_tick(); + ai_timer_tick(); } void n64_periphs::ai_timer_tick() @@ -1365,10 +1365,17 @@ WRITE32_MEMBER( n64_periphs::ai_reg_w ) break; case 0x10/4: // AI_DACRATE_REG + { ai_dacrate = data & 0x3fff; - dmadac_set_frequency(&ai_dac[0], 2, (double)DACRATE_NTSC / (double)(ai_dacrate+1)); - dmadac_enable(&ai_dac[0], 2, 1); + const double frequency = (double)DACRATE_NTSC / (double)(ai_dacrate+1); + + ai_dac[0]->set_frequency(frequency); + ai_dac[0]->enable(1); + + ai_dac[1]->set_frequency(frequency); + ai_dac[1]->enable(1); break; + } case 0x14/4: // AI_BITRATE_REG ai_bitrate = data & 0xf; @@ -2085,7 +2092,7 @@ void n64_periphs::handle_pif() TIMER_CALLBACK_MEMBER(n64_periphs::si_dma_callback) { - machine().device("rcp")->si_dma_tick(); + si_dma_tick(); } void n64_periphs::si_dma_tick() @@ -2712,12 +2719,10 @@ WRITE32_MEMBER( n64_periphs::pif_ram_w ) void n64_state::n64_machine_stop() { - n64_periphs *periphs = machine().device("rcp"); - - if( periphs->m_nvram_image == nullptr ) + if (m_rcp_periphs->m_nvram_image == nullptr) return; - device_image_interface *image = dynamic_cast(periphs->m_nvram_image); + device_image_interface *image = dynamic_cast(m_rcp_periphs->m_nvram_image); uint8_t data[0x30800]; if (m_sram == nullptr) @@ -2728,9 +2733,9 @@ void n64_state::n64_machine_stop() { memcpy(data, m_sram, 0x20000); } - memcpy(data + 0x20000, periphs->m_save_data.eeprom, 0x800); - memcpy(data + 0x20800, periphs->m_save_data.mempak[0], 0x8000); - memcpy(data + 0x28800, periphs->m_save_data.mempak[1], 0x8000); + memcpy(data + 0x20000, m_rcp_periphs->m_save_data.eeprom, 0x800); + memcpy(data + 0x20800, m_rcp_periphs->m_save_data.mempak[0], 0x8000); + memcpy(data + 0x28800, m_rcp_periphs->m_save_data.mempak[1], 0x8000); image->battery_save(data, 0x30800); } @@ -2741,11 +2746,10 @@ void n64_state::machine_start() /* configure fast RAM regions */ //m_vr4300->add_fastram(0x00000000, 0x007fffff, false, m_rdram); - rsp_device *rsp = machine().device("rsp"); - rsp->rspdrc_set_options(RSPDRC_STRICT_VERIFY); - rsp->rspdrc_flush_drc_cache(); - rsp->rsp_add_dmem(m_rsp_dmem); - rsp->rsp_add_imem(m_rsp_imem); + m_rsp->rspdrc_set_options(RSPDRC_STRICT_VERIFY); + m_rsp->rspdrc_flush_drc_cache(); + m_rsp->rsp_add_dmem(m_rsp_dmem); + m_rsp->rsp_add_imem(m_rsp_imem); /* add a hook for battery save */ machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&n64_state::n64_machine_stop,this)); diff --git a/src/mame/machine/nes.cpp b/src/mame/machine/nes.cpp index 84dfffbb444..d5c03f161d3 100644 --- a/src/mame/machine/nes.cpp +++ b/src/mame/machine/nes.cpp @@ -185,7 +185,7 @@ WRITE8_MEMBER(nes_state::fc_in0_w) void nes_state::init_famicom() { // setup alt input handlers for additional FC input devices - address_space &space = machine().device("maincpu")->space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); space.install_read_handler(0x4016, 0x4016, read8_delegate(FUNC(nes_state::fc_in0_r), this)); space.install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(nes_state::fc_in0_w), this)); space.install_read_handler(0x4017, 0x4017, read8_delegate(FUNC(nes_state::fc_in1_r), this)); diff --git a/src/mame/machine/pc1251.cpp b/src/mame/machine/pc1251.cpp index 8249a970b3e..852db32b352 100644 --- a/src/mame/machine/pc1251.cpp +++ b/src/mame/machine/pc1251.cpp @@ -92,8 +92,8 @@ void pc1251_state::machine_start() uint8_t *ram = memregion("maincpu")->base() + 0x8000; uint8_t *cpu = m_maincpu->internal_ram(); - machine().device("cpu_nvram")->set_base(cpu, 96); - machine().device("ram_nvram")->set_base(ram, 0x4800); + m_cpu_nvram->set_base(cpu, 96); + m_ram_nvram->set_base(ram, 0x4800); } MACHINE_START_MEMBER(pc1251_state,pc1260 ) @@ -101,8 +101,8 @@ MACHINE_START_MEMBER(pc1251_state,pc1260 ) uint8_t *ram = memregion("maincpu")->base() + 0x4000; uint8_t *cpu = m_maincpu->internal_ram(); - machine().device("cpu_nvram")->set_base(cpu, 96); - machine().device("ram_nvram")->set_base(ram, 0x2800); + m_cpu_nvram->set_base(cpu, 96); + m_ram_nvram->set_base(ram, 0x2800); } void pc1251_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/k054156_k054157_k056832.cpp b/src/mame/video/k054156_k054157_k056832.cpp index 9bde7c4f214..723fd0ae654 100644 --- a/src/mame/video/k054156_k054157_k056832.cpp +++ b/src/mame/video/k054156_k054157_k056832.cpp @@ -168,8 +168,6 @@ ones. The other 7 words are ignored. Global scrollx is ignored. #include "k054156_k054157_k056832.h" #include "konami_helper.h" -#include "video/k055555.h" // still needs k055555_get_palette_index - #define VERBOSE 0 #include "logmacro.h" @@ -200,7 +198,6 @@ k056832_device::k056832_device(const machine_config &mconfig, const char *tag, d m_bpp(-1), m_big(0), m_djmain_hack(0), - m_k055555_tag(nullptr), //m_layer_assoc_with_page[K056832_PAGE_COUNT], //m_layer_offs[8][2], //m_lsram_page[8][2], @@ -224,7 +221,7 @@ k056832_device::k056832_device(const machine_config &mconfig, const char *tag, d m_use_ext_linescroll(0), m_uses_tile_banks(0), m_cur_tile_bank(0), - m_k055555(nullptr) + m_k055555(*this, finder_base::DUMMY_TAG) { } @@ -344,9 +341,6 @@ void k056832_device::device_start() memset(m_regs, 0x00, sizeof(m_regs) ); memset(m_regsb, 0x00, sizeof(m_regsb) ); - if (m_k055555_tag) - m_k055555 = machine().device(m_k055555_tag); - /* TODO: understand which elements MUST be init here (to keep correct layer associations) and which ones can can be init at RESET, if any */ diff --git a/src/mame/video/k054156_k054157_k056832.h b/src/mame/video/k054156_k054157_k056832.h index d091e4f0c46..8f121a9c5e9 100644 --- a/src/mame/video/k054156_k054157_k056832.h +++ b/src/mame/video/k054156_k054157_k056832.h @@ -5,6 +5,7 @@ #pragma once +#include "video/k055555.h" // still needs k055555_get_palette_index typedef device_delegate k056832_cb_delegate; #define K056832_CB_MEMBER(_name) void _name(int layer, int *code, int *color, int *flags) @@ -12,8 +13,8 @@ typedef device_delegate k05 #define MCFG_K056832_CB(_class, _method) \ downcast(*device).set_k056832_callback(k056832_cb_delegate(&_class::_method, #_class "::" #_method, this)); -#define MCFG_K056832_CONFIG(_gfx_reg, _bpp, _big, _djmain_hack, _k055555) \ - downcast(*device).set_config(_gfx_reg, _bpp, _big, _djmain_hack, _k055555); +#define MCFG_K056832_CONFIG(_gfx_reg, _bpp, _big, _djmain_hack) \ + downcast(*device).set_config(_gfx_reg, _bpp, _big, _djmain_hack); #define K056832_PAGE_COUNT 16 @@ -37,16 +38,21 @@ class k055555_device; class k056832_device : public device_t, public device_gfx_interface { public: + template k056832_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&mixer_tag) + : k056832_device(mconfig, tag, owner, clock) + { + m_k055555.set_tag(std::forward(mixer_tag)); + } + k056832_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); void set_k056832_callback(k056832_cb_delegate callback) { m_k056832_cb = callback; } - void set_config(const char *gfx_reg, int bpp, int big, int djmain_hack, const char *k055555) + void set_config(const char *gfx_reg, int bpp, int big, int djmain_hack) { m_rombase.set_tag(gfx_reg); m_bpp = bpp; m_big = big; m_djmain_hack = djmain_hack; - m_k055555_tag = k055555; } void SetExtLinescroll(); /* Lethal Enforcers */ @@ -135,9 +141,6 @@ private: int m_big; int m_djmain_hack; - const char *m_k055555_tag; // tbyahhoo uses the k056832 together with a k055555 - - // ROM readback involves reading 2 halves of a word // from the same location in a row. Reading the // RAM window resets this state so you get the first half. @@ -167,10 +170,7 @@ private: int m_use_ext_linescroll; int m_uses_tile_banks, m_cur_tile_bank; - - - - k055555_device *m_k055555; /* used to choose colorbase */ + optional_device m_k055555; /* used to choose colorbase */ void get_tile_info( tile_data &tileinfo, int tile_index, int pageIndex ); diff --git a/src/mame/video/k054338.cpp b/src/mame/video/k054338.cpp index a8d97bcda4d..a906ae31115 100644 --- a/src/mame/video/k054338.cpp +++ b/src/mame/video/k054338.cpp @@ -24,7 +24,7 @@ k054338_device::k054338_device(const machine_config &mconfig, const char *tag, d : device_t(mconfig, K054338, tag, owner, clock), device_video_interface(mconfig, *this), m_alpha_inv(0), - m_k055555_tag(nullptr) + m_k055555(*this, finder_base::DUMMY_TAG) { memset(&m_regs, 0, sizeof(m_regs)); memset(&m_shd_rgb, 0, sizeof(m_shd_rgb)); @@ -36,8 +36,6 @@ k054338_device::k054338_device(const machine_config &mconfig, const char *tag, d void k054338_device::device_start() { - m_k055555 = m_k055555_tag ? machine().device(m_k055555_tag) : nullptr; - save_item(NAME(m_regs)); save_item(NAME(m_shd_rgb)); } diff --git a/src/mame/video/k054338.h b/src/mame/video/k054338.h index a8b9bcb2b8d..0b56bf8e650 100644 --- a/src/mame/video/k054338.h +++ b/src/mame/video/k054338.h @@ -26,10 +26,15 @@ class k054338_device : public device_t, public device_video_interface { public: + template k054338_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&mixer_tag) + : k054338_device(mconfig, tag, owner, clock) + { + m_k055555.set_tag(std::forward(mixer_tag)); + } + k054338_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration - void set_mixer_tag(const char *tag) { m_k055555_tag = tag; } void set_alpha_invert(int alpha_inv) { m_alpha_inv = alpha_inv; } DECLARE_WRITE16_MEMBER( word_w ); // "CLCT" registers @@ -55,20 +60,13 @@ private: uint16_t m_regs[32]; int m_shd_rgb[9]; int m_alpha_inv; - const char *m_k055555_tag; - k055555_device *m_k055555; /* used to fill BG color */ + optional_device m_k055555; /* used to fill BG color */ }; DECLARE_DEVICE_TYPE(K054338, k054338_device) - -#define MCFG_K054338_MIXER(_tag) \ - downcast(*device).set_mixer_tag(_tag); - #define MCFG_K054338_ALPHAINV(_alphainv) \ downcast(*device).set_alpha_invert(_alphainv); -#define MCFG_K054338_SET_SCREEN MCFG_VIDEO_SET_SCREEN - #endif // MAME_VIDEO_K054338_H diff --git a/src/mame/video/konamigx.cpp b/src/mame/video/konamigx.cpp index 205a0c1da87..07e984a3349 100644 --- a/src/mame/video/konamigx.cpp +++ b/src/mame/video/konamigx.cpp @@ -735,7 +735,7 @@ void konamigx_state::gx_draw_basic_extended_tilemaps_1(screen_device &screen, bi } else { - machine().device("k053250_1")->draw(bitmap, cliprect, m_vcblk[4]<draw(bitmap, cliprect, m_vcblk[4]<("k053250_2")->draw(bitmap, cliprect, m_vcblk[5]<draw(bitmap, cliprect, m_vcblk[5]<(0x80000/2); m_pen_map = std::make_unique(65536); - machine().device("nvram")->set_base(m_cmos_ram.get(), 0x2000 * 4); + m_nvram->set_base(m_cmos_ram.get(), 0x2000 * 4); m_dma_timer = timer_alloc(TIMER_DMA); m_autoerase_line_timer = timer_alloc(TIMER_AUTOERASE_LINE); diff --git a/src/mame/video/model2.cpp b/src/mame/video/model2.cpp index 6e035383d41..a43bffda5fe 100644 --- a/src/mame/video/model2.cpp +++ b/src/mame/video/model2.cpp @@ -87,8 +87,8 @@ to display more detail when a texture is real close to the viewer. This is currently unemulated. *********************************************************************************************************************************/ + #include "emu.h" -#include "video/segaic24.h" #include "includes/model2.h" #include @@ -2651,15 +2651,11 @@ void model2_state::video_start() uint32_t model2_state::screen_update_model2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { //logerror("--- frame ---\n"); - int layer; - bitmap.fill(m_palette->pen(0), cliprect); m_sys24_bitmap.fill(0, cliprect); - segas24_tile_device *tile = machine().device("tile"); - - for(layer=3;layer>=0;layer--) - tile->draw(screen, m_sys24_bitmap, cliprect, layer<<1, 0, 0); + for(int layer = 3; layer >= 0; layer--) + m_tiles->draw(screen, m_sys24_bitmap, cliprect, layer<<1, 0, 0); copybitmap_trans(bitmap, m_sys24_bitmap, 0, 0, 0, 0, cliprect, 0); @@ -2680,8 +2676,8 @@ uint32_t model2_state::screen_update_model2(screen_device &screen, bitmap_rgb32 m_sys24_bitmap.fill(0, cliprect); - for(layer=3;layer>=0;layer--) - tile->draw(screen, m_sys24_bitmap, cliprect, (layer<<1) | 1, 0, 0); + for (int layer = 3; layer >= 0; layer--) + m_tiles->draw(screen, m_sys24_bitmap, cliprect, (layer<<1) | 1, 0, 0); copybitmap_trans(bitmap, m_sys24_bitmap, 0, 0, 0, 0, cliprect, 0); -- cgit v1.2.3