diff --git a/src/mame/drivers/route16.cpp b/src/mame/drivers/route16.cpp index 8bf639b0a73..09fa1401c9a 100644 --- a/src/mame/drivers/route16.cpp +++ b/src/mame/drivers/route16.cpp @@ -218,8 +218,8 @@ WRITE8_MEMBER(route16_state::speakres_out2_w) *************************************/ static ADDRESS_MAP_START( route16_cpu1_map, AS_PROGRAM, 8, route16_state ) - AM_RANGE(0x0000, 0x3fff) AM_ROM - /*AM_RANGE(0x3000, 0x3001) AM_NOP protection device */ + AM_RANGE(0x0000, 0x2fff) AM_ROM + AM_RANGE(0x3000, 0x3001) AM_READ(route16_prot_read) AM_RANGE(0x4000, 0x43ff) AM_RAM_WRITE(route16_sharedram_w) AM_SHARE("sharedram") AM_RANGE(0x4800, 0x4800) AM_READ_PORT("DSW") AM_WRITE(out0_w) AM_RANGE(0x5000, 0x5000) AM_READ_PORT("P1") AM_WRITE(out1_w) @@ -1049,7 +1049,12 @@ READ8_MEMBER(route16_state::routex_prot_read) logerror ("cpu '%s' (PC=%08X): unmapped prot read\n", space.device().tag(), space.device().safe_pc()); return 0x00; +} +READ8_MEMBER(route16_state::route16_prot_read) +{ + m_protection_data++; + return (1 << ((m_protection_data >> 1) & 7)); } @@ -1059,58 +1064,6 @@ READ8_MEMBER(route16_state::routex_prot_read) * *************************************/ -DRIVER_INIT_MEMBER(route16_state,route16) -{ - uint8_t *ROM = memregion("cpu1")->base(); - /* TO DO : Replace these patches with simulation of the protection device */ - - /* patch the protection */ - ROM[0x0105] = 0x00; /* jp nz,$4109 (nirvana) - NOP's in route16c */ - ROM[0x0106] = 0x00; - ROM[0x0107] = 0x00; - - ROM[0x072a] = 0x00; /* jp nz,$4238 (nirvana) */ - ROM[0x072b] = 0x00; - ROM[0x072c] = 0x00; - - DRIVER_INIT_CALL(route16c); -} - -DRIVER_INIT_MEMBER(route16_state,route16c) -{ - uint8_t *ROM = memregion("cpu1")->base(); - /* Is this actually a bootleg? some of the protection has - been removed */ - - /* patch the protection */ - ROM[0x00e9] = 0x3a; - - ROM[0x0754] = 0xc3; - ROM[0x0755] = 0x63; - ROM[0x0756] = 0x07; -} - - -DRIVER_INIT_MEMBER(route16_state,route16a) -{ - uint8_t *ROM = memregion("cpu1")->base(); - /* TO DO : Replace these patches with simulation of the protection device */ - - /* patch the protection */ - ROM[0x00e9] = 0x3a; - - ROM[0x0105] = 0x00; /* jp nz,$4109 (nirvana) - NOP's in route16c */ - ROM[0x0106] = 0x00; - ROM[0x0107] = 0x00; - - ROM[0x0731] = 0x00; /* jp nz,$4238 (nirvana) */ - ROM[0x0732] = 0x00; - ROM[0x0733] = 0x00; - - ROM[0x0747] = 0xc3; - ROM[0x0748] = 0x56; - ROM[0x0749] = 0x07; -} @@ -1122,9 +1075,9 @@ DRIVER_INIT_MEMBER(route16_state,route16a) * *************************************/ -GAME( 1981, route16, 0, route16, route16, route16_state, route16, ROT270, "Tehkan / Sun Electronics (Centuri license)", "Route 16 (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1981, route16a, route16, route16, route16, route16_state, route16a, ROT270, "Tehkan / Sun Electronics (Centuri license)", "Route 16 (set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1981, route16c, route16, route16, route16, route16_state, route16c, ROT270, "Tehkan / Sun Electronics (Centuri license)", "Route 16 (set 3, bootleg?)", MACHINE_SUPPORTS_SAVE ) // similar to set 1 but with some protection removed? +GAME( 1981, route16, 0, route16, route16, route16_state, 0, ROT270, "Tehkan / Sun Electronics (Centuri license)", "Route 16 (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1981, route16a, route16, route16, route16, route16_state, 0, ROT270, "Tehkan / Sun Electronics (Centuri license)", "Route 16 (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1981, route16c, route16, route16, route16, route16_state, 0, ROT270, "Tehkan / Sun Electronics (Centuri license)", "Route 16 (set 3, bootleg?)", MACHINE_SUPPORTS_SAVE ) // similar to set 1 but with some protection removed? GAME( 1981, route16bl,route16, route16, route16, route16_state, 0, ROT270, "bootleg (Leisure and Allied)", "Route 16 (bootleg)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, routex, route16, routex, route16, route16_state, 0, ROT270, "bootleg", "Route X (bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/route16.h b/src/mame/includes/route16.h index bcb8eb2911f..dd0f8ff2562 100644 --- a/src/mame/includes/route16.h +++ b/src/mame/includes/route16.h @@ -6,29 +6,19 @@ class route16_state : public driver_device { public: route16_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_sn(*this, "snsnd"), - m_sharedram(*this, "sharedram"), - m_videoram1(*this, "videoram1"), - m_videoram2(*this, "videoram2"), - m_palette(*this, "palette") {} - - optional_device m_sn; - - required_shared_ptr m_sharedram; - required_shared_ptr m_videoram1; - required_shared_ptr m_videoram2; - required_device m_palette; - - uint8_t m_ttmahjng_port_select; - int m_speakres_vrx; - uint8_t m_flipscreen; - uint8_t m_palette_1; - uint8_t m_palette_2; + : driver_device(mconfig, type, tag) + , m_sn(*this, "snsnd") + , m_sharedram(*this, "sharedram") + , m_videoram1(*this, "videoram1") + , m_videoram2(*this, "videoram2") + , m_palette(*this, "palette") + , m_protection_data(0) + {} DECLARE_WRITE8_MEMBER(out0_w); DECLARE_WRITE8_MEMBER(out1_w); DECLARE_WRITE8_MEMBER(route16_sharedram_w); + DECLARE_READ8_MEMBER(route16_prot_read); DECLARE_READ8_MEMBER(routex_prot_read); DECLARE_WRITE8_MEMBER(ttmahjng_input_port_matrix_w); DECLARE_READ8_MEMBER(ttmahjng_p1_matrix_r); @@ -36,14 +26,27 @@ public: DECLARE_READ8_MEMBER(speakres_in3_r); DECLARE_WRITE8_MEMBER(speakres_out2_w); DECLARE_WRITE8_MEMBER(stratvox_sn76477_w); - - DECLARE_DRIVER_INIT(route16); - DECLARE_DRIVER_INIT(route16a); - DECLARE_DRIVER_INIT(route16c); DECLARE_MACHINE_START(speakres); DECLARE_MACHINE_START(ttmahjng); - virtual void video_start() override; uint32_t screen_update_route16(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_ttmahjng(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +private: + optional_device m_sn; + + required_shared_ptr m_sharedram; + required_shared_ptr m_videoram1; + required_shared_ptr m_videoram2; + required_device m_palette; + uint8_t m_protection_data; + + uint8_t m_ttmahjng_port_select; + int m_speakres_vrx; + uint8_t m_flipscreen; + uint8_t m_palette_1; + uint8_t m_palette_2; + + virtual void video_start() override; + };