From bdb49c9e5b2ebdc76e787c597dbdb44995a8014d Mon Sep 17 00:00:00 2001 From: cam900 Date: Sun, 18 Feb 2018 01:29:01 +0900 Subject: gaiden : Cleanups, Fixes (#3217) * gaiden : Cleanup duplicates, Split wildfang/raiga machine config/Address map raiga : Fix hang at soft reset * gaiden : More fixes * gaiden.cpp : Minor revert --- src/mame/drivers/gaiden.cpp | 152 ++++++++++++++++++++++---------------------- src/mame/includes/gaiden.h | 23 ++++--- src/mame/video/gaiden.cpp | 39 ++++-------- 3 files changed, 100 insertions(+), 114 deletions(-) diff --git a/src/mame/drivers/gaiden.cpp b/src/mame/drivers/gaiden.cpp index 4c0f314133a..80a7275506f 100644 --- a/src/mame/drivers/gaiden.cpp +++ b/src/mame/drivers/gaiden.cpp @@ -141,6 +141,8 @@ Notes: #include "sound/ym2151.h" #include "speaker.h" +#include + WRITE16_MEMBER(gaiden_state::irq_ack_w) { @@ -165,17 +167,17 @@ WRITE16_MEMBER(gaiden_state::gaiden_sound_command_w) /* and reads the answer from 0x07a007. The returned values contain the address of */ /* a function to jump to. */ +static const int wildfang_jumppoints[] = +{ + 0x0c0c,0x0cac,0x0d42,0x0da2,0x0eea,0x112e,0x1300,0x13fa, + 0x159a,0x1630,0x109a,0x1700,0x1750,0x1806,0x18d6,0x1a44, + 0x1b52 +}; + WRITE16_MEMBER(gaiden_state::wildfang_protection_w) { if (ACCESSING_BITS_8_15) { - static const int jumppoints[] = - { - 0x0c0c,0x0cac,0x0d42,0x0da2,0x0eea,0x112e,0x1300,0x13fa, - 0x159a,0x1630,0x109a,0x1700,0x1750,0x1806,0x18d6,0x1a44, - 0x1b52 - }; - data >>= 8; // logerror("PC %06x: prot = %02x\n",m_maincpu->pc(),data); @@ -191,7 +193,7 @@ WRITE16_MEMBER(gaiden_state::wildfang_protection_w) break; case 0x20: /* low 4 bits of jump code */ m_jumpcode |= data & 0x0f; - if (m_jumpcode >= ARRAY_LENGTH(jumppoints)) + if (m_jumpcode >= ARRAY_LENGTH(wildfang_jumppoints)) { logerror("unknown jumpcode %02x\n", m_jumpcode); m_jumpcode = 0; @@ -199,16 +201,16 @@ WRITE16_MEMBER(gaiden_state::wildfang_protection_w) m_prot = 0x20; break; case 0x30: /* ask for bits 12-15 of function address */ - m_prot = 0x40 | ((jumppoints[m_jumpcode] >> 12) & 0x0f); + m_prot = 0x40 | ((m_jumppoints[m_jumpcode] >> 12) & 0x0f); break; case 0x40: /* ask for bits 8-11 of function address */ - m_prot = 0x50 | ((jumppoints[m_jumpcode] >> 8) & 0x0f); + m_prot = 0x50 | ((m_jumppoints[m_jumpcode] >> 8) & 0x0f); break; case 0x50: /* ask for bits 4-7 of function address */ - m_prot = 0x60 | ((jumppoints[m_jumpcode] >> 4) & 0x0f); + m_prot = 0x60 | ((m_jumppoints[m_jumpcode] >> 4) & 0x0f); break; case 0x60: /* ask for bits 0-3 of function address */ - m_prot = 0x70 | ((jumppoints[m_jumpcode] >> 0) & 0x0f); + m_prot = 0x70 | ((m_jumppoints[m_jumpcode] >> 0) & 0x0f); break; } } @@ -266,7 +268,7 @@ same commands as some of the above */ /* these are used during startup */ -static const int jumppoints_00[0x100] = +static const int raiga_jumppoints_00[0x100] = { 0x6669, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,0x4a46, -1, @@ -279,7 +281,7 @@ static const int jumppoints_00[0x100] = }; /* these are used the rest of the time */ -static const int jumppoints_other[0x100] = +static const int raiga_jumppoints_other[0x100] = { 0x5457,0x494e,0x5f4b,0x4149,0x5345,0x525f,0x4d49,0x5941, 0x5241,0x5349,0x4d4f,0x4a49, -1, -1, -1, -1, @@ -291,7 +293,7 @@ static const int jumppoints_other[0x100] = -1, -1, -1, -1, -1, -1, -1, -1 }; -MACHINE_RESET_MEMBER(gaiden_state,raiga) +void gaiden_state::machine_reset() { m_prot = 0; m_jumpcode = 0; @@ -309,7 +311,13 @@ MACHINE_RESET_MEMBER(gaiden_state,raiga) m_spr_offset_y = 0; } -MACHINE_START_MEMBER(gaiden_state,raiga) +MACHINE_RESET_MEMBER(gaiden_state,raiga) +{ + gaiden_state::machine_reset() + m_jumppoints = raiga_jumppoints_00; +} + +void gaiden_state::machine_start() { save_item(NAME(m_prot)); save_item(NAME(m_jumpcode)); @@ -348,12 +356,12 @@ WRITE16_MEMBER(gaiden_state::raiga_protection_w) m_jumpcode |= data & 0x0f; logerror("requested protection jumpcode %02x\n", m_jumpcode); // m_jumpcode = 0; - if (m_raiga_jumppoints[m_jumpcode] == -2) + if (m_jumppoints[m_jumpcode] == -2) { - m_raiga_jumppoints = jumppoints_other; + m_jumppoints = raiga_jumppoints_other; } - if (m_raiga_jumppoints[m_jumpcode] == -1) + if (m_jumppoints[m_jumpcode] == -1) { logerror("unknown jumpcode %02x\n", m_jumpcode); popmessage("unknown jumpcode %02x", m_jumpcode); @@ -362,16 +370,16 @@ WRITE16_MEMBER(gaiden_state::raiga_protection_w) m_prot = 0x20; break; case 0x30: /* ask for bits 12-15 of function address */ - m_prot = 0x40 | ((m_raiga_jumppoints[m_jumpcode] >> 12) & 0x0f); + m_prot = 0x40 | ((m_jumppoints[m_jumpcode] >> 12) & 0x0f); break; case 0x40: /* ask for bits 8-11 of function address */ - m_prot = 0x50 | ((m_raiga_jumppoints[m_jumpcode] >> 8) & 0x0f); + m_prot = 0x50 | ((m_jumppoints[m_jumpcode] >> 8) & 0x0f); break; case 0x50: /* ask for bits 4-7 of function address */ - m_prot = 0x60 | ((m_raiga_jumppoints[m_jumpcode] >> 4) & 0x0f); + m_prot = 0x60 | ((m_jumppoints[m_jumpcode] >> 4) & 0x0f); break; case 0x60: /* ask for bits 0-3 of function address */ - m_prot = 0x70 | ((m_raiga_jumppoints[m_jumpcode] >> 0) & 0x0f); + m_prot = 0x70 | ((m_jumppoints[m_jumpcode] >> 0) & 0x0f); break; } } @@ -386,9 +394,9 @@ READ16_MEMBER(gaiden_state::raiga_protection_r) ADDRESS_MAP_START(gaiden_state::gaiden_map) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x060000, 0x063fff) AM_RAM - AM_RANGE(0x070000, 0x070fff) AM_RAM_WRITE(gaiden_videoram_w) AM_SHARE("videoram") - AM_RANGE(0x072000, 0x073fff) AM_RAM_WRITE(gaiden_videoram2_w) AM_SHARE("videoram2") - AM_RANGE(0x074000, 0x075fff) AM_RAM_WRITE(gaiden_videoram3_w) AM_SHARE("videoram3") + AM_RANGE(0x070000, 0x070fff) AM_RAM_WRITE(gaiden_tx_videoram_w) AM_SHARE("videoram1") + AM_RANGE(0x072000, 0x073fff) AM_RAM_WRITE(gaiden_videoram_w<1>) AM_SHARE("videoram2") + AM_RANGE(0x074000, 0x075fff) AM_RAM_WRITE(gaiden_videoram_w<2>) AM_SHARE("videoram3") AM_RANGE(0x076000, 0x077fff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x078000, 0x079fff) AM_RAM_DEVWRITE("palette", palette_device, write16) AM_SHARE("palette") AM_RANGE(0x07a000, 0x07a001) AM_READ_PORT("SYSTEM") @@ -409,12 +417,24 @@ ADDRESS_MAP_START(gaiden_state::gaiden_map) AM_RANGE(0x07a808, 0x07a809) AM_WRITE(gaiden_flip_w) ADDRESS_MAP_END +ADDRESS_MAP_START(gaiden_state::wildfang_map) + AM_IMPORT_FROM(gaiden_map) + AM_RANGE(0x07a006, 0x07a007) AM_READ(wildfang_protection_r) + AM_RANGE(0x07a804, 0x07a805) AM_WRITE(wildfang_protection_w) +ADDRESS_MAP_END + +ADDRESS_MAP_START(gaiden_state::raiga_map) + AM_IMPORT_FROM(gaiden_map) + AM_RANGE(0x07a006, 0x07a007) AM_READ(raiga_protection_r) + AM_RANGE(0x07a804, 0x07a805) AM_WRITE(raiga_protection_w) +ADDRESS_MAP_END + ADDRESS_MAP_START(gaiden_state::drgnbowl_map) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x060000, 0x063fff) AM_RAM - AM_RANGE(0x070000, 0x070fff) AM_RAM_WRITE(gaiden_videoram_w) AM_SHARE("videoram") - AM_RANGE(0x072000, 0x073fff) AM_RAM_WRITE(gaiden_videoram2_w) AM_SHARE("videoram2") - AM_RANGE(0x074000, 0x075fff) AM_RAM_WRITE(gaiden_videoram3_w) AM_SHARE("videoram3") + AM_RANGE(0x070000, 0x070fff) AM_RAM_WRITE(gaiden_tx_videoram_w) AM_SHARE("videoram1") + AM_RANGE(0x072000, 0x073fff) AM_RAM_WRITE(gaiden_videoram_w<1>) AM_SHARE("videoram2") + AM_RANGE(0x074000, 0x075fff) AM_RAM_WRITE(gaiden_videoram_w<2>) AM_SHARE("videoram3") AM_RANGE(0x076000, 0x077fff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x078000, 0x079fff) AM_RAM_DEVWRITE("palette", palette_device, write16) AM_SHARE("palette") AM_RANGE(0x07a000, 0x07a001) AM_READ_PORT("SYSTEM") @@ -671,15 +691,8 @@ static const gfx_layout spritelayout = static GFXDECODE_START( gaiden ) GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0x100, 16 ) /* tiles 8x8 */ GFXDECODE_ENTRY( "gfx2", 0, tile2layout, 0x000, 0x1000 ) /* tiles 16x16 */ - GFXDECODE_ENTRY( "gfx3", 0, tile2layout, 0x000, 0x1000 ) /* tiles 16x16 */ - GFXDECODE_ENTRY( "gfx4", 0, spritelayout, 0x000, 0x1000 ) /* sprites 8x8 */ -GFXDECODE_END - -static GFXDECODE_START( raiga ) - GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0x100, 16 ) /* tiles 8x8 */ - GFXDECODE_ENTRY( "gfx2", 0, tile2layout, 0x000, 0x1000 ) /* tiles 16x16 */ - GFXDECODE_ENTRY( "gfx3", 0, tile2layout, 0x000, 0x1000 ) /* tiles 16x16 (only colors 0x00-x0f and 0x80-0x8f are used) */ - GFXDECODE_ENTRY( "gfx4", 0, spritelayout, 0x000, 0x1000 ) /* sprites 8x8 (only colors 0x00-x0f and 0x80-0x8f are used) */ + GFXDECODE_ENTRY( "gfx3", 0, tile2layout, 0x000, 0x1000 ) /* tiles 16x16 (only colors 0x00-0x0f and 0x80-0x8f are used) */ + GFXDECODE_ENTRY( "gfx4", 0, spritelayout, 0x000, 0x1000 ) /* sprites 8x8 (only colors 0x00-0x0f and 0x80-0x8f are used) */ GFXDECODE_END static const gfx_layout mastninj_tile2layout = @@ -752,9 +765,6 @@ MACHINE_CONFIG_START(gaiden_state::shadoww) MCFG_CPU_PROGRAM_MAP(sound_map) /* IRQs are triggered by the YM2203 */ - MCFG_MACHINE_START_OVERRIDE(gaiden_state,raiga) - MCFG_MACHINE_RESET_OVERRIDE(gaiden_state,raiga) - MCFG_WATCHDOG_ADD("watchdog") /* video hardware */ @@ -805,14 +815,20 @@ MACHINE_CONFIG_START(gaiden_state::shadoww) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) MACHINE_CONFIG_END +MACHINE_CONFIG_START(gaiden_state::wildfang) + shadoww(config); + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(wildfang_map) +MACHINE_CONFIG_END + MACHINE_CONFIG_START(gaiden_state::raiga) shadoww(config); + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(raiga_map) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(gaiden_state, screen_update_raiga) + MCFG_MACHINE_RESET_OVERRIDE(gaiden_state,raiga) MCFG_VIDEO_START_OVERRIDE(gaiden_state,raiga) - MCFG_GFXDECODE_MODIFY("gfxdecode", raiga) MACHINE_CONFIG_END MACHINE_CONFIG_START(gaiden_state::drgnbowl) @@ -826,9 +842,6 @@ MACHINE_CONFIG_START(gaiden_state::drgnbowl) MCFG_CPU_PROGRAM_MAP(drgnbowl_sound_map) MCFG_CPU_IO_MAP(drgnbowl_sound_port_map) - MCFG_MACHINE_START_OVERRIDE(gaiden_state,raiga) - MCFG_MACHINE_RESET_OVERRIDE(gaiden_state,raiga) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -937,7 +950,7 @@ WRITE8_MEMBER(gaiden_state::adpcm_bankswitch_w) MACHINE_START_MEMBER(gaiden_state,mastninj) { - MACHINE_START_CALL_MEMBER(raiga); + gaiden_state::machine_start(); m_adpcm_bank->configure_entries(0, 8, memregion("audiocpu")->base(), 0x4000); m_adpcm_bank->set_entry(0); @@ -949,9 +962,9 @@ MACHINE_START_MEMBER(gaiden_state,mastninj) ADDRESS_MAP_START(gaiden_state::mastninj_map) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x060000, 0x063fff) AM_RAM - AM_RANGE(0x070000, 0x070fff) AM_RAM_WRITE(gaiden_videoram_w) AM_SHARE("videoram") - AM_RANGE(0x072000, 0x073fff) AM_RAM_WRITE(gaiden_videoram2_w) AM_SHARE("videoram2") - AM_RANGE(0x074000, 0x075fff) AM_RAM_WRITE(gaiden_videoram3_w) AM_SHARE("videoram3") + AM_RANGE(0x070000, 0x070fff) AM_RAM_WRITE(gaiden_tx_videoram_w) AM_SHARE("videoram1") + AM_RANGE(0x072000, 0x073fff) AM_RAM_WRITE(gaiden_videoram_w<1>) AM_SHARE("videoram2") + AM_RANGE(0x074000, 0x075fff) AM_RAM_WRITE(gaiden_videoram_w<2>) AM_SHARE("videoram3") AM_RANGE(0x076000, 0x077fff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x078000, 0x079fff) AM_RAM_DEVWRITE("palette", palette_device, write16) AM_SHARE("palette") // AM_RANGE(0x078800, 0x079fff) AM_RAM @@ -982,7 +995,6 @@ MACHINE_CONFIG_START(gaiden_state::mastninj) MCFG_CPU_PROGRAM_MAP(mastninj_sound_map) MCFG_MACHINE_START_OVERRIDE(gaiden_state,mastninj) - MCFG_MACHINE_RESET_OVERRIDE(gaiden_state,raiga) MCFG_WATCHDOG_ADD("watchdog") @@ -1580,33 +1592,23 @@ ROM_END DRIVER_INIT_MEMBER(gaiden_state,shadoww) { + m_jumppoints = wildfang_jumppoints; /* sprite size Y = sprite size X */ m_sprite_sizey = 0; - m_raiga_jumppoints = jumppoints_00; } DRIVER_INIT_MEMBER(gaiden_state,wildfang) { + m_jumppoints = wildfang_jumppoints; /* sprite size Y = sprite size X */ m_sprite_sizey = 0; - m_raiga_jumppoints = jumppoints_00; - - m_prot = 0; - m_jumpcode = 0; - m_maincpu->space(AS_PROGRAM).install_read_handler(0x07a006, 0x07a007, read16_delegate(FUNC(gaiden_state::wildfang_protection_r),this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::wildfang_protection_w),this)); } DRIVER_INIT_MEMBER(gaiden_state,raiga) { + m_jumppoints = raiga_jumppoints_00; /* sprite size Y independent from sprite size X */ m_sprite_sizey = 2; - m_raiga_jumppoints = jumppoints_00; - - m_prot = 0; - m_jumpcode = 0; - m_maincpu->space(AS_PROGRAM).install_read_handler(0x07a006, 0x07a007, read16_delegate(FUNC(gaiden_state::raiga_protection_r),this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::raiga_protection_w),this)); } void gaiden_state::descramble_drgnbowl(int descramble_cpu) @@ -1619,7 +1621,7 @@ void gaiden_state::descramble_drgnbowl(int descramble_cpu) { std::vector buffer(size); - memcpy(&buffer[0], ROM, size); + std::copy(&ROM[0], &ROM[size], buffer.begin()); for( i = 0; i < size; i++ ) { ROM[i] = buffer[bitswap<24>(i,23,22,21,20, @@ -1636,7 +1638,7 @@ void gaiden_state::descramble_drgnbowl(int descramble_cpu) { std::vector buffer(size); - memcpy(&buffer[0],ROM,size); + std::copy(&ROM[0], &ROM[size], buffer.begin()); for( i = 0; i < size; i++ ) { ROM[i] = buffer[bitswap<24>(i,23,22,21,20, @@ -1651,15 +1653,13 @@ void gaiden_state::descramble_drgnbowl(int descramble_cpu) DRIVER_INIT_MEMBER(gaiden_state,drgnbowl) { - m_raiga_jumppoints = jumppoints_00; - + m_jumppoints = wildfang_jumppoints; descramble_drgnbowl(1); } DRIVER_INIT_MEMBER(gaiden_state,drgnbowla) { - m_raiga_jumppoints = jumppoints_00; - + m_jumppoints = wildfang_jumppoints; descramble_drgnbowl(0); } @@ -1681,7 +1681,7 @@ void gaiden_state::descramble_mastninj_gfx(uint8_t* src) 7,6,4, 3,2,1,0)]; } - memcpy(src, &buffer[0], len); + std::copy(buffer.begin(), buffer.end(), &src[0]); } { @@ -1697,7 +1697,7 @@ void gaiden_state::descramble_mastninj_gfx(uint8_t* src) 7,5,4, 3,2,1,0)]; } - memcpy(src, &buffer[0], len); + std::copy(buffer.begin(), buffer.end(), &src[0]); } } @@ -1719,9 +1719,9 @@ GAME( 1989, mastninj, shadoww, mastninj, common, gaiden_state, mastninj, ROT GAME( 1992, drgnbowl, 0, drgnbowl, drgnbowl, gaiden_state, drgnbowl, ROT0, "Nics", "Dragon Bowl (set 1, encrypted program)", MACHINE_SUPPORTS_SAVE ) // Dragon Bowl is based on Ninja Gaiden code GAME( 1992, drgnbowla, drgnbowl, drgnbowl, drgnbowl, gaiden_state, drgnbowla,ROT0, "Nics", "Dragon Bowl (set 2, unencrypted program)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, wildfang, 0, shadoww, wildfang, gaiden_state, wildfang, ROT0, "Tecmo", "Wild Fang / Tecmo Knight", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, wildfangs, wildfang, shadoww, tknight, gaiden_state, wildfang, ROT0, "Tecmo", "Wild Fang", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, tknight, wildfang, shadoww, tknight, gaiden_state, wildfang, ROT0, "Tecmo", "Tecmo Knight", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, wildfang, 0, wildfang, wildfang, gaiden_state, wildfang, ROT0, "Tecmo", "Wild Fang / Tecmo Knight", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, wildfangs, wildfang, wildfang, tknight, gaiden_state, wildfang, ROT0, "Tecmo", "Wild Fang", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, tknight, wildfang, wildfang, tknight, gaiden_state, wildfang, ROT0, "Tecmo", "Tecmo Knight", MACHINE_SUPPORTS_SAVE ) GAME( 1991, stratof, 0, raiga, raiga, gaiden_state, raiga, ROT0, "Tecmo", "Raiga - Strato Fighter (US)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1991, raiga, stratof, raiga, raiga, gaiden_state, raiga, ROT0, "Tecmo", "Raiga - Strato Fighter (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/gaiden.h b/src/mame/includes/gaiden.h index df1af3e6edb..33d52de3f65 100644 --- a/src/mame/includes/gaiden.h +++ b/src/mame/includes/gaiden.h @@ -19,9 +19,7 @@ class gaiden_state : public driver_device public: gaiden_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_videoram2(*this, "videoram2"), - m_videoram3(*this, "videoram3"), + m_videoram(*this, "videoram%u", 1), m_spriteram(*this, "spriteram"), m_adpcm_bank(*this, "adpcm_bank"), m_maincpu(*this, "maincpu"), @@ -37,9 +35,7 @@ public: { } /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_videoram2; - required_shared_ptr m_videoram3; + required_shared_ptr_array m_videoram; required_shared_ptr m_spriteram; optional_memory_bank m_adpcm_bank; @@ -65,7 +61,7 @@ public: int m_sprite_sizey; int m_prot; int m_jumpcode; - const int *m_raiga_jumppoints; + const int *m_jumppoints; // raiga, wildfang bool m_adpcm_toggle; /* devices */ @@ -102,9 +98,8 @@ public: DECLARE_WRITE16_MEMBER(gaiden_fgoffsety_w); DECLARE_WRITE16_MEMBER(gaiden_bgoffsety_w); DECLARE_WRITE16_MEMBER(gaiden_sproffsety_w); - DECLARE_WRITE16_MEMBER(gaiden_videoram3_w); - DECLARE_WRITE16_MEMBER(gaiden_videoram2_w); - DECLARE_WRITE16_MEMBER(gaiden_videoram_w); + template DECLARE_WRITE16_MEMBER(gaiden_videoram_w); + DECLARE_WRITE16_MEMBER(gaiden_tx_videoram_w); DECLARE_DRIVER_INIT(raiga); DECLARE_DRIVER_INIT(drgnbowl); DECLARE_DRIVER_INIT(drgnbowla); @@ -115,7 +110,6 @@ public: TILE_GET_INFO_MEMBER(get_fg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info_raiga); TILE_GET_INFO_MEMBER(get_tx_tile_info); - DECLARE_MACHINE_START(raiga); DECLARE_MACHINE_START(mastninj); DECLARE_MACHINE_RESET(raiga); DECLARE_VIDEO_START(gaiden); @@ -123,7 +117,6 @@ public: DECLARE_VIDEO_START(raiga); uint32_t screen_update_gaiden(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_drgnbowl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_raiga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void drgnbowl_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void descramble_drgnbowl(int descramble_cpu); void descramble_mastninj_gfx(uint8_t* src); @@ -131,11 +124,17 @@ public: void drgnbowl(machine_config &config); void mastninj(machine_config &config); void shadoww(machine_config &config); + void wildfang(machine_config &config); void drgnbowl_map(address_map &map); void drgnbowl_sound_map(address_map &map); void drgnbowl_sound_port_map(address_map &map); void gaiden_map(address_map &map); + void wildfang_map(address_map &map); + void raiga_map(address_map &map); void mastninj_map(address_map &map); void mastninj_sound_map(address_map &map); void sound_map(address_map &map); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; }; diff --git a/src/mame/video/gaiden.cpp b/src/mame/video/gaiden.cpp index 43de1f9baae..f482d0f9409 100644 --- a/src/mame/video/gaiden.cpp +++ b/src/mame/video/gaiden.cpp @@ -17,8 +17,8 @@ TILE_GET_INFO_MEMBER(gaiden_state::get_bg_tile_info) { - uint16_t *videoram1 = &m_videoram3[0x0800]; - uint16_t *videoram2 = m_videoram3; + uint16_t *videoram1 = &m_videoram[2][0x0800]; + uint16_t *videoram2 = m_videoram[2]; SET_TILE_INFO_MEMBER(1, videoram1[tile_index] & 0x0fff, (videoram2[tile_index] & 0xf0) >> 4, @@ -27,8 +27,8 @@ TILE_GET_INFO_MEMBER(gaiden_state::get_bg_tile_info) TILE_GET_INFO_MEMBER(gaiden_state::get_fg_tile_info) { - uint16_t *videoram1 = &m_videoram2[0x0800]; - uint16_t *videoram2 = m_videoram2; + uint16_t *videoram1 = &m_videoram[1][0x0800]; + uint16_t *videoram2 = m_videoram[1]; SET_TILE_INFO_MEMBER(2, videoram1[tile_index] & 0x0fff, (videoram2[tile_index] & 0xf0) >> 4, @@ -37,8 +37,8 @@ TILE_GET_INFO_MEMBER(gaiden_state::get_fg_tile_info) TILE_GET_INFO_MEMBER(gaiden_state::get_fg_tile_info_raiga) { - uint16_t *videoram1 = &m_videoram2[0x0800]; - uint16_t *videoram2 = m_videoram2; + uint16_t *videoram1 = &m_videoram[1][0x0800]; + uint16_t *videoram2 = m_videoram[1]; int colour = ((videoram2[tile_index] & 0xf0) >> 4); @@ -54,8 +54,8 @@ TILE_GET_INFO_MEMBER(gaiden_state::get_fg_tile_info_raiga) TILE_GET_INFO_MEMBER(gaiden_state::get_tx_tile_info) { - uint16_t *videoram1 = &m_videoram[0x0400]; - uint16_t *videoram2 = m_videoram; + uint16_t *videoram1 = &m_videoram[0][0x0400]; + uint16_t *videoram2 = m_videoram[0]; SET_TILE_INFO_MEMBER(0, videoram1[tile_index] & 0x07ff, (videoram2[tile_index] & 0xf0) >> 4, @@ -206,21 +206,16 @@ WRITE16_MEMBER(gaiden_state::gaiden_sproffsety_w) } } - -WRITE16_MEMBER(gaiden_state::gaiden_videoram3_w) +template +WRITE16_MEMBER(gaiden_state::gaiden_videoram_w) { - COMBINE_DATA(&m_videoram3[offset]); + COMBINE_DATA(&m_videoram[TileMap][offset]); m_background->mark_tile_dirty(offset & 0x07ff); } -WRITE16_MEMBER(gaiden_state::gaiden_videoram2_w) -{ - COMBINE_DATA(&m_videoram2[offset]); - m_foreground->mark_tile_dirty(offset & 0x07ff); -} -WRITE16_MEMBER(gaiden_state::gaiden_videoram_w) +WRITE16_MEMBER(gaiden_state::gaiden_tx_videoram_w) { - COMBINE_DATA(&m_videoram[offset]); + COMBINE_DATA(&m_videoram[0][offset]); m_text_layer->mark_tile_dirty(offset & 0x03ff); } @@ -292,13 +287,6 @@ void gaiden_state::drgnbowl_draw_sprites(screen_device &screen, bitmap_ind16 &bi } uint32_t gaiden_state::screen_update_gaiden(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - screen_update_raiga(screen, bitmap, cliprect); - return 0; - -} - -uint32_t gaiden_state::screen_update_raiga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { m_tile_bitmap_bg.fill(0, cliprect); m_tile_bitmap_fg.fill(0, cliprect); @@ -314,7 +302,6 @@ uint32_t gaiden_state::screen_update_raiga(screen_device &screen, bitmap_rgb32 & // todo, this should go through the mixer! m_text_layer->draw(screen, bitmap, cliprect, 0, 0); - return 0; } -- cgit v1.2.3