From 4abe651f7f1b318852786dcaa2aef2bbe4094225 Mon Sep 17 00:00:00 2001 From: arcadez2003 <51386955+arcadez2003@users.noreply.github.com> Date: Mon, 28 Oct 2024 20:15:57 +0000 Subject: [PATCH] Add support for some arcade bootlegs using genesis hardware (#176) * Add support for some arcade bootlegs using genesis hardware Aladdin, Bare Knuckle 2 + 3 and Sonic The Hedgehog 2 Not enabled in the build as yet. * Whoops * Enable the new games in the build --- src/drivers/topshoot.c | 451 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 449 insertions(+), 2 deletions(-) diff --git a/src/drivers/topshoot.c b/src/drivers/topshoot.c index 7f6cede0..5fbef32a 100644 --- a/src/drivers/topshoot.c +++ b/src/drivers/topshoot.c @@ -195,6 +195,242 @@ INPUT_PORTS_START( sbubsm ) // no service mode here? INPUT_PORTS_END +INPUT_PORTS_START( aladbl ) + PORT_START /* Joypad 1 (3 button + start) NOT READ DIRECTLY */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Throw") // a + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Sword") // b + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Jump") // c + + PORT_START /* Joypad 2 (3 button + start) Not used */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START /* 3rd I/O port */ + + /* As I don't know how it is on real hardware, this is more a guess than anything */ + PORT_START /* MCU hooked up via readinputport (3) */ + PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) ) /* code at 0x1b2a50 - unsure if there are so many settings */ + PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) + PORT_DIPSETTING( 0x05, DEF_STR( 1C_5C ) ) + PORT_DIPSETTING( 0x06, DEF_STR( 1C_6C ) ) + PORT_DIPSETTING( 0x07, DEF_STR( 1C_7C ) ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* to avoid it being changed and corrupting Coinage settings */ + PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) ) /* code at 0x1b2680 */ + PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) /* "PRACTICE" */ + PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) /* "NORMAL" */ + PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) /* "DIFFICULT" */ + PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) /* needed to avoid credits getting mad */ +INPUT_PORTS_END + +INPUT_PORTS_START( barek3 ) + PORT_START /* IN0 player 1 controller */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Button A") // a + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Button B") // b + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Button C") // c + + PORT_START /* IN1 player 2 controller */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Button A") // a + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Button B") // b + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Button C") // c + + PORT_START + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) + + PORT_START + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 1C_5C ) ) + PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x18, "1" ) + PORT_DIPSETTING( 0x10, "2" ) + PORT_DIPSETTING( 0x08, "3" ) + PORT_DIPSETTING( 0x00, "4" ) + PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Difficulty ) ) + PORT_DIPSETTING( 0x60, DEF_STR( Very_Easy ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0xe0, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) ) +INPUT_PORTS_END + +INPUT_PORTS_START( barek2ch ) + PORT_START /* IN0 player 1 controller */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + + PORT_START /* IN1 player 2 controller */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + + PORT_START + PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) // apparently no use for these + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) + + PORT_START + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 1C_5C ) ) + PORT_DIPNAME( 0x08, 0x08, "SW1:4" ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, "SW1:5" ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, "SW1:6" ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "SW1:7" ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "SW1:8" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START + PORT_DIPNAME( 0x01, 0x01, "SW2:1" ) // at least some of the first 3 seem to control difficulty (enemies attack later / less frequently by switching these) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "SW2:2" ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, "SW2:3" ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x18, "1" ) + PORT_DIPSETTING( 0x10, "2" ) + PORT_DIPSETTING( 0x08, "3" ) + PORT_DIPSETTING( 0x00, "4" ) + PORT_DIPNAME( 0xe0, 0xe0, "Starting Level" ) + PORT_DIPSETTING( 0xe0, "1" ) + PORT_DIPSETTING( 0xc0, "2" ) + PORT_DIPSETTING( 0xa0, "3" ) + PORT_DIPSETTING( 0x80, "4" ) + PORT_DIPSETTING( 0x60, "5" ) + PORT_DIPSETTING( 0x40, "6" ) + PORT_DIPSETTING( 0x20, "7" ) + PORT_DIPSETTING( 0x00, "8" ) + + PORT_START // present on PCB but there doesn't seem to be any read for them + PORT_DIPNAME( 0x01, 0x01, "SW3:1" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "SW3:2" ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, "SW3:3" ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "SW3:4" ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, "SW3:5" ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, "SW3:6") + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "SW3:7" ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "SW3:8" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +INPUT_PORTS_START( sonic2mb ) + PORT_START /* IN0 player 1 controller */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) + + PORT_START /* Joypad 2 (3 button + start) Not used */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START /* 3rd I/O port */ + + PORT_START /* DSW via readinputport 3 */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x00fc, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_DIPNAME( 0x0300, 0x0200, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x0000, "1" ) + PORT_DIPSETTING( 0x0100, "2" ) + PORT_DIPSETTING( 0x0200, "3" ) + PORT_DIPSETTING( 0x0300, "4" ) + PORT_DIPNAME( 0x3c00, 0x2000, "Timer Speed" ) + PORT_DIPSETTING( 0x3c00, "0 (Slowest)" ) + PORT_DIPSETTING( 0x3800, "1" ) + PORT_DIPSETTING( 0x3400, "2" ) + PORT_DIPSETTING( 0x3000, "3" ) + PORT_DIPSETTING( 0x2c00, "4" ) + PORT_DIPSETTING( 0x2800, "5" ) + PORT_DIPSETTING( 0x2400, "6" ) + PORT_DIPSETTING( 0x2000, "7" ) + PORT_DIPSETTING( 0x1c00, "8" ) + PORT_DIPSETTING( 0x1800, "9" ) + PORT_DIPSETTING( 0x1400, "10" ) + PORT_DIPSETTING( 0x1000, "11" ) + PORT_DIPSETTING( 0x0c00, "12" ) + PORT_DIPSETTING( 0x0800, "13" ) + PORT_DIPSETTING( 0x0400, "14" ) + PORT_DIPSETTING( 0x0000, "15 (Fastest)" ) + PORT_DIPNAME( 0x4000, 0x4000, "SW1:7" ) + PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x8000, 0x8000, "SW1:8" ) + PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) +INPUT_PORTS_END + static ADDRESS_MAP_START( topshoot_readmem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x000000, 0x0fffff) AM_READ(MRA16_ROM) /* Cartridge Program Rom */ // AM_RANGE(0x200000, 0x20007f) AM_READ(MRA16_RAM) @@ -247,6 +483,53 @@ static ADDRESS_MAP_START( sbubsm_writemem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0xff0000, 0xffffff) AM_WRITE(MWA16_RAM) AM_BASE(&genesis_68k_ram)/* Main Ram */ ADDRESS_MAP_END +static ADDRESS_MAP_START( barek2ch_readmem, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x1fffff) AM_READ(MRA16_ROM) /* Cartridge Program Rom */ + AM_RANGE(0x202000, 0x2023ff) AM_READ(MRA16_RAM) + AM_RANGE(0xa10000, 0xa1001f) AM_READ(genesis_68000_io_r) /* Genesis Input */ + AM_RANGE(0xa11000, 0xa11203) AM_READ(genesis_ctrl_r) + AM_RANGE(0xa00000, 0xa0ffff) AM_READ(genesis_68k_to_z80_r) + AM_RANGE(0xc00000, 0xc0001f) AM_READ(genesis_vdp_r) /* VDP Access */ + AM_RANGE(0xe00000, 0xe1ffff) AM_READ(MRA16_BANK3) + AM_RANGE(0xfe0000, 0xfeffff) AM_READ(MRA16_BANK4) + AM_RANGE(0xff0000, 0xffffff) AM_READ(MRA16_RAM) /* Main Ram */ +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( barek2ch_writemem, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x1fffff) AM_WRITE(MWA16_ROM) /* Cartridge Program Rom */ +// AM_RANGE(0x200000, 0x20007f) AM_WRITE(MWA16_RAM) + AM_RANGE(0x200000, 0x2023ff) AM_WRITE(MWA16_RAM) // tested + AM_RANGE(0xa10000, 0xa1001f) AM_WRITE(genesis_68000_io_w) AM_BASE(&genesis_io_ram) /* Genesis Input */ + AM_RANGE(0xa11000, 0xa11203) AM_WRITE(genesis_ctrl_w) + AM_RANGE(0xa00000, 0xa0ffff) AM_WRITE(megaplay_68k_to_z80_w) + AM_RANGE(0xc00000, 0xc0001f) AM_WRITE(genesis_vdp_w) /* VDP Access */ +// AM_RANGE(0xc00010, 0xc00017) AM_WRITE(sn76489_w) /* SN76489 Access */ + AM_RANGE(0xfe0000, 0xfeffff) AM_WRITE(MWA16_BANK4) + AM_RANGE(0xff0000, 0xffffff) AM_WRITE(MWA16_RAM) AM_BASE(&genesis_68k_ram)/* Main Ram */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( barek3_readmem, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x3fffff) AM_READ(MRA16_ROM) /* Cartridge Program Rom */ + AM_RANGE(0xa10000, 0xa1001f) AM_READ(genesis_68000_io_r) /* Genesis Input */ + AM_RANGE(0xa11000, 0xa11203) AM_READ(genesis_ctrl_r) + AM_RANGE(0xa00000, 0xa0ffff) AM_READ(genesis_68k_to_z80_r) + AM_RANGE(0xc00000, 0xc0001f) AM_READ(genesis_vdp_r) /* VDP Access */ + AM_RANGE(0xfe0000, 0xfeffff) AM_READ(MRA16_BANK3) /* Main Ram */ + AM_RANGE(0xff0000, 0xffffff) AM_READ(MRA16_RAM) /* Main Ram */ +ADDRESS_MAP_END + +static ADDRESS_MAP_START( barek3_writemem, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x3fffff) AM_WRITE(MWA16_ROM) /* Cartridge Program Rom */ + AM_RANGE(0xa10000, 0xa1001f) AM_WRITE(genesis_68000_io_w) AM_BASE(&genesis_io_ram) /* Genesis Input */ + AM_RANGE(0xa11000, 0xa11203) AM_WRITE(genesis_ctrl_w) + AM_RANGE(0xa00000, 0xa0ffff) AM_WRITE(megaplay_68k_to_z80_w) + AM_RANGE(0xc00000, 0xc0001f) AM_WRITE(genesis_vdp_w) /* VDP Access */ +// AM_RANGE(0xc00010, 0xc00017) AM_WRITE(sn76489_w) /* SN76489 Access */ + AM_RANGE(0xfe0000, 0xfeffff) AM_WRITE(MWA16_BANK3) /* Main Ram */ + AM_RANGE(0xff0000, 0xffffff) AM_WRITE(MWA16_RAM) AM_BASE(&genesis_68k_ram)/* Main Ram */ +ADDRESS_MAP_END + static ADDRESS_MAP_START( genesis_z80_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_BANK1) AM_RANGE(0x2000, 0x3fff) AM_READ(MRA8_BANK2) /* mirror */ @@ -327,6 +610,27 @@ static MACHINE_DRIVER_START( sbubsm ) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_DRIVER_END +static MACHINE_DRIVER_START( barek2ch ) + + MDRV_IMPORT_FROM( genesis_base ) + MDRV_CPU_MODIFY("main") + MDRV_CPU_PROGRAM_MAP(barek2ch_readmem,barek2ch_writemem) + + /* sound hardware */ + MDRV_SOUND_ADD(SN76496, MASTER_CLOCK/15) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_DRIVER_END + +static MACHINE_DRIVER_START( barek3 ) + + MDRV_IMPORT_FROM( genesis_base ) + MDRV_CPU_MODIFY("main") + MDRV_CPU_PROGRAM_MAP(barek3_readmem,barek3_writemem) + + /* sound hardware */ + MDRV_SOUND_ADD(SN76496, MASTER_CLOCK/15) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_DRIVER_END ROM_START( topshoot ) /* Top Shooter (c)1995 Sun Mixing */ ROM_REGION( 0x200000, REGION_CPU1, 0 ) @@ -343,6 +647,38 @@ ROM_START( sbubsm ) /* Super Bubble Bobble (c)1996 Sun Mixing */ // ROM_LOAD( "89c51.bin", 0x0000, 0x1000, NO_DUMP ) ROM_END +ROM_START( barek2ch ) // all 27c4001 + ROM_REGION( 0x400000, REGION_CPU1, 0 ) + ROM_LOAD16_BYTE( "u14", 0x000001, 0x080000, CRC(b0ee177f) SHA1(d63e6ee30fe7f4aaab098d3920eabc456730b2c5) ) + ROM_LOAD16_BYTE( "u15", 0x000000, 0x080000, CRC(09264195) SHA1(c5439731d932c90a57d68c4d82c9ebed8a01bd53) ) + ROM_LOAD16_BYTE( "u16", 0x100001, 0x080000, CRC(6c814fc4) SHA1(edaf5117b19d3fb40218c5f7c4b5099c9189f1be) ) + ROM_LOAD16_BYTE( "u17", 0x100000, 0x080000, CRC(cae1922e) SHA1(811c2164b6c467a49af4b0d22f151cd13c9efbc9) ) +ROM_END + +ROM_START( barek3mb ) + ROM_REGION( 0x400000, REGION_CPU1, 0 ) // 68000 Code + ROM_LOAD16_BYTE( "6.u19", 0x000000, 0x080000, CRC(2de19519) SHA1(f5fcef1da8b5370e399f0451382e3c6e7754c9c8) ) + ROM_LOAD16_BYTE( "3.u18", 0x000001, 0x080000, CRC(db900e82) SHA1(172a4fe01a0ffd1ea3aed74f2c58234fd55b876d) ) + ROM_LOAD16_BYTE( "4.u15", 0x100000, 0x080000, CRC(6353b4b1) SHA1(9f89a2f02170496ca798b89e37e1f2bae0e9155d) ) + ROM_LOAD16_BYTE( "1.u14", 0x100001, 0x080000, CRC(24d31e12) SHA1(64c1b968e1ee5d0355d902e280f33e4466f27b07) ) + ROM_LOAD16_BYTE( "5.u17", 0x200000, 0x080000, CRC(0feb974f) SHA1(ed1a25b6f1669dc6061d519985b6373fa89176c7) ) + ROM_LOAD16_BYTE( "2.u16", 0x200001, 0x080000, CRC(bba4a585) SHA1(32c59729943d7b4c1a39f2a2b0dae9ce16991e9c) ) +ROM_END + +ROM_START( aladmdb ) + ROM_REGION( 0x400000, REGION_CPU1, 0 ) /* 68000 Code */ + ROM_LOAD16_BYTE( "m1.bin", 0x000001, 0x080000, CRC(5e2671e4) SHA1(54705c7614fc7b5a1065478fa41f51dd1d8045b7) ) + ROM_LOAD16_BYTE( "m2.bin", 0x000000, 0x080000, CRC(142a0366) SHA1(6c94aa9936cd11ccda503b52019a6721e64a32f0) ) + ROM_LOAD16_BYTE( "m3.bin", 0x100001, 0x080000, CRC(0feeeb19) SHA1(bd567a33077ab9997871d21736066140d50e3d70) ) + ROM_LOAD16_BYTE( "m4.bin", 0x100000, 0x080000, CRC(bc712661) SHA1(dfd554d000399e17b4ddc69761e572195ed4e1f0)) +ROM_END + +ROM_START( sonic2mb ) + ROM_REGION( 0x400000, REGION_CPU1, 0 ) // 68000 Code + ROM_LOAD16_BYTE( "m1", 0x000001, 0x080000, CRC(7b40aa24) SHA1(247882cd1f412366d61aeb4d85bbeefd5f108e1d) ) + ROM_LOAD16_BYTE( "m2", 0x000000, 0x080000, CRC(84b3f758) SHA1(19846b9d951db6f78f3e155d33f1b6349fb87f1a) ) +ROM_END + static READ16_HANDLER( vdp_fake_r ) { return rand(); @@ -400,6 +736,117 @@ DRIVER_INIT(topshoot) memory_set_bankptr(4, genesis_68k_ram ); } +DRIVER_INIT( barek3 ) +{ + UINT8 *rom = memory_region(REGION_CPU1); + int x; + + for (x = 0x00001; x < 0x300000; x += 2) + { + rom[x] = BITSWAP8(rom[x], 6,2,4,0,7,1,3,5); + } + + memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x380070, 0x380071, 0, 0, input_port_2_word_r); + memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x380078, 0x380079, 0, 0, input_port_3_word_r); + + genesis_region = 0x00; /* read via io */ +} + +WRITE16_HANDLER( aladbl_w ) +{ + /* + Values returned from the log file : + - aladbl_w : 1b2a6c - data = 6600 (each time a coin is inserted) + - aladbl_w : 1b2a82 - data = 0000 (each time a coin is inserted) + - aladbl_w : 1b2d18 - data = aa00 (only once on reset) + - aladbl_w : 1b2d42 - data = 0000 (only once on reset) + */ + logerror("aladbl_w : %06x - data = %04x\n",activecpu_get_pc(),data); +} + + +READ16_HANDLER( aladbl_r ) +{ + if (activecpu_get_pc()==0x1b2a56) + { + static UINT16 mcu_port; + + mcu_port = readinputport(3); + + if(mcu_port & 0x100) + return ((mcu_port & 0x0f) | 0x100); // coin inserted, calculate the number of coins + else + return (0x100); //MCU status, needed if you fall into a pitfall + } + if (activecpu_get_pc()==0x1b2a72) return 0x0000; + if (activecpu_get_pc()==0x1b2d24) return (readinputport(3) & 0x00f0) | 0x1200; // difficulty + if (activecpu_get_pc()==0x1b2d4e) return 0x0000; + + logerror("aladbl_r : %06x\n",activecpu_get_pc()); + + return 0x0000; +} + +#define ENERGY_CONSOLE_MODE 1 + +DRIVER_INIT( aladbl ) +{ +/* + * Game does a check @ 1afc00 with work ram fff57c that makes it play like it was intended (i.e. 8 energy hits instead of 2) +*/ + #if ENERGY_CONSOLE_MODE + UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1); + rom[0x1afc08/2] = 0x6600; + #endif + + // 220000 = writes to mcu? 330000 = reads? + memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x220000, 0x220001, 0, 0, aladbl_w); + memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x330000, 0x330001, 0, 0, aladbl_r); + + genesis_region = 0x00; /* read via io */ +} + +DRIVER_INIT( barek2ch ) +{ + UINT16 *src = (UINT16 *)memory_region(REGION_CPU1); + int i; + + for (i = 0x000000; i < 0x200000 / 2; i++) + src[i] = BITSWAP16(src[i], 8, 11, 10, 13, 12, 14, 15, 9, 7, 6, 5, 4, 3, 2, 1, 0); + + src[0x06 / 2] = 0x0210; // TODO: why is this needed? + + memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x380070, 0x380071, 0, 0, input_port_2_word_r ); + memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x380078, 0x380079, 0, 0, input_port_3_word_r ); + memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x38007a, 0x38007b, 0, 0, input_port_4_word_r ); + + genesis_region = 0x00; /* read via io */ + + memory_set_bankptr(3, memory_region(REGION_CPU1) ); + memory_set_bankptr(4, genesis_68k_ram ); +} + +DRIVER_INIT( sonic2mb ) +{ + /* 100000 = writes to unpopulated MCU? */ + memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x100000, 0x100001, 0, 0, aladbl_w); + memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x300000, 0x300001, 0, 0, input_port_3_word_r); + + + genesis_region = 0x00; /* read via io */ + + memory_set_bankptr(3, memory_region(REGION_CPU1) ); + memory_set_bankptr(4, genesis_68k_ram ); +} + + /* Sun Mixing Hardware, very close to actual Genesis */ -GAME( 1995, topshoot, 0, topshoot, topshoot, topshoot, ROT0, "Sun Mixing", "Top Shooter", 0 ) -GAME( 1996, sbubsm, 0, sbubsm, sbubsm, sbubsm, ROT0, "Sun Mixing", "Super Bubble Bobble (Sun Mixing, Mega Drive clone hardware)", 0 ) +GAME( 1995, topshoot, 0, topshoot, topshoot, topshoot, ROT0, "Sun Mixing", "Top Shooter", 0 ) +GAME( 1996, sbubsm, 0, sbubsm, sbubsm, sbubsm, ROT0, "Sun Mixing", "Super Bubble Bobble (Sun Mixing, Mega Drive clone hardware)", 0 ) + +/* Bootlegs Using Genesis Hardware */ +GAME( 1993, aladmdb, 0, barek3, aladbl, aladbl, ROT0, "bootleg / Sega", "Aladdin (bootleg of Japanese Megadrive version)", 0 ) +GAME( 1993, sonic2mb, 0, barek2ch, sonic2mb, sonic2mb, ROT0, "bootleg / Sega", "Sonic The Hedgehog 2 (bootleg of Mega Drive version)", 0 ) +GAME( 1994, barek2ch, 0, barek2ch, barek2ch, barek2ch, ROT0, "bootleg / Sega", "Bare Knuckle II (Chinese bootleg of Megadrive version)", 0 ) +GAME( 1994, barek3mb, 0, barek3, barek3, barek3, ROT0, "bootleg / Sega", "Bare Knuckle III (bootleg of Megadrive version)", 0 ) +