From b01afdbf3bcad7fd356647066f34390b2736f0d7 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Mon, 22 May 2017 19:11:48 +0200 Subject: [PATCH] ssfindo.cpp: added preliminary eeprom hook up. tetfight is now playable (coins work). Left as not working since eeprom isn't correctly saved, thus the inputs are screwed on reset. (nw) --- src/mame/drivers/ssfindo.cpp | 124 ++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 60 deletions(-) diff --git a/src/mame/drivers/ssfindo.cpp b/src/mame/drivers/ssfindo.cpp index 45d118b3d02..6560b23586f 100644 --- a/src/mame/drivers/ssfindo.cpp +++ b/src/mame/drivers/ssfindo.cpp @@ -127,6 +127,7 @@ Notes: #include "emu.h" #include "cpu/arm7/arm7.h" #include "cpu/arm7/arm7core.h" +#include "machine/i2cmem.h" #include "screen.h" #include "speaker.h" @@ -223,12 +224,14 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_palette(*this, "palette"), + m_i2cmem(*this, "i2cmem"), m_vram(*this, "vram"), m_flashrom(*this, "flash"), m_io_ps7500(*this, "PS7500") { } required_device m_maincpu; required_device m_palette; + optional_device m_i2cmem; required_shared_ptr m_vram; @@ -432,7 +435,7 @@ READ32_MEMBER(ssfindo_state::PS7500_IO_r) if( m_iocr_hack) { - return (m_io_ps7500->read() & 0x80) | 0x34 | (machine().rand()&3); //eeprom read ? + return (m_io_ps7500->read() & 0x80) | 0x34 | (m_i2cmem->read_sda() ? 0x03 : 0x00); //eeprom read } return (m_io_ps7500->read() & 0x80) | 0x37; @@ -481,27 +484,34 @@ WRITE32_MEMBER(ssfindo_state::PS7500_IO_w) case IRQRQA: m_PS7500_IO[IRQSTA]&=~temp; - break; + break; case IRQMSKA: m_PS7500_IO[IRQMSKA]=(temp&(~2))|0x80; - break; + break; case T1GO: - PS7500_startTimer1(); + PS7500_startTimer1(); break; case T0GO: PS7500_startTimer0(); - break; + break; case VIDEND: case VIDSTART: COMBINE_DATA(&m_PS7500_IO[offset]); m_PS7500_IO[offset]&=0xfffffff0; // qword align - break; + break; case IOCR: + //popmessage("IOLINESW %i = %x @%x\n",offset,data,space.device().safe_pc()); + COMBINE_DATA(&m_PS7500_IO[offset]); + // TODO: correct hook-up + m_i2cmem->write_scl((data & 0x01) ? 1 : 0); + m_i2cmem->write_sda((data & 0x02) ? 1 : 0); + break; + case REFCR: case DRAMCR: case SD0CR: @@ -514,11 +524,8 @@ WRITE32_MEMBER(ssfindo_state::PS7500_IO_w) case T0high: case VIDCR: case VIDINITA: //TODO: bit 30 (last bit) p.105 - COMBINE_DATA(&m_PS7500_IO[offset]); - break; - - - + COMBINE_DATA(&m_PS7500_IO[offset]); + break; } } @@ -532,11 +539,11 @@ READ32_MEMBER(ssfindo_state::io_r) case 0: if(m_PS7500_IO[IOLINES]&1) //bit 0 of IOLINES = flash select ( 5/6 or 3/2 ) adr+=0x400000; - break; + break; case 1: adr+=0x400000*m_flashN; - break; + break; } if(adr<0x400000*2) @@ -636,8 +643,8 @@ static ADDRESS_MAP_START( tetfight_map, AS_PROGRAM, 32, ssfindo_state ) AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_RANGE(0x03200000, 0x032001ff) AM_READWRITE(PS7500_IO_r,PS7500_IO_w) AM_RANGE(0x03400000, 0x03400003) AM_WRITE(FIFO_w) - AM_RANGE(0x03240000, 0x03240003) AM_READ_PORT("DSW") - AM_RANGE(0x03240004, 0x03240007) AM_READ_PORT("IN0") + AM_RANGE(0x03240000, 0x03240003) AM_READ_PORT("IN0") + AM_RANGE(0x03240004, 0x03240007) AM_READ_PORT("IN1") AM_RANGE(0x03240008, 0x0324000b) AM_READ_PORT("DSW2") AM_RANGE(0x03240020, 0x03240023) AM_READWRITE(tetfight_unk_r, tetfight_unk_w) AM_RANGE(0x10000000, 0x14ffffff) AM_RAM AM_SHARE("vram") @@ -719,31 +726,33 @@ static INPUT_PORTS_START( tetfight ) PORT_START("PS7500") PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") - PORT_START("DSW") - PORT_DIPNAME( 0x01, 0x01, "DSW 0" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, "DSW 1" ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, "DSW 2" ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "DSW 3" ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x010, "DSW 4" ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "DSW 5" ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x040, "DSW 6" ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "DSW 7" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN1") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_START("DSW2") PORT_DIPNAME( 0x01, 0x01, "Test Mode" ) @@ -761,25 +770,15 @@ static INPUT_PORTS_START( tetfight ) PORT_DIPNAME( 0x10, 0x010, "DSW 4" ) PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "DSW 5" ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Free_Play ) ) PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x40, 0x040, "DSW 6" ) PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "DSW 7" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("IN0") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 ) //guess - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_DIPNAME( 0x80, 0x80, "Number of rounds" ) + PORT_DIPSETTING( 0x80, "2" ) + PORT_DIPSETTING( 0x00, "1" ) INPUT_PORTS_END @@ -791,6 +790,7 @@ static MACHINE_CONFIG_START( ssfindo ) MCFG_CPU_VBLANK_INT_DRIVER("screen", ssfindo_state, interrupt) + MCFG_24C01_ADD("i2cmem") MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -808,13 +808,17 @@ static MACHINE_CONFIG_DERIVED( ppcar, ssfindo ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(ppcar_map) + + MCFG_DEVICE_REMOVE("i2cmem") MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( tetfight, ssfindo ) +static MACHINE_CONFIG_DERIVED( tetfight, ppcar ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(tetfight_map) + + MCFG_24C02_ADD("i2cmem") MACHINE_CONFIG_END ROM_START( ssfindo ) @@ -829,7 +833,7 @@ ROM_START( ssfindo ) ROM_LOAD16_BYTE( "du3", 0x800000, 0x400000, CRC(d1e8afb2) SHA1(598dfcbba14435a1d0571dcefe0ec62fec657fca) ) ROM_LOAD16_BYTE( "du2", 0x800001, 0x400000, CRC(56998515) SHA1(9b71a44f56a545ff0c1170775c839d21bd01f545) ) - ROM_REGION(0x80, "eeprom", 0 ) /* eeprom */ + ROM_REGION(0x80, "i2cmem", 0 ) /* eeprom */ ROM_LOAD( "24c01a.u36", 0x00, 0x80, CRC(b4f4849b) SHA1(f8f17dc94b2a305048693cfb78d14be57310ce56) ) ROM_REGION(0x10000, "user4", 0 ) /* qdsp code */ @@ -872,19 +876,19 @@ ROM_START( tetfight ) ROM_REGION16_LE(0x1000000, "flash", ROMREGION_ERASEFF ) /* flash roms */ /* nothing? */ - ROM_REGION(0x100, "eeprom", 0 ) /* eeprom */ + ROM_REGION(0x100, "i2cmem", 0 ) /* 24c02 eeprom */ ROM_LOAD( "u1", 0x00, 0x100, CRC(dd207b40) SHA1(6689d9dfa980bdfbd4e4e6cef7973e22ebbfe22e) ) ROM_REGION(0x10000, "user4", 0 ) /* qdsp code */ - ROM_LOAD( "u12", 0x000000, 0x10000, CRC(49976f7b) SHA1(eba5b97b81736f3c184ae0c19f1b10c5ae250d51) ) // = e.u14 on ssfindo + ROM_LOAD( "u12", 0x000000, 0x10000, CRC(49976f7b) SHA1(eba5b97b81736f3c184ae0c19f1b10c5ae250d51) ) // 27c512 = e.u14 on ssfindo ROM_REGION(0x100000, "user5", ROMREGION_ERASE00 )/* qdsp samples */ // probably the same, but wasn't dumped //ROM_LOAD( "1008s-1.u16", 0x000000, 0x100000, CRC(9aef9545) SHA1(f23ef72c3e3667923768dfdd0c5b4951b23dcbcf) ) ROM_REGION(0x100000, "user6", 0 ) /* samples - same internal structure as qdsp samples */ - ROM_LOAD( "u11", 0x000000, 0x80000, CRC(073050f6) SHA1(07f362f3ba468bde2341a99e6b26931d11459a92) ) - ROM_LOAD( "u15", 0x080000, 0x80000, CRC(477f8089) SHA1(8084facb254d60da7983d628d5945d27b9494e65) ) + ROM_LOAD( "u11", 0x000000, 0x80000, CRC(073050f6) SHA1(07f362f3ba468bde2341a99e6b26931d11459a92) ) // 27c040 + ROM_LOAD( "u15", 0x080000, 0x80000, CRC(477f8089) SHA1(8084facb254d60da7983d628d5945d27b9494e65) ) // 27c040 ROM_END DRIVER_INIT_MEMBER(ssfindo_state,common)