diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c index 3ab3fd09f17..da94a35d40a 100644 --- a/src/mame/drivers/deco32.c +++ b/src/mame/drivers/deco32.c @@ -362,7 +362,7 @@ READ32_MEMBER(deco32_state::deco32_71_r) READ32_MEMBER(deco32_state::captaven_soundcpu_r) { /* Top byte - top bit low == sound cpu busy, bottom word is dips */ - return 0xffff0000 | ioport("DSW")->read(); + return 0xffff0000 | ioport("DSW2")->read(); } READ32_MEMBER(deco32_state::fghthist_control_r) @@ -696,8 +696,9 @@ static ADDRESS_MAP_START( captaven_map, AS_PROGRAM, 32, deco32_state ) AM_RANGE(0x110000, 0x111fff) AM_READWRITE(deco32_spriteram_r, deco32_spriteram_w) AM_RANGE(0x120000, 0x127fff) AM_RAM AM_SHARE("ram") /* Main RAM */ - AM_RANGE(0x128000, 0x128fff) AM_DEVREAD("ioprot", deco146_device,captaven_prot_r) - AM_RANGE(0x1280c8, 0x1280cb) AM_WRITE(deco32_sound_w) +// AM_RANGE(0x128000, 0x128fff) AM_DEVREAD("ioprot", deco146_device,captaven_prot_r) +// AM_RANGE(0x1280c8, 0x1280cb) AM_WRITE(deco32_sound_w) + AM_RANGE(0x128000, 0x12ffff) AM_READWRITE16(dg_protection_region_0_146_r, dg_protection_region_0_146_w, 0x0000ffff) AM_RANGE(0x130000, 0x131fff) AM_RAM_WRITE(deco32_nonbuffered_palette_w) AM_SHARE("paletteram") /* Palette RAM */ AM_RANGE(0x148000, 0x14800f) AM_READWRITE(deco32_irq_controller_r, deco32_irq_controller_w) @@ -848,7 +849,7 @@ static ADDRESS_MAP_START( dragngun_map, AS_PROGRAM, 32, dragngun_state ) AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram") // AM_RANGE(0x120000, 0x120fff) AM_DEVREAD("ioprot", deco146_device, dragngun_prot_r) - AM_RANGE(0x120000, 0x127fff) AM_READWRITE16(dg_protection_region_0_146_r, dg_protection_region_0_146_w, 0x0000ffff) AM_MIRROR(0xff000000) + AM_RANGE(0x120000, 0x127fff) AM_READWRITE16(dg_protection_region_0_146_r, dg_protection_region_0_146_w, 0x0000ffff) // AM_RANGE(0x1204c0, 0x1204c3) AM_WRITE(deco32_sound_w) AM_RANGE(0x128000, 0x12800f) AM_READWRITE(deco32_irq_controller_r, deco32_irq_controller_w) @@ -898,7 +899,7 @@ static ADDRESS_MAP_START( lockload_map, AS_PROGRAM, 32, dragngun_state ) AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_SHARE("ram") // AM_RANGE(0x120000, 0x120fff) AM_DEVREAD("ioprot", deco146_device, dragngun_prot_r) // AM_RANGE(0x1204c0, 0x1204c3) AM_WRITE(deco32_sound_w) - AM_RANGE(0x120000, 0x127fff) AM_READWRITE16(dg_protection_region_0_146_r, dg_protection_region_0_146_w, 0x0000ffff) AM_MIRROR(0xff000000) + AM_RANGE(0x120000, 0x127fff) AM_READWRITE16(dg_protection_region_0_146_r, dg_protection_region_0_146_w, 0x0000ffff) AM_RANGE(0x128000, 0x12800f) AM_READWRITE(deco32_irq_controller_r, deco32_irq_controller_w) @@ -1117,7 +1118,7 @@ COIN1n adds 100 energy points (based on "Coinage") for player n when ingame if e */ static INPUT_PORTS_START( captaven ) - PORT_START("IN0") + PORT_START("INPUTS") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) @@ -1135,7 +1136,7 @@ static INPUT_PORTS_START( captaven ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) - PORT_START("IN1") + PORT_START("DSW") // not dsw but the prot code expects dsw PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) @@ -1153,25 +1154,14 @@ static INPUT_PORTS_START( captaven ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("IN2") + PORT_START("SYSTEM") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN4 ) - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("DSW") /* Dip switch bank 1 */ + + PORT_START("DSW2") /* Dip switch bank 1 */ PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) @@ -1756,6 +1746,7 @@ static MACHINE_CONFIG_START( captaven, deco32_state ) decospr_device::set_pri_callback(*device, captaven_pri_callback); MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb) MCFG_VIDEO_START_OVERRIDE(deco32_state,captaven) diff --git a/src/mame/drivers/lemmings.c b/src/mame/drivers/lemmings.c index 2693dca9d5d..23f8e9972e2 100644 --- a/src/mame/drivers/lemmings.c +++ b/src/mame/drivers/lemmings.c @@ -70,6 +70,24 @@ WRITE8_MEMBER(lemmings_state::lemmings_sound_ack_w) m_audiocpu->set_input_line(1, CLEAR_LINE); } +READ16_MEMBER( lemmings_state::lem_protection_region_0_146_r ) +{ + int real_address = 0 + (offset *2); + int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff; + UINT8 cs = 0; + UINT16 data = m_deco146->read_data( deco146_addr, mem_mask, cs ); + return data; +} + +WRITE16_MEMBER( lemmings_state::lem_protection_region_0_146_w ) +{ + int real_address = 0 + (offset *2); + int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff; + UINT8 cs = 0; + m_deco146->write_data( space, deco146_addr, data, mem_mask, cs ); +} + + /******************************************************************************/ static ADDRESS_MAP_START( lemmings_map, AS_PROGRAM, 16, lemmings_state ) @@ -80,7 +98,8 @@ static ADDRESS_MAP_START( lemmings_map, AS_PROGRAM, 16, lemmings_state ) AM_RANGE(0x160000, 0x160fff) AM_RAM_WRITE(lemmings_palette_24bit_w) AM_SHARE("paletteram") AM_RANGE(0x170000, 0x17000f) AM_RAM_WRITE(lemmings_control_w) AM_SHARE("control_data") AM_RANGE(0x190000, 0x19000f) AM_READ(lemmings_trackball_r) - AM_RANGE(0x1a0000, 0x1a07ff) AM_DEVREAD("ioprot", deco146_device,lemmings_prot_r) +// AM_RANGE(0x1a0000, 0x1a07ff) AM_DEVREAD("ioprot", deco146_device,lemmings_prot_r) + AM_RANGE(0x1a0000, 0x1a3fff) AM_READWRITE(lem_protection_region_0_146_r,lem_protection_region_0_146_w)AM_SHARE("prot16ram") /* Protection device */ AM_RANGE(0x1a0064, 0x1a0065) AM_WRITE(lemmings_sound_w) AM_RANGE(0x1c0000, 0x1c0001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) /* 1 written once a frame */ AM_RANGE(0x1e0000, 0x1e0001) AM_DEVWRITE("spriteram2", buffered_spriteram16_device, write) /* 1 written once a frame */ @@ -103,7 +122,7 @@ ADDRESS_MAP_END /******************************************************************************/ static INPUT_PORTS_START( lemmings ) - PORT_START("BUTTONS") + PORT_START("INPUTS") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Select") PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Hurry") @@ -126,11 +145,7 @@ static INPUT_PORTS_START( lemmings ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_SERVICE_NO_TOGGLE(0x0004, IP_ACTIVE_LOW) PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_START("DSW") PORT_DIPNAME( 0x0003, 0x0003, "Credits for 1 Player" ) @@ -261,6 +276,7 @@ static MACHINE_CONFIG_START( lemmings, lemmings_state ) decospr_device::set_gfx_region(*device, 0); MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") diff --git a/src/mame/includes/lemmings.h b/src/mame/includes/lemmings.h index 07c41327ef6..01b87b2ebe1 100644 --- a/src/mame/includes/lemmings.h +++ b/src/mame/includes/lemmings.h @@ -56,4 +56,7 @@ public: void screen_eof_lemmings(screen_device &screen, bool state); void lemmings_copy_bitmap(bitmap_rgb32& bitmap, bitmap_ind16& srcbitmap, int* xscroll, int* yscroll, const rectangle& cliprect); required_device m_maincpu; + + DECLARE_READ16_MEMBER( lem_protection_region_0_146_r ); + DECLARE_WRITE16_MEMBER( lem_protection_region_0_146_w ); }; diff --git a/src/mame/machine/deco146.c b/src/mame/machine/deco146.c index f572e3b63e5..726bcd129cb 100644 --- a/src/mame/machine/deco146.c +++ b/src/mame/machine/deco146.c @@ -1424,56 +1424,10 @@ void deco_146_base_device::device_reset() } -/**************************************************************************************************** -***************************************************************************************************** -***************************************************************************************************** -***************************************************************************************************** - Old style minimal handlers (where games only really use the I/O) - - currently used by - - Lemmings - Captain America -***************************************************************************************************** -***************************************************************************************************** -***************************************************************************************************** -****************************************************************************************************/ -// alt read addresses (same as nitroball if you reverse lnes) -/* Same as Robocop 2 protection chip */ -READ16_MEMBER(deco_146_base_device::lemmings_prot_r) -{ - switch (offset << 1) - { - case 0x41a: - return ioport(":BUTTONS")->read(); - - case 0x320: - return ioport(":SYSTEM")->read(); - - case 0x4e6: - return ioport(":DSW")->read(); - } - - return 0; -} - -// standard read addresses -READ32_MEMBER(deco_146_base_device::captaven_prot_r) -{ - /* Protection/IO chip 75, same as Lemmings & Robocop 2 */ - switch (offset<<2) { - case 0x0a0: return ioport(":IN0")->read(); /* Player 1 & 2 controls */ - case 0x158: return ioport(":IN1")->read(); /* Player 3 & 4 controls */ - case 0xed4: return ioport(":IN2")->read(); /* Misc */ - } - - logerror("%08x: Unmapped protection read %04x\n",space.device().safe_pc(),offset<<2); - return 0xffffffff; -} diff --git a/src/mame/machine/deco146.h b/src/mame/machine/deco146.h index 6af81c2b972..7f61d805c46 100644 --- a/src/mame/machine/deco146.h +++ b/src/mame/machine/deco146.h @@ -53,9 +53,7 @@ public: static void set_interface_scramble(device_t &device,UINT8 a9, UINT8 a8, UINT8 a7, UINT8 a6, UINT8 a5, UINT8 a4, UINT8 a3,UINT8 a2,UINT8 a1,UINT8 a0); static void set_use_magic_read_address_xor(device_t &device, int use_xor); - // legacy stuff - DECLARE_READ32_MEMBER(captaven_prot_r); - DECLARE_READ16_MEMBER(lemmings_prot_r); +