From 4987adf1ae678678a245415ce3a49e2938993420 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Thu, 26 Jun 2014 07:22:24 +0000 Subject: [PATCH] k056832: updated to use delegates and inline configs. nw. these changes are mostly driver-level, so I think they should not conflict with anyone else's work. the only relevant change for the device code is the removal of altK056832_vh_start. no further work on this chip is planned (it requires major rework) --- src/mame/drivers/asterix.c | 17 ++---- src/mame/drivers/bishi.c | 14 ++--- src/mame/drivers/dbz.c | 13 +---- src/mame/drivers/djmain.c | 14 ++--- src/mame/drivers/gijoe.c | 14 ++--- src/mame/drivers/konamigx.c | 52 ++++++++++++++--- src/mame/drivers/lethal.c | 13 +---- src/mame/drivers/moo.c | 18 +++--- src/mame/drivers/mystwarr.c | 23 +++++++- src/mame/drivers/qdrmfgp.c | 26 +++------ src/mame/drivers/tasman.c | 16 ++---- src/mame/drivers/xexex.c | 14 ++--- src/mame/drivers/zr107.c | 15 ++--- src/mame/includes/asterix.h | 5 +- src/mame/includes/bishi.h | 4 +- src/mame/includes/dbz.h | 2 +- src/mame/includes/djmain.h | 4 +- src/mame/includes/gijoe.h | 4 +- src/mame/includes/konamigx.h | 2 + src/mame/includes/lethal.h | 4 +- src/mame/includes/moo.h | 2 +- src/mame/includes/mystwarr.h | 3 + src/mame/includes/qdrmfgp.h | 6 +- src/mame/includes/xexex.h | 2 +- src/mame/video/asterix.c | 8 +-- src/mame/video/bishi.c | 8 +-- src/mame/video/dbz.c | 5 +- src/mame/video/djmain.c | 2 +- src/mame/video/gijoe.c | 17 +++--- src/mame/video/k054156_k054157_k056832.c | 71 +++++------------------- src/mame/video/k054156_k054157_k056832.h | 65 +++++++++++----------- src/mame/video/konamigx.c | 30 +--------- src/mame/video/lethal.c | 5 +- src/mame/video/moo.c | 5 +- src/mame/video/mystwarr.c | 30 +++------- src/mame/video/qdrmfgp.c | 8 +-- src/mame/video/xexex.c | 5 +- 37 files changed, 218 insertions(+), 328 deletions(-) diff --git a/src/mame/drivers/asterix.c b/src/mame/drivers/asterix.c index beed9e607b5..ffa97ace3b6 100644 --- a/src/mame/drivers/asterix.c +++ b/src/mame/drivers/asterix.c @@ -215,14 +215,6 @@ static INPUT_PORTS_START( asterix ) INPUT_PORTS_END -static const k056832_interface asterix_k056832_intf = -{ - "gfx1", 0, - K056832_BPP_4, - 1, 1, - asterix_tile_callback, "none" -}; - void asterix_state::machine_start() { save_item(NAME(m_cur_control2)); @@ -238,8 +230,6 @@ void asterix_state::machine_start() void asterix_state::machine_reset() { - int i; - m_cur_control2 = 0; m_prot[0] = 0; m_prot[1] = 0; @@ -250,7 +240,7 @@ void asterix_state::machine_reset() m_layerpri[1] = 0; m_layerpri[2] = 0; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { m_layer_colorbase[i] = 0; m_tilebanks[i] = 0; @@ -284,7 +274,10 @@ static MACHINE_CONFIG_START( asterix, asterix_state ) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_K056832_ADD("k056832", asterix_k056832_intf) + + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(asterix_state, tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 1, 1, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") diff --git a/src/mame/drivers/bishi.c b/src/mame/drivers/bishi.c index 5994beb63ee..cd1966ded6c 100644 --- a/src/mame/drivers/bishi.c +++ b/src/mame/drivers/bishi.c @@ -363,14 +363,6 @@ WRITE_LINE_MEMBER(bishi_state::sound_irq_gen) } -static const k056832_interface bishi_k056832_intf = -{ - "gfx1", 0, - K056832_BPP_8, - 1, 0, - bishi_tile_callback, "none" -}; - void bishi_state::machine_start() { save_item(NAME(m_cur_control)); @@ -390,7 +382,6 @@ static MACHINE_CONFIG_START( bishi, bishi_state ) MCFG_CPU_PROGRAM_MAP(main_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", bishi_state, bishi_scanline, "screen", 0, 1) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) @@ -406,7 +397,10 @@ static MACHINE_CONFIG_START( bishi, bishi_state ) MCFG_PALETTE_ENABLE_HILIGHTS() MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_K056832_ADD("k056832", bishi_k056832_intf) + + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(bishi_state, tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8, 1, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") diff --git a/src/mame/drivers/dbz.c b/src/mame/drivers/dbz.c index 85dc3d696f8..27d55e4e238 100644 --- a/src/mame/drivers/dbz.c +++ b/src/mame/drivers/dbz.c @@ -289,14 +289,6 @@ GFXDECODE_END /**********************************************************************************/ -static const k056832_interface dbz_k056832_intf = -{ - "gfx1", 2, - K056832_BPP_4, - 1, 1, - dbz_tile_callback, "none" -}; - static const k053247_interface dbz_k053246_intf = { "gfx2", 3, @@ -343,7 +335,6 @@ static MACHINE_CONFIG_START( dbz, dbz_state ) MCFG_CPU_PROGRAM_MAP(dbz_sound_map) MCFG_CPU_IO_MAP(dbz_sound_io_map) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(55) @@ -359,7 +350,9 @@ static MACHINE_CONFIG_START( dbz, dbz_state ) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MCFG_PALETTE_ENABLE_SHADOWS() - MCFG_K056832_ADD("k056832", dbz_k056832_intf) + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(dbz_state, tile_callback) + MCFG_K056832_CONFIG("gfx1", 2, K056832_BPP_4, 1, 1, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") diff --git a/src/mame/drivers/djmain.c b/src/mame/drivers/djmain.c index 411be8e4cb1..5bcec67bb33 100644 --- a/src/mame/drivers/djmain.c +++ b/src/mame/drivers/djmain.c @@ -1390,14 +1390,6 @@ void djmain_state::machine_reset() * *************************************/ -static const k056832_interface djmain_k056832_intf = -{ - "gfx2", 1, - K056832_BPP_4dj, - 1, 1, - djmain_tile_callback, "none" -}; - static MACHINE_CONFIG_START( djmain, djmain_state ) /* basic machine hardware */ @@ -1407,7 +1399,6 @@ static MACHINE_CONFIG_START( djmain, djmain_state ) MCFG_CPU_PROGRAM_MAP(memory_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", djmain_state, vb_interrupt) - MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, true) MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(djmain_state, ide_interrupt)) @@ -1422,9 +1413,12 @@ static MACHINE_CONFIG_START( djmain, djmain_state ) MCFG_PALETTE_ADD("palette", 0x4440/4) MCFG_GFXDECODE_ADD("gfxdecode", "palette", djmain) - MCFG_K056832_ADD("k056832", djmain_k056832_intf) + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(djmain_state, tile_callback) + MCFG_K056832_CONFIG("gfx2", 1, K056832_BPP_4dj, 1, 1, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") + MCFG_K055555_ADD("k055555") /* sound hardware */ diff --git a/src/mame/drivers/gijoe.c b/src/mame/drivers/gijoe.c index f29501a7217..a9590f2e7ce 100644 --- a/src/mame/drivers/gijoe.c +++ b/src/mame/drivers/gijoe.c @@ -295,14 +295,6 @@ static const k054539_interface k054539_config = NULL, }; -static const k056832_interface gijoe_k056832_intf = -{ - "gfx1", 0, - K056832_BPP_4, - 1, 0, - gijoe_tile_callback, "none" -}; - static const k053247_interface gijoe_k053247_intf = { "gfx2", 1, @@ -350,9 +342,13 @@ static MACHINE_CONFIG_START( gijoe, gijoe_state ) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_K056832_ADD("k056832", gijoe_k056832_intf) + + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(gijoe_state, tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 1, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") + MCFG_K053246_ADD("k053246", gijoe_k053247_intf) MCFG_K053246_GFXDECODE("gfxdecode") MCFG_K053246_PALETTE("palette") diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c index 7a7b89119ed..ca6965ada20 100644 --- a/src/mame/drivers/konamigx.c +++ b/src/mame/drivers/konamigx.c @@ -1633,9 +1633,13 @@ static MACHINE_CONFIG_START( konamigx, konamigx_state ) MCFG_PALETTE_ENABLE_HILIGHTS() MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_K056832_ADD_NOINTF("k056832"/*, konamigx_k056832_intf*/) + + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(konamigx_state, type2_tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_5, 0, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") + MCFG_K055555_ADD("k055555") MCFG_DEVICE_ADD("k054338", K054338, 0) @@ -1674,22 +1678,44 @@ static MACHINE_CONFIG_START( konamigx, konamigx_state ) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( sexyparo, konamigx ) + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CB(konamigx_state, alpha_tile_callback) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( tbyahhoo, konamigx ) + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_5, 0, 0, "k055555") +MACHINE_CONFIG_END + static MACHINE_CONFIG_DERIVED( dragoonj, konamigx ) MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_VISIBLE_AREA(40, 40+384-1, 16, 16+224-1) MCFG_VIDEO_START_OVERRIDE(konamigx_state,dragoonj) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_5, 1, 0, "none") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( le2, konamigx ) MCFG_VIDEO_START_OVERRIDE(konamigx_state,le2) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8, 1, 0, "none") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( konamigx_6bpp, konamigx ) MCFG_VIDEO_START_OVERRIDE(konamigx_state,konamigx_6bpp) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_6, 0, 0, "none") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( konamigx_6bpp_2, konamigx ) MCFG_VIDEO_START_OVERRIDE(konamigx_state,konamigx_6bpp_2) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_6, 1, 0, "none") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( opengolf, konamigx ) @@ -1713,6 +1739,9 @@ static MACHINE_CONFIG_DERIVED( racinfrc, konamigx ) MCFG_GFXDECODE_MODIFY("gfxdecode", racinfrc) MCFG_VIDEO_START_OVERRIDE(konamigx_state,racinfrc) + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_6, 0, 0, "none") + MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(gx_type1_map) @@ -1730,6 +1759,8 @@ static MACHINE_CONFIG_DERIVED( gxtype3, konamigx ) MCFG_VIDEO_START_OVERRIDE(konamigx_state,konamigx_type3) + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_6, 0, 0, "none") MCFG_PALETTE_MODIFY("palette") MCFG_PALETTE_ENTRIES(16384) @@ -1780,10 +1811,12 @@ static MACHINE_CONFIG_DERIVED( gxtype4, konamigx ) MCFG_GFXDECODE_MODIFY("gfxdecode", type4) MCFG_VIDEO_START_OVERRIDE(konamigx_state,konamigx_type4) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8, 0, 0, "none") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( gxtype4_vsn, gxtype4 ) - MCFG_DEFAULT_LAYOUT(layout_dualhsxs) MCFG_SCREEN_MODIFY("screen") @@ -1795,20 +1828,25 @@ static MACHINE_CONFIG_DERIVED( gxtype4_vsn, gxtype4 ) MCFG_SCREEN_VISIBLE_AREA(0, 576-1, 16, 32*8-1-16) MCFG_VIDEO_START_OVERRIDE(konamigx_state,konamigx_type4_vsn) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8, 0, 2, "none") // set djmain_hack to 2 to kill layer association or half the tilemaps vanish on screen 0 MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( gxtype4sd2, gxtype4 ) - MCFG_VIDEO_START_OVERRIDE(konamigx_state,konamigx_type4_sd2) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( winspike, konamigx ) - MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_VISIBLE_AREA(38, 38+384-1, 16, 16+224-1) MCFG_VIDEO_START_OVERRIDE(konamigx_state,winspike) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CB(konamigx_state, alpha_tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8, 0, 2, "none") MACHINE_CONFIG_END @@ -3770,15 +3808,15 @@ GAME( 1994, gokuparo, fantjour, konamigx, gokuparo, konamigx_state, konamigx, RO GAME( 1994, crzcross, konamigx, konamigx, puzldama, konamigx_state, konamigx, ROT0, "Konami", "Crazy Cross (ver EAA)", GAME_IMPERFECT_GRAPHICS ) GAME( 1994, puzldama, crzcross, konamigx, puzldama, konamigx_state, konamigx, ROT0, "Konami", "Taisen Puzzle-dama (ver JAA)", GAME_IMPERFECT_GRAPHICS ) -GAME( 1995, tbyahhoo, konamigx, konamigx, gokuparo, konamigx_state, konamigx, ROT0, "Konami", "Twin Bee Yahhoo! (ver JAA)", GAME_IMPERFECT_GRAPHICS ) +GAME( 1995, tbyahhoo, konamigx, tbyahhoo, gokuparo, konamigx_state, konamigx, ROT0, "Konami", "Twin Bee Yahhoo! (ver JAA)", GAME_IMPERFECT_GRAPHICS ) GAME( 1995, tkmmpzdm, konamigx, konamigx_6bpp, puzldama, konamigx_state, konamigx, ROT0, "Konami", "Tokimeki Memorial Taisen Puzzle-dama (ver JAB)", GAME_IMPERFECT_GRAPHICS ) GAME( 1995, dragoona, konamigx, dragoonj, dragoonj, konamigx_state, konamigx, ROT0, "Konami", "Dragoon Might (ver AAB)", GAME_IMPERFECT_GRAPHICS ) GAME( 1995, dragoonj, dragoona, dragoonj, dragoonj, konamigx_state, konamigx, ROT0, "Konami", "Dragoon Might (ver JAA)", GAME_IMPERFECT_GRAPHICS ) -GAME( 1996, sexyparo, konamigx, konamigx, gokuparo, konamigx_state, konamigx, ROT0, "Konami", "Sexy Parodius (ver JAA)", GAME_IMPERFECT_GRAPHICS ) -GAME( 1996, sexyparoa,sexyparo, konamigx, gokuparo, konamigx_state, konamigx, ROT0, "Konami", "Sexy Parodius (ver AAA)", GAME_IMPERFECT_GRAPHICS ) +GAME( 1996, sexyparo, konamigx, sexyparo, gokuparo, konamigx_state, konamigx, ROT0, "Konami", "Sexy Parodius (ver JAA)", GAME_IMPERFECT_GRAPHICS ) +GAME( 1996, sexyparoa,sexyparo, sexyparo, gokuparo, konamigx_state, konamigx, ROT0, "Konami", "Sexy Parodius (ver AAA)", GAME_IMPERFECT_GRAPHICS ) GAME( 1996, daiskiss, konamigx, konamigx, gokuparo, konamigx_state, konamigx, ROT0, "Konami", "Daisu-Kiss (ver JAA)", GAME_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/lethal.c b/src/mame/drivers/lethal.c index af22b219b59..5a1540aa1aa 100644 --- a/src/mame/drivers/lethal.c +++ b/src/mame/drivers/lethal.c @@ -491,15 +491,6 @@ void lethal_state::machine_reset() m_bank4800->set_bank(0); } -static const k056832_interface lethalen_k056832_intf = -{ - "gfx1", 0, - K056832_BPP_8LE, - 1, 0, - lethalen_tile_callback, "none" -}; - - static MACHINE_CONFIG_START( lethalen, lethal_state ) /* basic machine hardware */ @@ -534,7 +525,9 @@ static MACHINE_CONFIG_START( lethalen, lethal_state ) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_K056832_ADD("k056832", lethalen_k056832_intf) + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(lethal_state, tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8LE, 1, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") diff --git a/src/mame/drivers/moo.c b/src/mame/drivers/moo.c index 6274090075d..f46d4371926 100644 --- a/src/mame/drivers/moo.c +++ b/src/mame/drivers/moo.c @@ -514,14 +514,6 @@ MACHINE_RESET_MEMBER(moo_state,moo) m_sprite_colorbase = 0; } -static const k056832_interface moo_k056832_intf = -{ - "gfx1", 0, - K056832_BPP_4, - 1, 0, - moo_tile_callback, "none" -}; - static const k053247_interface moo_k053247_intf = { "gfx2", 1, @@ -578,7 +570,10 @@ static MACHINE_CONFIG_START( moo, moo_state ) MCFG_K053246_ADD("k053246", moo_k053247_intf) MCFG_K053246_GFXDECODE("gfxdecode") MCFG_K053246_PALETTE("palette") - MCFG_K056832_ADD("k056832", moo_k056832_intf) + + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(moo_state, tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 1, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") @@ -630,7 +625,10 @@ static MACHINE_CONFIG_START( moobl, moo_state ) MCFG_K053246_ADD("k053246", moo_k053247_intf) MCFG_K053246_GFXDECODE("gfxdecode") MCFG_K053246_PALETTE("palette") - MCFG_K056832_ADD("k056832", moo_k056832_intf) + + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(moo_state, tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 1, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") diff --git a/src/mame/drivers/mystwarr.c b/src/mame/drivers/mystwarr.c index b4f771742fa..36a2fcedacd 100644 --- a/src/mame/drivers/mystwarr.c +++ b/src/mame/drivers/mystwarr.c @@ -1006,12 +1006,16 @@ static MACHINE_CONFIG_START( mystwarr, mystwarr_state ) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_PALETTE_ENABLE_HILIGHTS() - MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_K056832_ADD_NOINTF("k056832"/*, mystwarr_k056832_intf*/) + + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(mystwarr_state, mystwarr_tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_5, 0, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") + MCFG_K055555_ADD("k055555") + MCFG_K055673_ADD_NOINTF("k055673") MCFG_K055673_GFXDECODE("gfxdecode") MCFG_K055673_PALETTE("palette") @@ -1057,6 +1061,9 @@ static MACHINE_CONFIG_DERIVED( viostorm, mystwarr ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(900)) MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(40, 40+384-1, 16, 16+224-1) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CB(mystwarr_state, game4bpp_tile_callback) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( metamrph, mystwarr ) @@ -1083,6 +1090,9 @@ static MACHINE_CONFIG_DERIVED( metamrph, mystwarr ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(900)) MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(24, 24+288-1, 15, 15+224-1) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CB(mystwarr_state, game4bpp_tile_callback) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( dadandrn, mystwarr ) @@ -1109,6 +1119,9 @@ static MACHINE_CONFIG_DERIVED( dadandrn, mystwarr ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(600)) MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(24, 24+288-1, 17, 17+224-1) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CB(mystwarr_state, game5bpp_tile_callback) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( gaiapols, mystwarr ) @@ -1138,6 +1151,9 @@ static MACHINE_CONFIG_DERIVED( gaiapols, mystwarr ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(600)) MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(40, 40+376-1, 16, 16+224-1) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CB(mystwarr_state, game4bpp_tile_callback) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( martchmp, mystwarr ) @@ -1166,6 +1182,9 @@ static MACHINE_CONFIG_DERIVED( martchmp, mystwarr ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(32, 32+384-1, 16, 16+224-1) + + MCFG_DEVICE_MODIFY("k056832") + MCFG_K056832_CB(mystwarr_state, game5bpp_tile_callback) MACHINE_CONFIG_END /**********************************************************************************/ diff --git a/src/mame/drivers/qdrmfgp.c b/src/mame/drivers/qdrmfgp.c index 1cf3c8f3850..3388c2ca4e8 100644 --- a/src/mame/drivers/qdrmfgp.c +++ b/src/mame/drivers/qdrmfgp.c @@ -547,22 +547,6 @@ static const k054539_interface k054539_config = * *************************************/ -static const k056832_interface qdrmfgp_k056832_intf = -{ - "gfx1", 0, - K056832_BPP_4dj, - 1, 0, - qdrmfgp_tile_callback, "none" -}; - -static const k056832_interface qdrmfgp2_k056832_intf = -{ - "gfx1", 0, - K056832_BPP_4dj, - 1, 0, - qdrmfgp2_tile_callback, "none" -}; - MACHINE_START_MEMBER(qdrmfgp_state,qdrmfgp) { save_item(NAME(m_control)); @@ -620,7 +604,10 @@ static MACHINE_CONFIG_START( qdrmfgp, qdrmfgp_state ) MCFG_VIDEO_START_OVERRIDE(qdrmfgp_state,qdrmfgp) MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_K056832_ADD("k056832", qdrmfgp_k056832_intf) + + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(qdrmfgp_state, qdrmfgp_tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4dj, 1, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") @@ -664,7 +651,10 @@ static MACHINE_CONFIG_START( qdrmfgp2, qdrmfgp_state ) MCFG_VIDEO_START_OVERRIDE(qdrmfgp_state,qdrmfgp2) MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_K056832_ADD("k056832", qdrmfgp2_k056832_intf) + + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(qdrmfgp_state, qdrmfgp2_tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4dj, 1, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") diff --git a/src/mame/drivers/tasman.c b/src/mame/drivers/tasman.c index e50e76eec5f..723683f7805 100644 --- a/src/mame/drivers/tasman.c +++ b/src/mame/drivers/tasman.c @@ -40,6 +40,7 @@ public: DECLARE_VIDEO_START(kongambl); UINT32 screen_update_kongambl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(kongambl_vblank); + K056832_CB_MEMBER(tile_callback); }; @@ -538,7 +539,7 @@ static void kongambl_sprite_callback( running_machine &machine, int *code, int * } -static void kongambl_tile_callback( running_machine &machine, int layer, int *code, int *color, int *flags ) +K056832_CB_MEMBER(kongambl_state::tile_callback) { } @@ -560,15 +561,6 @@ static GFXDECODE_START( tasman ) GFXDECODE_END -static const k056832_interface k056832_intf = -{ - "gfx1", 0, - K056832_BPP_8TASMAN, - 0, 0, - kongambl_tile_callback, "none" -}; - - static const k053247_interface k053247_intf = { "gfx2", 1, @@ -621,7 +613,9 @@ static MACHINE_CONFIG_START( kongambl, kongambl_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", tasman) - MCFG_K056832_ADD("k056832", k056832_intf) + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(kongambl_state, tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_8TASMAN, 0, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") diff --git a/src/mame/drivers/xexex.c b/src/mame/drivers/xexex.c index 077e8a915f6..cc9c6742a15 100644 --- a/src/mame/drivers/xexex.c +++ b/src/mame/drivers/xexex.c @@ -454,14 +454,6 @@ static const k054539_interface k054539_config = ym_set_mixing }; -static const k056832_interface xexex_k056832_intf = -{ - "gfx1", 0, - K056832_BPP_4, - 1, 0, - xexex_tile_callback, "none" -}; - static const k053247_interface xexex_k053246_intf = { "gfx2", 1, @@ -543,9 +535,13 @@ static MACHINE_CONFIG_START( xexex, xexex_state ) MCFG_PALETTE_ENABLE_HILIGHTS() MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_K056832_ADD("k056832", xexex_k056832_intf) + + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(xexex_state, tile_callback) + MCFG_K056832_CONFIG("gfx1", 0, K056832_BPP_4, 1, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") + MCFG_K053246_ADD("k053246", xexex_k053246_intf) MCFG_K053246_GFXDECODE("gfxdecode") MCFG_K053246_PALETTE("palette") diff --git a/src/mame/drivers/zr107.c b/src/mame/drivers/zr107.c index 32c7f1db36e..979f1c7ee99 100644 --- a/src/mame/drivers/zr107.c +++ b/src/mame/drivers/zr107.c @@ -253,6 +253,7 @@ public: INTERRUPT_GEN_MEMBER(zr107_vblank); WRITE_LINE_MEMBER(k054539_irq_gen); ADC083X_INPUT_CB(adc0838_callback); + K056832_CB_MEMBER(tile_callback); protected: virtual void machine_start(); @@ -298,7 +299,7 @@ WRITE32_MEMBER(zr107_state::paletteram32_w) #define NUM_LAYERS 2 -static void game_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags) +K056832_CB_MEMBER(zr107_state::tile_callback) { *color += layer * 0x40; } @@ -737,14 +738,6 @@ WRITE_LINE_MEMBER(zr107_state::k054539_irq_gen) } -static const k056832_interface zr107_k056832_intf = -{ - "gfx2", 1, - K056832_BPP_8, - 1, 0, - game_tile_callback, "none" -}; - /* PowerPC interrupts IRQ0: Vblank @@ -796,7 +789,9 @@ static MACHINE_CONFIG_START( zr107, zr107_state ) MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_K056832_ADD("k056832", zr107_k056832_intf) + MCFG_DEVICE_ADD("k056832", K056832, 0) + MCFG_K056832_CB(zr107_state, tile_callback) + MCFG_K056832_CONFIG("gfx2", 1, K056832_BPP_8, 1, 0, "none") MCFG_K056832_GFXDECODE("gfxdecode") MCFG_K056832_PALETTE("palette") diff --git a/src/mame/includes/asterix.h b/src/mame/includes/asterix.h index 247bf6395fe..6efc33d2d07 100644 --- a/src/mame/includes/asterix.h +++ b/src/mame/includes/asterix.h @@ -61,11 +61,8 @@ public: UINT32 screen_update_asterix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(asterix_interrupt); K05324X_CB_MEMBER(sprite_callback); + K056832_CB_MEMBER(tile_callback); protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; - -/*----------- defined in video/asterix.c -----------*/ - -extern void asterix_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags); diff --git a/src/mame/includes/bishi.h b/src/mame/includes/bishi.h index 25b6e5590c2..fe82364f784 100644 --- a/src/mame/includes/bishi.h +++ b/src/mame/includes/bishi.h @@ -56,7 +56,5 @@ public: UINT32 screen_update_bishi(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(bishi_scanline); DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); + K056832_CB_MEMBER(tile_callback); }; - -/*----------- defined in video/bishi.c -----------*/ -extern void bishi_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags); diff --git a/src/mame/includes/dbz.h b/src/mame/includes/dbz.h index 224afca1f8c..b6424164cdb 100644 --- a/src/mame/includes/dbz.h +++ b/src/mame/includes/dbz.h @@ -71,8 +71,8 @@ public: virtual void video_start(); UINT32 screen_update_dbz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(dbz_scanline); + K056832_CB_MEMBER(tile_callback); }; /*----------- defined in video/dbz.c -----------*/ extern void dbz_sprite_callback(running_machine &machine, int *code, int *color, int *priority_mask); -extern void dbz_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags); diff --git a/src/mame/includes/djmain.h b/src/mame/includes/djmain.h index d657ebd3846..39505d91f0d 100644 --- a/src/mame/includes/djmain.h +++ b/src/mame/includes/djmain.h @@ -75,7 +75,5 @@ public: required_device m_gfxdecode; required_device m_palette; required_shared_ptr m_generic_paletteram_32; + K056832_CB_MEMBER(tile_callback); }; - -/*----------- defined in video/djmain.c -----------*/ -void djmain_tile_callback(running_machine& machine, int layer, int *code, int *color, int *flags); diff --git a/src/mame/includes/gijoe.h b/src/mame/includes/gijoe.h index 6dc63a4c416..c900faa1f15 100644 --- a/src/mame/includes/gijoe.h +++ b/src/mame/includes/gijoe.h @@ -60,9 +60,9 @@ public: UINT32 screen_update_gijoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(gijoe_interrupt); TIMER_CALLBACK_MEMBER(dmaend_callback); - void gijoe_objdma( ); + void gijoe_objdma(); + K056832_CB_MEMBER(tile_callback); }; /*----------- defined in video/gijoe.c -----------*/ extern void gijoe_sprite_callback(running_machine &machine, int *code, int *color, int *priority_mask); -extern void gijoe_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags); diff --git a/src/mame/includes/konamigx.h b/src/mame/includes/konamigx.h index 3b0097e363f..14b131a558b 100644 --- a/src/mame/includes/konamigx.h +++ b/src/mame/includes/konamigx.h @@ -133,6 +133,8 @@ public: TIMER_CALLBACK_MEMBER(boothack_callback); TIMER_DEVICE_CALLBACK_MEMBER(konamigx_hbinterrupt); ADC083X_INPUT_CB(adc0834_callback); + K056832_CB_MEMBER(type2_tile_callback); + K056832_CB_MEMBER(alpha_tile_callback); void _gxcommoninitnosprites(running_machine &machine); void _gxcommoninit(running_machine &machine); diff --git a/src/mame/includes/lethal.h b/src/mame/includes/lethal.h index 77b473ca86c..e041fe8f365 100644 --- a/src/mame/includes/lethal.h +++ b/src/mame/includes/lethal.h @@ -53,7 +53,5 @@ public: UINT32 screen_update_lethalen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(lethalen_interrupt); K05324X_CB_MEMBER(sprite_callback); + K056832_CB_MEMBER(tile_callback); }; - -/*----------- defined in video/lethal.c -----------*/ -extern void lethalen_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags); diff --git a/src/mame/includes/moo.h b/src/mame/includes/moo.h index a421a055781..407c0216252 100644 --- a/src/mame/includes/moo.h +++ b/src/mame/includes/moo.h @@ -82,8 +82,8 @@ public: INTERRUPT_GEN_MEMBER(moobl_interrupt); TIMER_CALLBACK_MEMBER(dmaend_callback); void moo_objdma(); + K056832_CB_MEMBER(tile_callback); }; /*----------- defined in video/moo.c -----------*/ -extern void moo_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags); extern void moo_sprite_callback(running_machine &machine, int *code, int *color, int *priority_mask); diff --git a/src/mame/includes/mystwarr.h b/src/mame/includes/mystwarr.h index 86e44162e76..383b555d623 100644 --- a/src/mame/includes/mystwarr.h +++ b/src/mame/includes/mystwarr.h @@ -93,4 +93,7 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(metamrph_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(mchamp_interrupt); void reset_sound_region(); + K056832_CB_MEMBER(mystwarr_tile_callback); + K056832_CB_MEMBER(game5bpp_tile_callback); + K056832_CB_MEMBER(game4bpp_tile_callback); }; diff --git a/src/mame/includes/qdrmfgp.h b/src/mame/includes/qdrmfgp.h index 2863c5eacc2..b088bfe25d4 100644 --- a/src/mame/includes/qdrmfgp.h +++ b/src/mame/includes/qdrmfgp.h @@ -64,8 +64,6 @@ public: DECLARE_WRITE_LINE_MEMBER(ide_interrupt); DECLARE_WRITE_LINE_MEMBER(gp2_ide_interrupt); DECLARE_WRITE_LINE_MEMBER(k054539_irq1_gen); + K056832_CB_MEMBER(qdrmfgp_tile_callback); + K056832_CB_MEMBER(qdrmfgp2_tile_callback); }; - -/*----------- defined in video/qdrmfgp.c -----------*/ -void qdrmfgp_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags); -void qdrmfgp2_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags); diff --git a/src/mame/includes/xexex.h b/src/mame/includes/xexex.h index 4b96cf49569..d0d6b15cb05 100644 --- a/src/mame/includes/xexex.h +++ b/src/mame/includes/xexex.h @@ -94,9 +94,9 @@ public: void xexex_postload(); void xexex_objdma( int limiter ); void parse_control2( ); + K056832_CB_MEMBER(tile_callback); }; /*----------- defined in video/xexex.c -----------*/ extern void xexex_sprite_callback(running_machine &machine, int *code, int *color, int *priority_mask); -extern void xexex_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags); diff --git a/src/mame/video/asterix.c b/src/mame/video/asterix.c index f297f4e208d..d1b7ce85d3f 100644 --- a/src/mame/video/asterix.c +++ b/src/mame/video/asterix.c @@ -34,13 +34,11 @@ K05324X_CB_MEMBER(asterix_state::sprite_callback) } -void asterix_tile_callback( running_machine &machine, int layer, int *code, int *color, int *flags ) +K056832_CB_MEMBER(asterix_state::tile_callback) { - asterix_state *state = machine.driver_data(); - *flags = *code & 0x1000 ? TILE_FLIPX : 0; - *color = (state->m_layer_colorbase[layer] + ((*code & 0xe000) >> 13)) & 0x7f; - *code = (*code & 0x03ff) | state->m_tilebanks[(*code >> 10) & 3]; + *color = (m_layer_colorbase[layer] + ((*code & 0xe000) >> 13)) & 0x7f; + *code = (*code & 0x03ff) | m_tilebanks[(*code >> 10) & 3]; } UINT32 asterix_state::screen_update_asterix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/bishi.c b/src/mame/video/bishi.c index b75936dfd2b..d361abdd815 100644 --- a/src/mame/video/bishi.c +++ b/src/mame/video/bishi.c @@ -11,16 +11,14 @@ #include "includes/bishi.h" -void bishi_tile_callback( running_machine &machine, int layer, int *code, int *color, int *flags ) +K056832_CB_MEMBER(bishi_state::tile_callback) { - bishi_state *state = machine.driver_data(); - // *code -= '0'; -// *color = state->m_layer_colorbase[layer] | (*color>>2 & 0x0f); +// *color = m_layer_colorbase[layer] | (*color>>2 & 0x0f); // K055555GX_decode_vmixcolor(layer, color); // if (*color) osd_printf_debug("plane %x col %x [55 %x %x]\n", layer, *color, layer_colorbase[layer], K055555_get_palette_index(layer)); - *color = state->m_layer_colorbase[layer] + ((*color & 0xf0)); + *color = m_layer_colorbase[layer] + ((*color & 0xf0)); } void bishi_state::video_start() diff --git a/src/mame/video/dbz.c b/src/mame/video/dbz.c index 986ccbee112..f77ff793d79 100644 --- a/src/mame/video/dbz.c +++ b/src/mame/video/dbz.c @@ -12,10 +12,9 @@ #include "includes/dbz.h" -void dbz_tile_callback( running_machine &machine, int layer, int *code, int *color, int *flags ) +K056832_CB_MEMBER(dbz_state::tile_callback) { - dbz_state *state = machine.driver_data(); - *color = (state->m_layer_colorbase[layer] << 1) + ((*color & 0x3c) >> 2); + *color = (m_layer_colorbase[layer] << 1) + ((*color & 0x3c) >> 2); } void dbz_sprite_callback( running_machine &machine, int *code, int *color, int *priority_mask ) diff --git a/src/mame/video/djmain.c b/src/mame/video/djmain.c index 3ead6e5c03a..a4fd44782ac 100644 --- a/src/mame/video/djmain.c +++ b/src/mame/video/djmain.c @@ -127,7 +127,7 @@ void djmain_state::draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect } -void djmain_tile_callback(running_machine& machine, int layer, int *code, int *color, int *flags) +K056832_CB_MEMBER(djmain_state::tile_callback) { } diff --git a/src/mame/video/gijoe.c b/src/mame/video/gijoe.c index d8fae238b4e..d11dc29d4bc 100644 --- a/src/mame/video/gijoe.c +++ b/src/mame/video/gijoe.c @@ -20,9 +20,8 @@ void gijoe_sprite_callback( running_machine &machine, int *code, int *color, int *color = state->m_sprite_colorbase | (*color & 0x001f); } -void gijoe_tile_callback( running_machine &machine, int layer, int *code, int *color, int *flags ) +K056832_CB_MEMBER(gijoe_state::tile_callback) { - gijoe_state *state = machine.driver_data(); int tile = *code; if (tile >= 0xf000 && tile <= 0xf4ff) @@ -30,23 +29,23 @@ void gijoe_tile_callback( running_machine &machine, int layer, int *code, int *c tile &= 0x0fff; if (tile < 0x0310) { - state->m_avac_occupancy[layer] |= 0x0f00; - tile |= state->m_avac_bits[0]; + m_avac_occupancy[layer] |= 0x0f00; + tile |= m_avac_bits[0]; } else if (tile < 0x0470) { - state->m_avac_occupancy[layer] |= 0xf000; - tile |= state->m_avac_bits[1]; + m_avac_occupancy[layer] |= 0xf000; + tile |= m_avac_bits[1]; } else { - state->m_avac_occupancy[layer] |= 0x00f0; - tile |= state->m_avac_bits[2]; + m_avac_occupancy[layer] |= 0x00f0; + tile |= m_avac_bits[2]; } *code = tile; } - *color = (*color >> 2 & 0x0f) | state->m_layer_colorbase[layer]; + *color = (*color >> 2 & 0x0f) | m_layer_colorbase[layer]; } void gijoe_state::video_start() diff --git a/src/mame/video/k054156_k054157_k056832.c b/src/mame/video/k054156_k054157_k056832.c index 727ed86aa56..155f3feb6fe 100644 --- a/src/mame/video/k054156_k054157_k056832.c +++ b/src/mame/video/k054156_k054157_k056832.c @@ -189,7 +189,12 @@ k056832_device::k056832_device(const machine_config &mconfig, const char *tag, d m_videoram(NULL), m_num_gfx_banks(0), m_cur_gfx_banks(0), - m_rom_half(0), + m_gfx_memory_region(NULL), + m_gfx_num(0), + m_bpp(-1), + m_big(0), + m_djmain_hack(0), + m_k055555_tag(NULL), //m_layer_assoc_with_page[K056832_PAGE_COUNT], //m_layer_offs[8][2], //m_lsram_page[8][2], @@ -213,7 +218,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(0), + m_k055555(NULL), m_gfxdecode(*this), m_palette(*this) { @@ -240,32 +245,6 @@ void k056832_device::static_set_palette_tag(device_t &device, const char *tag) downcast(device).m_palette.set_tag(tag); } -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void k056832_device::device_config_complete() -{ - // inherit a copy of the static data - const k056832_interface *intf = reinterpret_cast(static_config()); - if (intf != NULL) - *static_cast(this) = *intf; - - // or initialize to defaults if none provided - else - { - m_gfx_memory_region = ""; - m_gfx_num = 0; - m_bpp = -1; - m_big = 0; - m_djmain_hack = 0; - m_callback = NULL; - m_k055555_tag = ""; - }; -} - void k056832_device::create_tilemaps(running_machine &machine) { tilemap_t *tmap; @@ -387,11 +366,8 @@ void k056832_device::device_start() memset(m_regs, 0x00, sizeof(m_regs) ); memset(m_regsb, 0x00, sizeof(m_regsb) ); - // for non-interface cases we still use the vh_start call - if (m_bpp == -1) - return; - - m_k055555 = machine().device(m_k055555_tag); + 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 */ @@ -401,7 +377,9 @@ void k056832_device::device_start() create_tilemaps(machine()); finalize_init(machine()); - + + // bind callbacks + m_k056832_cb.bind_relative_to(*owner()); } /***************************************************************************** @@ -557,7 +535,7 @@ void k056832_device::get_tile_info( tile_data &tileinfo, int tile_index, int pa color = (attr & smptr->palm1) | (attr >> smptr->pals2 & smptr->palm2); flags = TILE_FLIPYX(flip); - m_callback(machine(), layer, &code, &color, &flags); + m_k056832_cb(layer, &code, &color, &flags); SET_TILE_INFO_MEMBER(m_gfx_num, code, @@ -2185,25 +2163,6 @@ void k056832_device::create_gfx(running_machine &machine, const char *gfx_memory } - -void k056832_device::altK056832_vh_start(running_machine &machine, const char *gfx_memory_region, int bpp, int big, - int (*scrolld)[4][2], - void (*callback)(running_machine &machine, int layer, int *code, int *color, int *flags), - int djmain_hack) -{ - m_k055555 = 0; - m_callback = callback; - m_djmain_hack = djmain_hack; - - create_gfx(machine, gfx_memory_region, bpp, big); - - create_tilemaps(machine); - - finalize_init(machine); -} - - - int k056832_device::altK056832_update_linemap(screen_device &screen, bitmap_rgb32 &bitmap, int page, int flags) { if (m_page_tile_mode[page]) return(0); @@ -2614,7 +2573,3 @@ int k056832_device::get_layer_association(void) return(m_layer_association); } -void k056832_device::K056832_set_k055555(k055555_device * mode) -{ - m_k055555 = mode; -} diff --git a/src/mame/video/k054156_k054157_k056832.h b/src/mame/video/k054156_k054157_k056832.h index bb71e3d8933..4d92bf75682 100644 --- a/src/mame/video/k054156_k054157_k056832.h +++ b/src/mame/video/k054156_k054157_k056832.h @@ -8,7 +8,15 @@ #include "video/k055555.h"// still needs k055555_get_palette_index -typedef void (*k056832_callback)(running_machine &machine, int layer, int *code, int *color, int *flags); +typedef device_delegate k056832_cb_delegate; +#define K056832_CB_MEMBER(_name) void _name(int layer, int *code, int *color, int *flags) + +#define MCFG_K056832_CB(_class, _method) \ + k056832_device::set_k056832_callback(*device, k056832_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + +#define MCFG_K056832_CONFIG(_gfx_reg, _gfx_num, _bpp, _big, _djmain_hack, _k055555) \ + k056832_device::set_config(*device, _gfx_reg, _gfx_num, _bpp, _big, _djmain_hack, _k055555); + #define MCFG_K056832_ADD(_tag, _interface) \ @@ -21,14 +29,6 @@ typedef void (*k056832_callback)(running_machine &machine, int layer, int *code, struct k056832_interface { - const char *m_gfx_memory_region; - int m_gfx_num; - int m_bpp; - int m_big; - int m_djmain_hack; - k056832_callback m_callback; - - const char *m_k055555_tag; // tbyahhoo uses the k056832 together with a k055555 }; @@ -58,6 +58,18 @@ public: m_k055555 = 0; } + static void set_k056832_callback(device_t &device, k056832_cb_delegate callback) { downcast(device).m_k056832_cb = callback; } + static void set_config(device_t &device, const char *gfx_reg, int gfx_num, int bpp, int big, int djmain_hack, const char *k055555) + { + k056832_device &dev = downcast(device); + dev.m_gfx_memory_region = gfx_reg; + dev.m_gfx_num = gfx_num; + dev.m_bpp = bpp; + dev.m_big = big; + dev.m_djmain_hack = djmain_hack; + dev.m_k055555_tag = k055555; + } + // static configuration static void static_set_gfxdecode_tag(device_t &device, const char *tag); static void static_set_palette_tag(device_t &device, const char *tag); @@ -122,7 +134,6 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); private: @@ -138,13 +149,17 @@ private: int m_num_gfx_banks; // depends on size of graphics ROMs int m_cur_gfx_banks; // cached info for K056832_regs[0x1a] + k056832_cb_delegate m_k056832_cb; - - - - - - + //FIXME: device should be updated to use device_gfx_interface to get rid of most of these! + const char *m_gfx_memory_region; + int m_gfx_num; + int m_bpp; + 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 @@ -178,10 +193,6 @@ private: - - - - k055555_device *m_k055555; /* used to choose colorbase */ void get_tile_info( tile_data &tileinfo, int tile_index, int pageIndex ); @@ -222,22 +233,12 @@ private: required_device m_gfxdecode; required_device m_palette; + public: - - // todo: collapse these into above - void altK056832_vh_start(running_machine &machine, const char *gfx_memory_region, int bpp, int big, - int (*scrolld)[4][2], - void (*callback)(running_machine &machine, int layer, int *code, int *color, int *flags), - int djmain_hack); - - void K056832_set_k055555(k055555_device* mode); // k055555 hook - - void m_tilemap_draw(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int num, UINT32 flags, UINT32 priority); + private: int altK056832_update_linemap(screen_device &screen, bitmap_rgb32 &bitmap, int page, int flags); - - }; extern const device_type K056832; diff --git a/src/mame/video/konamigx.c b/src/mame/video/konamigx.c index 964a0dd61b3..64ee0a011d0 100644 --- a/src/mame/video/konamigx.c +++ b/src/mame/video/konamigx.c @@ -60,10 +60,6 @@ static bitmap_ind16 *gxtype1_roz_dstbitmap; static bitmap_ind16 *gxtype1_roz_dstbitmap2; static rectangle gxtype1_roz_dstbitmapclip; -static void (*game_tile_callback)(running_machine &machine, int layer, int *code, int *color, int *flags); - - - /***************************************************************************/ /* */ /* 1st-Tier GX/MW Variables and Functions */ @@ -1110,7 +1106,7 @@ TILE_GET_INFO_MEMBER(konamigx_state::get_gx_psac1b_tile_info) SET_TILE_INFO_MEMBER(0, tileno, colour, flip); } -static void konamigx_type2_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags) +K056832_CB_MEMBER(konamigx_state::type2_tile_callback) { int d = *code; @@ -1118,7 +1114,7 @@ static void konamigx_type2_tile_callback(running_machine &machine, int layer, in K055555GX_decode_vmixcolor(layer, color); } -static void konamigx_alpha_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags) +K056832_CB_MEMBER(konamigx_state::alpha_tile_callback) { int mixcode; int d = *code; @@ -1212,13 +1208,6 @@ void konamigx_state::_gxcommoninit(running_machine &machine) VIDEO_START_MEMBER(konamigx_state,konamigx_5bpp) { - if (!strcmp(machine().system().name,"sexyparo") || !strcmp(machine().system().name,"sexyparoa")) - game_tile_callback = konamigx_alpha_tile_callback; - else - game_tile_callback = konamigx_type2_tile_callback; - - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_5, 0, NULL, game_tile_callback, 0); - _gxcommoninit(machine()); /* here are some hand tuned per game scroll offsets to go with the per game visible areas, @@ -1226,7 +1215,6 @@ VIDEO_START_MEMBER(konamigx_state,konamigx_5bpp) if (!strcmp(machine().system().name,"tbyahhoo")) { - m_k056832->K056832_set_k055555(m_k055555); gx_tilemode = 1; } else @@ -1254,7 +1242,6 @@ VIDEO_START_MEMBER(konamigx_state,konamigx_5bpp) VIDEO_START_MEMBER(konamigx_state,winspike) { - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_8, 0, NULL, konamigx_alpha_tile_callback, 2); m_k055673->alt_k055673_vh_start(machine(), "gfx2", K055673_LAYOUT_LE2, -53, -23, konamigx_type2_sprite_callback); _gxcommoninitnosprites(machine()); @@ -1262,7 +1249,6 @@ VIDEO_START_MEMBER(konamigx_state,winspike) VIDEO_START_MEMBER(konamigx_state,dragoonj) { - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_5, 1, NULL, konamigx_type2_tile_callback, 0); m_k055673->alt_k055673_vh_start(machine(), "gfx2", K055673_LAYOUT_RNG, -53, -23, konamigx_dragoonj_sprite_callback); _gxcommoninitnosprites(machine()); @@ -1275,7 +1261,6 @@ VIDEO_START_MEMBER(konamigx_state,dragoonj) VIDEO_START_MEMBER(konamigx_state,le2) { - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_8, 1, NULL, konamigx_type2_tile_callback, 0); m_k055673->alt_k055673_vh_start(machine(), "gfx2", K055673_LAYOUT_LE2, -46, -23, konamigx_le2_sprite_callback); _gxcommoninitnosprites(machine()); @@ -1288,8 +1273,6 @@ VIDEO_START_MEMBER(konamigx_state,le2) VIDEO_START_MEMBER(konamigx_state,konamigx_6bpp) { - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_6, 0, NULL, konamigx_type2_tile_callback, 0); - _gxcommoninit(machine()); if (!strcmp(machine().system().name,"tokkae") || !strcmp(machine().system().name,"tkmmpzdm")) @@ -1303,8 +1286,6 @@ VIDEO_START_MEMBER(konamigx_state,konamigx_type3) { int width = m_screen->width(); int height = m_screen->height(); - - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_6, 0, NULL, konamigx_type2_tile_callback, 1); m_k055673->alt_k055673_vh_start(machine(), "gfx2", K055673_LAYOUT_GX6, -132, -23, konamigx_type2_sprite_callback); dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); @@ -1343,7 +1324,6 @@ VIDEO_START_MEMBER(konamigx_state,konamigx_type4) int width = m_screen->width(); int height = m_screen->height(); - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_8, 0, NULL, konamigx_type2_tile_callback, 0); m_k055673->alt_k055673_vh_start(machine(), "gfx2", K055673_LAYOUT_GX6, -79, -24, konamigx_type2_sprite_callback); // -23 looks better in intro dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); @@ -1374,7 +1354,6 @@ VIDEO_START_MEMBER(konamigx_state,konamigx_type4_vsn) int width = m_screen->width(); int height = m_screen->height(); - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_8, 0, NULL, konamigx_type2_tile_callback, 2); // set djmain_hack to 2 to kill layer association or half the tilemaps vanish on screen 0 m_k055673->alt_k055673_vh_start(machine(), "gfx2", K055673_LAYOUT_GX6, -132, -23, konamigx_type2_sprite_callback); dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); @@ -1404,7 +1383,6 @@ VIDEO_START_MEMBER(konamigx_state,konamigx_type4_sd2) int width = m_screen->width(); int height = m_screen->height(); - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_8, 0, NULL, konamigx_type2_tile_callback, 0); m_k055673->alt_k055673_vh_start(machine(), "gfx2", K055673_LAYOUT_GX6, -81, -23, konamigx_type2_sprite_callback); dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); @@ -1435,8 +1413,6 @@ VIDEO_START_MEMBER(konamigx_state,konamigx_type4_sd2) VIDEO_START_MEMBER(konamigx_state,konamigx_6bpp_2) { - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_6, 1, NULL, konamigx_type2_tile_callback, 0); - if (!strcmp(machine().system().name,"salmndr2") || !strcmp(machine().system().name,"salmndr2a")) { m_k055673->alt_k055673_vh_start(machine(), "gfx2", K055673_LAYOUT_GX6, -48, -23, konamigx_salmndr2_sprite_callback); @@ -1451,7 +1427,6 @@ VIDEO_START_MEMBER(konamigx_state,konamigx_6bpp_2) VIDEO_START_MEMBER(konamigx_state,opengolf) { - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_5, 0, NULL, konamigx_type2_tile_callback, 0); m_k055673->alt_k055673_vh_start(machine(), "gfx2", K055673_LAYOUT_GX6, -53, -23, konamigx_type2_sprite_callback); _gxcommoninitnosprites(machine()); @@ -1489,7 +1464,6 @@ VIDEO_START_MEMBER(konamigx_state,opengolf) VIDEO_START_MEMBER(konamigx_state,racinfrc) { - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_6, 0, NULL, konamigx_type2_tile_callback, 0); m_k055673->alt_k055673_vh_start(machine(), "gfx2", K055673_LAYOUT_GX, -53, -23, konamigx_type2_sprite_callback); _gxcommoninitnosprites(machine()); diff --git a/src/mame/video/lethal.c b/src/mame/video/lethal.c index 067a36b804f..fbf16a1a440 100644 --- a/src/mame/video/lethal.c +++ b/src/mame/video/lethal.c @@ -40,10 +40,9 @@ K05324X_CB_MEMBER(lethal_state::sprite_callback) *code = (*code & 0x3fff); // | spritebanks[(*code >> 12) & 3]; } -void lethalen_tile_callback( running_machine &machine, int layer, int *code, int *color, int *flags ) +K056832_CB_MEMBER(lethal_state::tile_callback) { - lethal_state *state = machine.driver_data(); - *color = state->m_layer_colorbase[layer] + ((*color & 0x3c) << 2); + *color = m_layer_colorbase[layer] + ((*color & 0x3c) << 2); } void lethal_state::video_start() diff --git a/src/mame/video/moo.c b/src/mame/video/moo.c index dd9a8a43027..d3d349dcc9a 100644 --- a/src/mame/video/moo.c +++ b/src/mame/video/moo.c @@ -28,10 +28,9 @@ void moo_sprite_callback( running_machine &machine, int *code, int *color, int * *color = state->m_sprite_colorbase | (*color & 0x001f); } -void moo_tile_callback( running_machine &machine, int layer, int *code, int *color, int *flags ) +K056832_CB_MEMBER(moo_state::tile_callback) { - moo_state *state = machine.driver_data(); - *color = state->m_layer_colorbase[layer] | (*color >> 2 & 0x0f); + *color = m_layer_colorbase[layer] | (*color >> 2 & 0x0f); } VIDEO_START_MEMBER(moo_state,moo) diff --git a/src/mame/video/mystwarr.c b/src/mame/video/mystwarr.c index 7a7939096d2..573845055f6 100644 --- a/src/mame/video/mystwarr.c +++ b/src/mame/video/mystwarr.c @@ -56,26 +56,22 @@ static void mystwarr_decode_tiles(running_machine &machine) // Mystic Warriors requires tile based blending. -static void mystwarr_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags) +K056832_CB_MEMBER(mystwarr_state::mystwarr_tile_callback) { - mystwarr_state *state = machine.driver_data(); - if (layer==1) {if ((*code&0xff00)+(*color)==0x4101) state->m_cbparam++; else state->m_cbparam--;} //* water hack (TEMPORARY) - - *color = state->m_layer_colorbase[layer] | (*color>>1 & 0x1e); + if (layer == 1) {if ((*code & 0xff00) + (*color) == 0x4101) m_cbparam++; else m_cbparam--;} //* water hack (TEMPORARY) + *color = m_layer_colorbase[layer] | (*color >> 1 & 0x1e); } // for games with 5bpp tile data -static void game5bpp_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags) +K056832_CB_MEMBER(mystwarr_state::game5bpp_tile_callback) { - mystwarr_state *state = machine.driver_data(); - *color = state->m_layer_colorbase[layer] | (*color>>1 & 0x1e); + *color = m_layer_colorbase[layer] | (*color >> 1 & 0x1e); } // for games with 4bpp tile data -static void game4bpp_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags) +K056832_CB_MEMBER(mystwarr_state::game4bpp_tile_callback) { - mystwarr_state *state = machine.driver_data(); - *color = state->m_layer_colorbase[layer] | (*color>>2 & 0x0f); + *color = m_layer_colorbase[layer] | (*color >> 2 & 0x0f); } static void mystwarr_sprite_callback(running_machine &machine, int *code, int *color, int *priority) @@ -160,8 +156,6 @@ VIDEO_START_MEMBER(mystwarr_state,gaiapols) { m_gametype = 0; - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_5, 0, NULL, game4bpp_tile_callback, 0); - mystwarr_decode_tiles(machine()); m_k055673->alt_k055673_vh_start(machine(), "gfx2", 1, -61, -22, gaiapols_sprite_callback); // stage2 brick walls @@ -197,8 +191,6 @@ VIDEO_START_MEMBER(mystwarr_state,dadandrn) { m_gametype = 1; - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_5, 0, NULL, game5bpp_tile_callback, 0); - mystwarr_decode_tiles(machine()); m_k055673->alt_k055673_vh_start(machine(), "gfx2", 0, -42, -22, gaiapols_sprite_callback); @@ -223,8 +215,6 @@ VIDEO_START_MEMBER(mystwarr_state,mystwarr) { m_gametype = 0; - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_5, 0, NULL, mystwarr_tile_callback, 0); - mystwarr_decode_tiles(machine()); m_k055673->alt_k055673_vh_start(machine(), "gfx2", 0, -48, -24, mystwarr_sprite_callback); @@ -243,8 +233,6 @@ VIDEO_START_MEMBER(mystwarr_state,metamrph) { m_gametype = 0; - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_5, 0, NULL, game4bpp_tile_callback, 0); - mystwarr_decode_tiles(machine()); m_k055673->alt_k055673_vh_start(machine(), "gfx2", 1, -51, -24, metamrph_sprite_callback); @@ -262,8 +250,6 @@ VIDEO_START_MEMBER(mystwarr_state,viostorm) { m_gametype = 0; - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_5, 0, NULL, game4bpp_tile_callback, 0); - mystwarr_decode_tiles(machine()); m_k055673->alt_k055673_vh_start(machine(), "gfx2", 1, -62, -23, metamrph_sprite_callback); @@ -280,8 +266,6 @@ VIDEO_START_MEMBER(mystwarr_state,martchmp) { m_gametype = 0; - m_k056832->altK056832_vh_start(machine(), "gfx1", K056832_BPP_5, 0, NULL, game5bpp_tile_callback, 0); - mystwarr_decode_tiles(machine()); m_k055673->alt_k055673_vh_start(machine(), "gfx2", 0, -58, -23, martchmp_sprite_callback); diff --git a/src/mame/video/qdrmfgp.c b/src/mame/video/qdrmfgp.c index 132f7db207e..0b4a356ab58 100644 --- a/src/mame/video/qdrmfgp.c +++ b/src/mame/video/qdrmfgp.c @@ -8,14 +8,12 @@ #include "includes/qdrmfgp.h" - -void qdrmfgp_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags) +K056832_CB_MEMBER(qdrmfgp_state::qdrmfgp_tile_callback) { - qdrmfgp_state *state = machine.driver_data(); - *color = ((*color>>2) & 0x0f) | state->m_pal; + *color = ((*color>>2) & 0x0f) | m_pal; } -void qdrmfgp2_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags) +K056832_CB_MEMBER(qdrmfgp_state::qdrmfgp2_tile_callback) { *color = (*color>>1) & 0x7f; } diff --git a/src/mame/video/xexex.c b/src/mame/video/xexex.c index 1d47cac03bc..81274399fcb 100644 --- a/src/mame/video/xexex.c +++ b/src/mame/video/xexex.c @@ -24,10 +24,9 @@ void xexex_sprite_callback( running_machine &machine, int *code, int *color, int *color = state->m_sprite_colorbase | (*color & 0x001f); } -void xexex_tile_callback(running_machine &machine, int layer, int *code, int *color, int *flags) +K056832_CB_MEMBER(xexex_state::tile_callback) { - xexex_state *state = machine.driver_data(); - *color = state->m_layer_colorbase[layer] | (*color >> 2 & 0x0f); + *color = m_layer_colorbase[layer] | (*color >> 2 & 0x0f); } void xexex_state::video_start()