From 28d8446c87f4c026170c2e2d3e6283bf4b052e50 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sun, 18 Feb 2018 01:05:06 +0900 Subject: x1_010 : Change m_adr value name to m_xor Because it's actually Address Bit XOR value. (#3211) * x1_010 : m_adr is just address xor, Move this to address map scheme seta.cpp : Configurated M6502 Bankswitching * Revert "x1_010 : m_adr is just address xor, Move this to address map scheme", This has fix code overload. x1_010 : Convert m_xor instead m_adr, it's address xor value. seta.cpp : Convert memcpy to std::copy --- src/devices/sound/x1_010.cpp | 6 ++--- src/devices/sound/x1_010.h | 9 ++++--- src/mame/drivers/seta.cpp | 56 +++++++++++++++++++++++++++++--------------- src/mame/includes/seta.h | 4 ++++ 4 files changed, 48 insertions(+), 27 deletions(-) diff --git a/src/devices/sound/x1_010.cpp b/src/devices/sound/x1_010.cpp index 7cb8c5540bb..226d956c268 100644 --- a/src/devices/sound/x1_010.cpp +++ b/src/devices/sound/x1_010.cpp @@ -91,7 +91,7 @@ x1_010_device::x1_010_device(const machine_config &mconfig, const char *tag, dev device_sound_interface(mconfig, *this), m_region(*this, DEVICE_SELF), m_rate(0), - m_adr(0), + m_xor(0), m_stream(nullptr), m_sound_enable(0), m_base_clock(0) @@ -143,14 +143,14 @@ void x1_010_device::enable_w(int data) READ8_MEMBER( x1_010_device::read ) { - offset ^= m_adr; + offset ^= m_xor; return m_reg[offset]; } WRITE8_MEMBER( x1_010_device::write ) { int channel, reg; - offset ^= m_adr; + offset ^= m_xor; channel = offset/sizeof(X1_010_CHANNEL); reg = offset%sizeof(X1_010_CHANNEL); diff --git a/src/devices/sound/x1_010.h b/src/devices/sound/x1_010.h index a7add7b2057..bc928a44228 100644 --- a/src/devices/sound/x1_010.h +++ b/src/devices/sound/x1_010.h @@ -11,7 +11,7 @@ public: x1_010_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // static configuration - static void set_address(device_t &device, int addr) { downcast(device).m_adr = addr; } + static void set_address_xor(device_t &device, int addr) { downcast(device).m_xor = addr; } DECLARE_READ8_MEMBER ( read ); DECLARE_WRITE8_MEMBER( write ); @@ -36,7 +36,7 @@ private: /* Variables only used here */ required_region_ptr m_region; // ROM int m_rate; // Output sampling rate (Hz) - int m_adr; // address + int m_xor; // address XOR sound_stream * m_stream; // Stream handle int m_sound_enable; // sound output enable/disable uint8_t m_reg[0x2000]; // X1-010 Register & wave form area @@ -49,8 +49,7 @@ private: DECLARE_DEVICE_TYPE(X1_010, x1_010_device) - -#define MCFG_X1_010_ADDRESS(_addr) \ - x1_010_device::set_address(*device, _addr); +#define MCFG_X1_010_ADDRESS_XOR(_addr) \ + x1_010_device::set_address_xor(*device, _addr); #endif // MAME_SOUND_X1_010_H diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp index f031310fd0b..77a9f9d089b 100644 --- a/src/mame/drivers/seta.cpp +++ b/src/mame/drivers/seta.cpp @@ -1393,6 +1393,8 @@ Note: on screen copyright is (c)1998 Coinmaster. #include "jockeyc.lh" #include "setaroul.lh" +#include + #if __uPD71054_TIMER // this mess should be replaced with pit8254, see madshark @@ -3319,10 +3321,7 @@ ADDRESS_MAP_END WRITE8_MEMBER(seta_state::sub_bankswitch_w) { - uint8_t *rom = memregion("sub")->base(); - int bank = data >> 4; - - membank("bank1")->set_base(&rom[bank * 0x4000 + 0xc000]); + m_subbank->set_entry(data >> 4); } WRITE8_MEMBER(seta_state::sub_bankswitch_lockout_w) @@ -3351,7 +3350,7 @@ ADDRESS_MAP_START(seta_state::tndrcade_sub_map) AM_RANGE(0x3000, 0x3001) AM_DEVWRITE("ym2", ym3812_device, write) AM_RANGE(0x5000, 0x57ff) AM_RAM AM_SHARE("sharedram") // Shared RAM AM_RANGE(0x6000, 0x7fff) AM_ROM // ROM - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("subbank") // Banked ROM AM_RANGE(0xc000, 0xffff) AM_ROM // ROM ADDRESS_MAP_END @@ -3370,7 +3369,7 @@ ADDRESS_MAP_START(seta_state::twineagl_sub_map) AM_RANGE(0x1002, 0x1002) AM_READ_PORT("COINS") // Coins AM_RANGE(0x5000, 0x57ff) AM_RAM AM_SHARE("sharedram") // Shared RAM AM_RANGE(0x7000, 0x7fff) AM_ROM // ROM - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("subbank") // Banked ROM AM_RANGE(0xc000, 0xffff) AM_ROM // ROM ADDRESS_MAP_END @@ -3410,7 +3409,7 @@ ADDRESS_MAP_START(seta_state::downtown_sub_map) AM_RANGE(0x1000, 0x1000) AM_WRITE(sub_bankswitch_lockout_w) // ROM Bank + Coin Lockout AM_RANGE(0x5000, 0x57ff) AM_RAM AM_SHARE("sharedram") // Shared RAM AM_RANGE(0x7000, 0x7fff) AM_ROM // ROM - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("subbank") // Banked ROM AM_RANGE(0xc000, 0xffff) AM_ROM // ROM ADDRESS_MAP_END @@ -3451,7 +3450,7 @@ ADDRESS_MAP_START(seta_state::calibr50_sub_map) AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE("x1snd", x1_010_device, read ,write) // Sound AM_RANGE(0x4000, 0x4000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // From Main CPU AM_RANGE(0x4000, 0x4000) AM_WRITE(calibr50_sub_bankswitch_w) // Bankswitching - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("subbank") // Banked ROM AM_RANGE(0xc000, 0xffff) AM_ROM // ROM AM_RANGE(0xc000, 0xc000) AM_WRITE(calibr50_soundlatch2_w) // To Main CPU ADDRESS_MAP_END @@ -3472,7 +3471,7 @@ ADDRESS_MAP_START(seta_state::metafox_sub_map) AM_RANGE(0x1006, 0x1006) AM_READ_PORT("P2") // P2 AM_RANGE(0x5000, 0x57ff) AM_RAM AM_SHARE("sharedram") // Shared RAM AM_RANGE(0x7000, 0x7fff) AM_ROM // ROM - AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") // Banked ROM + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("subbank") // Banked ROM AM_RANGE(0xc000, 0xffff) AM_ROM // ROM ADDRESS_MAP_END @@ -7972,7 +7971,7 @@ MACHINE_CONFIG_START(seta_state::usclssic) MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true) MCFG_SOUND_ADD("x1snd", X1_010, 16000000) /* 16 MHz */ - MCFG_X1_010_ADDRESS(0x1000) + MCFG_X1_010_ADDRESS_XOR(0x1000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END @@ -8032,7 +8031,7 @@ MACHINE_CONFIG_START(seta_state::calibr50) MCFG_GENERIC_LATCH_8_ADD("soundlatch2") MCFG_SOUND_ADD("x1snd", X1_010, 16000000) /* 16 MHz */ - MCFG_X1_010_ADDRESS(0x1000) + MCFG_X1_010_ADDRESS_XOR(0x1000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_CONFIG_END @@ -11700,6 +11699,21 @@ READ16_MEMBER(seta_state::twineagl_debug_r) return 0; } +DRIVER_INIT_MEMBER(seta_state,bank6502) +{ + uint8_t *rom = memregion("sub")->base(); + uint32_t max = (memregion("sub")->bytes() - 0xc000) / 0x4000; + + if (max > 1) // if 6502 ROM is bankswitched(size is larger than 0x4000) + { + m_subbank->configure_entries(0, max, &rom[0xc000], 0x4000); + if (max < 16) + m_subbank->configure_entries(max, 16-max, &rom[0xc000], 0x4000); // Unverified : Bankswitching is Mirrored? + } + else + m_subbank->configure_entries(0, 16, &rom[0xc000], 0); // Not bankswitched : for avoid crashing when accessing bank functions +} + /* Extra RAM ? Check code at 0x00ba90 */ /* 2000F8 = A3 enables it, 2000F8 = 00 disables? see downtown too */ READ16_MEMBER(seta_state::twineagl_200100_r) @@ -11720,6 +11734,7 @@ WRITE16_MEMBER(seta_state::twineagl_200100_w) DRIVER_INIT_MEMBER(seta_state,twineagl) { + DRIVER_INIT_CALL(bank6502); /* debug? */ m_maincpu->space(AS_PROGRAM).install_read_handler(0x800000, 0x8000ff, read16_delegate(FUNC(seta_state::twineagl_debug_r),this)); @@ -11753,6 +11768,7 @@ WRITE16_MEMBER(seta_state::downtown_protection_w) DRIVER_INIT_MEMBER(seta_state,downtown) { + DRIVER_INIT_CALL(bank6502); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x200000, 0x2001ff, read16_delegate(FUNC(seta_state::downtown_protection_r),this), write16_delegate(FUNC(seta_state::downtown_protection_w),this)); } @@ -11773,6 +11789,7 @@ READ16_MEMBER(seta_state::arbalest_debug_r) DRIVER_INIT_MEMBER(seta_state,arbalest) { + DRIVER_INIT_CALL(bank6502); m_maincpu->space(AS_PROGRAM).install_read_handler(0x80000, 0x8000f, read16_delegate(FUNC(seta_state::arbalest_debug_r),this)); } @@ -11801,6 +11818,7 @@ READ16_MEMBER(seta_state::metafox_protection_r) DRIVER_INIT_MEMBER(seta_state,metafox) { + DRIVER_INIT_CALL(bank6502); m_maincpu->space(AS_PROGRAM).install_read_handler(0x21c000, 0x21ffff,read16_delegate(FUNC(seta_state::metafox_protection_r),this)); } @@ -11823,7 +11841,7 @@ DRIVER_INIT_MEMBER(seta_state,blandia) buf[rpos] = rom[rpos*2+1]; } - memcpy( rom, &buf[0], rom_size ); + std::copy( buf.begin(), buf.end(), &rom[0] ); rom = memregion("gfx3")->base() + 0x40000; @@ -11832,7 +11850,7 @@ DRIVER_INIT_MEMBER(seta_state,blandia) buf[rpos] = rom[rpos*2+1]; } - memcpy( rom, &buf[0], rom_size ); + std::copy( buf.begin(), buf.end(), &rom[0] ); } @@ -11870,7 +11888,7 @@ DRIVER_INIT_MEMBER(seta_state,wiggie) len = memregion("maincpu")->bytes(); for (i = 0;i < len;i += 16) { - memcpy(temp,&src[i],16); + std::copy(&src[i],&src[i+16],std::begin(temp)); for (j = 0;j < 16;j++) { static const int convtable[16] = @@ -11920,8 +11938,8 @@ DRIVER_INIT_MEMBER(jockeyc_state,inttoote) ***************************************************************************/ /* 68000 + 65C02 */ -GAME( 1987, tndrcade, 0, tndrcade, tndrcade, seta_state, 0, ROT270, "Seta (Taito license)", "Thundercade / Twin Formation" , 0) // Title/License: DSW -GAME( 1987, tndrcadej, tndrcade, tndrcade, tndrcadj, seta_state, 0, ROT270, "Seta (Taito license)", "Tokusyu Butai U.A.G. (Japan)" , 0) // License: DSW +GAME( 1987, tndrcade, 0, tndrcade, tndrcade, seta_state, bank6502, ROT270, "Seta (Taito license)", "Thundercade / Twin Formation" , 0) // Title/License: DSW +GAME( 1987, tndrcadej, tndrcade, tndrcade, tndrcadj, seta_state, bank6502, ROT270, "Seta (Taito license)", "Tokusyu Butai U.A.G. (Japan)" , 0) // License: DSW GAME( 1988, twineagl, 0, twineagl, twineagl, seta_state, twineagl, ROT270, "Seta (Taito license)", "Twin Eagle - Revenge Joe's Brother" , 0) // Country/License: DSW @@ -11930,9 +11948,9 @@ GAME( 1989, downtown2, downtown, downtown, downtown, seta_state, downtown, GAME( 1989, downtownj, downtown, downtown, downtown, seta_state, downtown, ROT270, "Seta", "DownTown / Mokugeki (joystick hack)" , 0) // Country/License: DSW GAME( 1989, downtownp, downtown, downtown, downtown, seta_state, downtown, ROT270, "Seta", "DownTown / Mokugeki (prototype)" , 0) // Country/License: DSW -GAME( 1989, usclssic, 0, usclssic, usclssic, seta_state, 0, ROT270, "Seta", "U.S. Classic" , 0) // Country/License: DSW +GAME( 1989, usclssic, 0, usclssic, usclssic, seta_state, bank6502, ROT270, "Seta", "U.S. Classic" , 0) // Country/License: DSW -GAME( 1989, calibr50, 0, calibr50, calibr50, seta_state, 0, ROT270, "Athena / Seta", "Caliber 50" , 0) // Country/License: DSW +GAME( 1989, calibr50, 0, calibr50, calibr50, seta_state, bank6502, ROT270, "Athena / Seta", "Caliber 50" , 0) // Country/License: DSW GAME( 1989, arbalest, 0, metafox, arbalest, seta_state, arbalest, ROT270, "Seta", "Arbalester" , 0) // Country/License: DSW @@ -11975,7 +11993,7 @@ GAME( 1992, neobattl, 0, umanclub, neobattl, seta_state, 0, GAME( 1992, umanclub, 0, umanclub, umanclub, seta_state, 0, ROT0, "Banpresto / Tsuburaya Productions", "Ultraman Club - Tatakae! Ultraman Kyoudai!!", 0 ) -GAME( 1992, zingzip, 0, zingzip, zingzip, seta_state, 0, ROT270, "Allumer / Tecmo", "Zing Zing Zip", 0 ) +GAME( 1992, zingzip, 0, zingzip, zingzip, seta_state, 0, ROT270, "Allumer / Tecmo", "Zing Zing Zip", 0 ) // This set has Chinese Characters in Title screen, it distributed for Chinese market/or Title: DSW? GAME( 1992, zingzipbl, zingzip, zingzipbl, zingzip, seta_state, 0, ROT270, "bootleg", "Zing Zing Zip (bootleg)", MACHINE_NOT_WORKING ) GAME( 1993, atehate, 0, atehate, atehate, seta_state, 0, ROT0, "Athena", "Athena no Hatena ?", 0 ) diff --git a/src/mame/includes/seta.h b/src/mame/includes/seta.h index e61ba19af91..8ef859507d7 100644 --- a/src/mame/includes/seta.h +++ b/src/mame/includes/seta.h @@ -69,6 +69,7 @@ public: m_vctrl_2(*this,"vctrl_2"), m_paletteram(*this,"paletteram"), m_paletteram2(*this,"paletteram2"), + m_subbank(*this,"subbank"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { } @@ -104,6 +105,8 @@ public: optional_shared_ptr m_paletteram; optional_shared_ptr m_paletteram2; + optional_memory_bank m_subbank; + required_device m_gfxdecode; required_device m_palette; @@ -186,6 +189,7 @@ public: DECLARE_READ8_MEMBER(dsw1_r); DECLARE_READ8_MEMBER(dsw2_r); DECLARE_READ16_MEMBER(extra_r); + DECLARE_DRIVER_INIT(bank6502); DECLARE_DRIVER_INIT(downtown); DECLARE_DRIVER_INIT(rezon); DECLARE_DRIVER_INIT(twineagl); -- cgit v1.2.3