From 7adf441cdb13d2e34fd0249753c2c92ac4fa272e Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 26 Jun 2017 13:53:37 -0400 Subject: [PATCH] froggeram: Fix PPI accesses (nw) --- src/mame/drivers/galaxian.cpp | 69 ++++++++++++++++++++++------------- src/mame/includes/galaxian.h | 2 + 2 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp index 7ed0ec5aa32..e104b70ae79 100644 --- a/src/mame/drivers/galaxian.cpp +++ b/src/mame/drivers/galaxian.cpp @@ -2066,14 +2066,28 @@ static ADDRESS_MAP_START( tenspot_select_map, AS_PROGRAM, 8, galaxian_state ) AM_RANGE(0xe000, 0xe000) AM_WRITE(tenspot_unk_e000_w) ADDRESS_MAP_END + +READ8_MEMBER(galaxian_state::froggeram_ppi8255_r) +{ + // same as theend, but accesses are scrambled + uint8_t result = 0xff; + if (offset & 0x0100) result &= m_ppi8255_0->read(space, offset & 3); + if (offset & 0x0200) result &= m_ppi8255_1->read(space, offset & 3); + return BITSWAP8(result, 0, 1, 2, 3, 4, 5, 6, 7); +} + +WRITE8_MEMBER(galaxian_state::froggeram_ppi8255_w) +{ + // same as theend, but accesses are scrambled + data = BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7); + if (offset & 0x0100) m_ppi8255_0->write(space, offset & 3, data); + if (offset & 0x0200) m_ppi8255_1->write(space, offset & 3, data); +} + static ADDRESS_MAP_START( froggeram_map, AS_PROGRAM, 8, galaxian_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x2fff) AM_ROM - // AM_RANGE(0x4100, 0x4103) // ppi8255_0 ? - AM_RANGE(0x4100, 0x4100) AM_READ_PORT("IN0") // why using the i8255_device doesn't work? - AM_RANGE(0x4101, 0x4101) AM_READ_PORT("IN1") - AM_RANGE(0x4102, 0x4102) AM_READ_PORT("IN2") - // AM_RANGE(0x4200, 0x4203) // ppi8255_1 ? + AM_RANGE(0x4000, 0x43ff) AM_READWRITE(froggeram_ppi8255_r, froggeram_ppi8255_w) AM_RANGE(0x8000, 0x87ff) AM_RAM AM_RANGE(0x8800, 0x8800) AM_DEVREAD("watchdog", watchdog_timer_device, reset_r) AM_RANGE(0xa800, 0xabff) AM_RAM_WRITE(galaxian_videoram_w) AM_SHARE("videoram") @@ -4303,40 +4317,43 @@ INPUT_PORTS_END static INPUT_PORTS_START( froggeram ) PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) + 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_UNKNOWN ) 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_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY - PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Lives ) ) - PORT_DIPSETTING( 0xc0, "5" ) - PORT_DIPSETTING( 0x80, "4" ) - PORT_DIPSETTING( 0x40, "3" ) - PORT_DIPSETTING( 0x00, "2") + PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x03, "5" ) + PORT_DIPSETTING( 0x01, "4" ) + PORT_DIPSETTING( 0x02, "3" ) + PORT_DIPSETTING( 0x00, "2" ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) PORT_START("IN2") PORT_DIPUNKNOWN( 0x01, 0x00 ) PORT_DIPUNKNOWN( 0x02, 0x00 ) - PORT_DIPUNKNOWN( 0x04, 0x00 ) - PORT_DIPUNKNOWN( 0x08, 0x00 ) - PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coinage ) ) - PORT_DIPSETTING( 0x30, "A 1/2 B 1/1" ) + PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) ) + PORT_DIPSETTING( 0x0c, "A 1/2 B 1/1" ) PORT_DIPSETTING( 0x00, "A 1/1 B 1/1" ) - PORT_DIPSETTING( 0x10, "A 2/1 B 2/1" ) - PORT_DIPSETTING( 0x20, "A 1/1 B 2/1" ) + PORT_DIPSETTING( 0x08, "A 2/1 B 2/1" ) + PORT_DIPSETTING( 0x04, "A 1/1 B 2/1" ) + PORT_DIPUNKNOWN( 0x10, 0x00 ) + PORT_DIPUNKNOWN( 0x20, 0x00 ) PORT_DIPUNKNOWN( 0x40, 0x00 ) PORT_DIPUNKNOWN( 0x80, 0x00 ) + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) INPUT_PORTS_END static INPUT_PORTS_START( turtles ) diff --git a/src/mame/includes/galaxian.h b/src/mame/includes/galaxian.h index 89c5a43b995..fad9d16fda7 100644 --- a/src/mame/includes/galaxian.h +++ b/src/mame/includes/galaxian.h @@ -197,6 +197,8 @@ public: DECLARE_WRITE8_MEMBER(tenspot_unk_6000_w); DECLARE_WRITE8_MEMBER(tenspot_unk_8000_w); DECLARE_WRITE8_MEMBER(tenspot_unk_e000_w); + DECLARE_READ8_MEMBER(froggeram_ppi8255_r); + DECLARE_WRITE8_MEMBER(froggeram_ppi8255_w); DECLARE_WRITE8_MEMBER(artic_gfxbank_w); DECLARE_READ8_MEMBER(tenspot_dsw_read); DECLARE_INPUT_CHANGED_MEMBER(gmgalax_game_changed);