summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2017-09-05 13:14:24 -0400
committer AJR <ajrhacker@users.noreply.github.com>2017-09-05 13:14:24 -0400
commit8772759a4c5788bd537d7d1876795e4fbcb51f92 (patch)
treec4f532ba44a6b02a0b612910e5ff77557adf8310
parent5ab531e88c3a39061d1daa7e78ab4387a53e06b3 (diff)
usclssic: Add uPD4701A device with nasty multiplexing (nw)
-rw-r--r--src/mame/drivers/seta.cpp111
-rw-r--r--src/mame/includes/seta.h13
2 files changed, 65 insertions, 59 deletions
diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp
index 53d7c4263f7..19194e4f925 100644
--- a/src/mame/drivers/seta.cpp
+++ b/src/mame/drivers/seta.cpp
@@ -1379,7 +1379,6 @@ Note: on screen copyright is (c)1998 Coinmaster.
#include "machine/nvram.h"
#include "machine/pit8253.h"
#include "machine/tmp68301.h"
-#include "machine/upd4701.h"
#include "machine/watchdog.h"
#include "sound/2203intf.h"
#include "sound/2612intf.h"
@@ -1777,45 +1776,32 @@ READ16_MEMBER(seta_state::usclssic_dsw_r)
return 0;
}
-READ16_MEMBER(seta_state::usclssic_trackball_x_r)
+CUSTOM_INPUT_MEMBER(seta_state::usclssic_trackball_x_r)
{
- static const char *const portx_name[2] = { "P1X", "P2X" };
-
- switch (offset)
- {
- case 0/2: return (ioport(portx_name[m_usclssic_port_select])->read() >> 0) & 0xff;
- case 2/2: return (ioport(portx_name[m_usclssic_port_select])->read() >> 8) & 0xff;
- }
- return 0;
+ return (m_usclssic_port_select ? m_track2_x : m_track1_x)->read();
}
-READ16_MEMBER(seta_state::usclssic_trackball_y_r)
+CUSTOM_INPUT_MEMBER(seta_state::usclssic_trackball_y_r)
{
- static const char *const porty_name[2] = { "P1Y", "P2Y" };
-
- switch (offset)
- {
- case 0/2: return (ioport(porty_name[m_usclssic_port_select])->read() >> 0) & 0xff;
- case 2/2: return (ioport(porty_name[m_usclssic_port_select])->read() >> 8) & 0xff;
- }
- return 0;
+ return (m_usclssic_port_select ? m_track2_y : m_track1_y)->read();
}
-WRITE16_MEMBER(seta_state::usclssic_lockout_w)
+WRITE8_MEMBER(seta_state::usclssic_lockout_w)
{
- if (ACCESSING_BITS_0_7)
- {
- int tiles_offset = (data & 0x10) ? 0x4000: 0;
+ int tiles_offset = BIT(data, 4) ? 0x4000: 0;
- m_usclssic_port_select = (data & 0x40) >> 6;
+ m_usclssic_port_select = BIT(data, 6);
+ m_buttonmux->select_w(m_usclssic_port_select);
- if (tiles_offset != m_tiles_offset)
- machine().tilemap().mark_all_dirty();
- m_tiles_offset = tiles_offset;
+ m_upd4701->resetx_w(BIT(data, 7));
+ m_upd4701->resety_w(BIT(data, 7));
- seta_coin_lockout_w(data);
- }
+ if (tiles_offset != m_tiles_offset)
+ machine().tilemap().mark_all_dirty();
+ m_tiles_offset = tiles_offset;
+
+ seta_coin_lockout_w(data);
}
@@ -1827,9 +1813,8 @@ static ADDRESS_MAP_START( usclssic_map, AS_PROGRAM, 16, seta_state )
/**/AM_RANGE(0x900000, 0x900001) AM_RAM // ? $4000
AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_SHARE("vctrl_0") // VRAM Ctrl
/**/AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_SHARE("paletteram") // Palette
- AM_RANGE(0xb40000, 0xb40003) AM_READ(usclssic_trackball_x_r) // TrackBall X
- AM_RANGE(0xb40000, 0xb40001) AM_WRITE(usclssic_lockout_w) // Coin Lockout + Tiles Banking
- AM_RANGE(0xb40004, 0xb40007) AM_READ(usclssic_trackball_y_r) // TrackBall Y + Buttons
+ AM_RANGE(0xb40000, 0xb40007) AM_DEVREAD8("upd4701", upd4701_device, read_xy, 0x00ff)
+ AM_RANGE(0xb40000, 0xb40001) AM_WRITE8(usclssic_lockout_w, 0x00ff) // Coin Lockout + Tiles Banking
AM_RANGE(0xb4000a, 0xb4000b) AM_WRITE(ipl1_ack_w)
AM_RANGE(0xb40010, 0xb40011) AM_READ_PORT("COINS") // Coins
AM_RANGE(0xb40010, 0xb40011) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff) // To Sub CPU
@@ -6366,33 +6351,31 @@ INPUT_PORTS_END
***************************************************************************/
static INPUT_PORTS_START( usclssic )
- PORT_START("P1X") /* muxed port 0 */
- PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_RESET
- PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_START("TRACKX")
+ PORT_BIT( 0xfff, 0x000, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seta_state, usclssic_trackball_x_r, nullptr)
- PORT_START("P1Y") /* muxed port 0 */
- PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_RESET
- PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON1 )
- PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_START1 )
- PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_START("TRACKY")
+ PORT_BIT( 0xfff, 0x000, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seta_state, usclssic_trackball_y_r, nullptr)
- PORT_START("P2X") /* muxed port 1 */
- PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_RESET PORT_COCKTAIL
- PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_START("TRACK1_X") /* muxed port 0 */
+ PORT_BIT( 0xfff, 0x000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_RESET
+
+ PORT_START("TRACK1_Y") /* muxed port 0 */
+ PORT_BIT( 0xfff, 0x000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_RESET
+
+ PORT_START("TRACK2_X") /* muxed port 1 */
+ PORT_BIT( 0xfff, 0x000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_RESET PORT_COCKTAIL
- PORT_START("P2Y") /* muxed port 1 */
- PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_RESET PORT_COCKTAIL
- PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
- PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_START2 )
- PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_START("TRACK2_Y") /* muxed port 1 */
+ PORT_BIT( 0xfff, 0x000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_RESET PORT_COCKTAIL
+
+ PORT_START("BUTTONS")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_WRITE_LINE_DEVICE_MEMBER("buttonmux", hc157_device, a0_w)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_WRITE_LINE_DEVICE_MEMBER("buttonmux", hc157_device, a1_w)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_WRITE_LINE_DEVICE_MEMBER("buttonmux", hc157_device, a2_w)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_WRITE_LINE_DEVICE_MEMBER("buttonmux", hc157_device, b0_w)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_WRITE_LINE_DEVICE_MEMBER("buttonmux", hc157_device, b1_w)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) PORT_WRITE_LINE_DEVICE_MEMBER("buttonmux", hc157_device, b2_w)
PORT_START("COINS")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) // tested (sound related?)
@@ -7964,6 +7947,12 @@ TIMER_DEVICE_CALLBACK_MEMBER(seta_state::calibr50_interrupt)
}
+MACHINE_START_MEMBER(seta_state, usclssic)
+{
+ m_buttonmux->ab_w(0xff);
+}
+
+
static MACHINE_CONFIG_START( usclssic )
/* basic machine hardware */
@@ -7976,6 +7965,16 @@ static MACHINE_CONFIG_START( usclssic )
MCFG_CPU_PROGRAM_MAP(calibr50_sub_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", seta_state, irq0_line_assert)
+ MCFG_DEVICE_ADD("upd4701", UPD4701A, 0)
+ MCFG_UPD4701_PORTX("TRACKX")
+ MCFG_UPD4701_PORTY("TRACKY")
+
+ MCFG_DEVICE_ADD("buttonmux", HC157, 0)
+ MCFG_74157_OUT_CB(DEVWRITELINE("upd4701", upd4701_device, middle_w)) MCFG_DEVCB_BIT(0)
+ MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("upd4701", upd4701_device, right_w)) MCFG_DEVCB_BIT(1)
+ MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("upd4701", upd4701_device, left_w)) MCFG_DEVCB_BIT(2)
+
+ MCFG_MACHINE_START_OVERRIDE(seta_state,usclssic)
MCFG_MACHINE_RESET_OVERRIDE(seta_state,calibr50)
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
diff --git a/src/mame/includes/seta.h b/src/mame/includes/seta.h
index 73f2da1ef34..225a015b9aa 100644
--- a/src/mame/includes/seta.h
+++ b/src/mame/includes/seta.h
@@ -7,8 +7,10 @@
***************************************************************************/
+#include "machine/74157.h"
#include "machine/gen_latch.h"
#include "machine/ticket.h"
+#include "machine/upd4701.h"
#include "machine/upd4992.h"
#include "sound/x1_010.h"
#include "video/seta001.h"
@@ -43,6 +45,8 @@ public:
m_x1(*this, "x1snd"),
m_soundlatch(*this, "soundlatch"),
m_soundlatch2(*this, "soundlatch2"),
+ m_upd4701(*this, "upd4701"),
+ m_buttonmux(*this, "buttonmux"),
m_dsw(*this, "DSW"),
m_rot(*this, {"ROT1", "ROT2"}),
m_p1(*this, "P1"),
@@ -71,6 +75,8 @@ public:
optional_device<x1_010_device> m_x1;
optional_device<generic_latch_8_device> m_soundlatch;
optional_device<generic_latch_8_device> m_soundlatch2;
+ optional_device<upd4701_device> m_upd4701;
+ optional_device<hc157_device> m_buttonmux;
optional_ioport m_dsw;
optional_ioport_array<2> m_rot;
@@ -145,9 +151,9 @@ public:
DECLARE_WRITE16_MEMBER(sub_ctrl_w);
DECLARE_READ16_MEMBER(seta_dsw_r);
DECLARE_READ16_MEMBER(usclssic_dsw_r);
- DECLARE_READ16_MEMBER(usclssic_trackball_x_r);
- DECLARE_READ16_MEMBER(usclssic_trackball_y_r);
- DECLARE_WRITE16_MEMBER(usclssic_lockout_w);
+ DECLARE_CUSTOM_INPUT_MEMBER(usclssic_trackball_x_r);
+ DECLARE_CUSTOM_INPUT_MEMBER(usclssic_trackball_y_r);
+ DECLARE_WRITE8_MEMBER(usclssic_lockout_w);
DECLARE_READ16_MEMBER(zombraid_gun_r);
DECLARE_WRITE16_MEMBER(zombraid_gun_w);
DECLARE_READ16_MEMBER(zingzipbl_unknown_r);
@@ -205,6 +211,7 @@ public:
DECLARE_MACHINE_RESET(calibr50);
DECLARE_PALETTE_INIT(palette_init_RRRRRGGGGGBBBBB_proms);
DECLARE_PALETTE_INIT(usclssic);
+ DECLARE_MACHINE_START(usclssic);
DECLARE_VIDEO_START(seta_2_layers);
DECLARE_PALETTE_INIT(blandia);
DECLARE_PALETTE_INIT(zingzip);