diff options
Diffstat (limited to 'src/mame/drivers/thoop2.cpp')
-rw-r--r-- | src/mame/drivers/thoop2.cpp | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/src/mame/drivers/thoop2.cpp b/src/mame/drivers/thoop2.cpp index 57b8795c23f..a45f8a92c42 100644 --- a/src/mame/drivers/thoop2.cpp +++ b/src/mame/drivers/thoop2.cpp @@ -8,10 +8,8 @@ Driver by Manuel Abadia <emumanu+mame@gmail.com> updated by Peter Ferrie <peter.ferrie@gmail.com> -Very similar to maniacsq and biomtoy but protected :_( -The DS5002FP has up to 128 KB undumped gameplay code -pf: its presence might be a distraction, since the game runs at least partially without it -pf: but some gameplay bugs - sprite positioning is incorrect, no enemies, jump animation never completes +Game crashes at first boss even with DS5002FP emulation +maybe bad dump of DS5002FP rom, maybe CPU bugs ***************************************************************************/ @@ -19,6 +17,7 @@ pf: but some gameplay bugs - sprite positioning is incorrect, no enemies, jump a #include "includes/thoop2.h" #include "cpu/m68000/m68000.h" +#include "cpu/mcs51/mcs51.h" #include "machine/watchdog.h" #include "sound/okim6295.h" #include "screen.h" @@ -56,13 +55,42 @@ WRITE16_MEMBER(thoop2_state::coin_w) /* 05b unknown */ } -/* pretend that it's there */ +/*============================================================================ + DS5002FP + ============================================================================*/ -READ16_MEMBER(thoop2_state::DS5002FP_R) +READ8_MEMBER(thoop2_state::dallas_share_r) { - return 0x55aa; + uint8_t *shareram = (uint8_t *)m_shareram.target(); + return shareram[BYTE_XOR_BE(offset)]; } +WRITE8_MEMBER(thoop2_state::dallas_share_w) +{ + uint8_t *shareram = (uint8_t *)m_shareram.target(); + shareram[BYTE_XOR_BE(offset)] = data; +} + +READ8_MEMBER(thoop2_state::dallas_ram_r) +{ + return m_mcu_ram[offset]; +} + +WRITE8_MEMBER(thoop2_state::dallas_ram_w) +{ + m_mcu_ram[offset] = data; +} + +static ADDRESS_MAP_START( dallas_rom, AS_PROGRAM, 8, thoop2_state ) + AM_RANGE(0x0000, 0x7fff) AM_READWRITE(dallas_ram_r, dallas_ram_w) /* Code in NVRAM */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dallas_ram, AS_IO, 8, thoop2_state ) + AM_RANGE(0x08000, 0x0ffff) AM_READWRITE(dallas_share_r, dallas_share_w) /* confirmed that 0x8000 - 0xffff is a window into 68k shared RAM */ + AM_RANGE(0x10000, 0x17fff) AM_READWRITE(dallas_ram_r, dallas_ram_w) /* yes, the games access it as data and use it for temporary storage!! */ +ADDRESS_MAP_END + + static ADDRESS_MAP_START( thoop2_map, AS_PROGRAM, 16, thoop2_state ) AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram") /* Video RAM */ @@ -78,9 +106,8 @@ static ADDRESS_MAP_START( thoop2_map, AS_PROGRAM, 16, thoop2_state ) AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */ AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) /* OKI6295 data register */ AM_RANGE(0x70000a, 0x70005b) AM_WRITE(coin_w) /* Coin Counters + Coin Lockout */ - AM_RANGE(0xfeff00, 0xfeff01) AM_READ(DS5002FP_R) - AM_RANGE(0xfeff02, 0xfeff03) AM_WRITENOP /* pf: 0xfeff02 and 0xfeff03 need to remain zero always */ - AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM (partially shared with DS5002FP) */ + AM_RANGE(0xfe0000, 0xfe7fff) AM_RAM /* Work RAM */ + AM_RANGE(0xfe8000, 0xfeffff) AM_RAM AM_SHARE("shareram") /* Work RAM (shared with D5002FP) */ ADDRESS_MAP_END @@ -209,6 +236,13 @@ static MACHINE_CONFIG_START( thoop2 ) MCFG_CPU_PROGRAM_MAP(thoop2_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", thoop2_state, irq6_line_hold) + MCFG_CPU_ADD("mcu", DS5002FP, XTAL_24MHz/2) /* ? */ + MCFG_DS5002FP_CONFIG( 0x79, 0x00, 0x80 ) /* default config verified on chip */ + MCFG_CPU_PROGRAM_MAP(dallas_rom) + MCFG_CPU_IO_MAP(dallas_ram) + + MCFG_QUANTUM_PERFECT_CPU("mcu") + MCFG_WATCHDOG_ADD("watchdog") /* video hardware */ @@ -239,7 +273,7 @@ ROM_START( thoop2 ) ROM_LOAD16_BYTE( "th2c22.040", 0x000001, 0x080000, CRC(837205b7) SHA1(f78b90c2be0b4dddaba26f074ea00eff863cfdb2) ) ROM_REGION( 0x10000, "mcu", 0 ) /* DS5002FP code */ - ROM_LOAD( "thoop2_ds5002fp.bin", 0x00000, 0x8000, NO_DUMP ) + ROM_LOAD( "thoop2_ds5002fp.bin", 0x00000, 0x8000, BAD_DUMP CRC(67cbf579) SHA1(40a543b9d0f57d374ceccb720be20b9e42ecc91a) ) /* marked as BAD_DUMP until a 2nd board is used to verify, also because game currently crashes */ ROM_REGION( 0x800000, "gfx1", 0 ) ROM_LOAD( "th2-h8.32m", 0x000000, 0x400000, CRC(60328a11) SHA1(fcdb374d2fc7ef5351a4181c471d192199dc2081) ) |