summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/namco68.cpp
diff options
context:
space:
mode:
author David Haywood <hazemamewip@hotmail.com>2018-09-09 13:47:13 +0100
committer R. Belmont <rb6502@users.noreply.github.com>2018-09-09 08:47:13 -0400
commitea7f1e3bd977d12929e3cf5674f168143d5791bf (patch)
tree5320a5f03b92b5a1e2bd73cee87c3de735050515 /src/mame/machine/namco68.cpp
parent6153de028a36fb3dd785146bf4350777e39f92a4 (diff)
use c68 for more games, fix what looks like more cam900 damage (luckywld) due to bad ram size assumptions. (#3976)
* use c68 for more games, fix what looks like more cam900 damage (luckywld) due to bad ram size assumptions. * fix crash I introduced by trying things in a slightly different way * change comment (nw) * some cleanup (nw) * give dirtfox a calibrated default (nw) * better served with a logerror, not popmessage (nw)
Diffstat (limited to 'src/mame/machine/namco68.cpp')
-rw-r--r--src/mame/machine/namco68.cpp37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/mame/machine/namco68.cpp b/src/mame/machine/namco68.cpp
index 571002f87e6..9cb340c18a1 100644
--- a/src/mame/machine/namco68.cpp
+++ b/src/mame/machine/namco68.cpp
@@ -2,9 +2,9 @@
// copyright-holders:David Haywood, K.Wilkins
/*
+
TODO:
-output support, Golly Ghost is currently hacking this based on DPRAM in the namcos2.cpp driver side!
-some of this can likely be moved into the actual MCU core too
+output support
*/
@@ -17,7 +17,6 @@ namcoc68_device::namcoc68_device(const machine_config &mconfig, const char *tag,
device_t(mconfig, NAMCOC68, tag, owner, clock),
m_mcu(*this, "mcu"),
m_in_pb_cb(*this),
- m_in_pb2_cb(*this),
m_in_pc_cb(*this),
m_in_ph_cb(*this),
m_in_pdsw_cb(*this),
@@ -30,14 +29,30 @@ namcoc68_device::namcoc68_device(const machine_config &mconfig, const char *tag,
ROM_START( namcoc68 )
ROM_REGION( 0x8000, "mcu", 0 )
- ROM_LOAD( "c68.3d", 0x000000, 0x008000, CRC(ca64550a) SHA1(38d1ad1b1287cadef0c999aff9357927315f8e6b) )
+ ROM_LOAD( "c68.bin", 0x000000, 0x008000, CRC(ca64550a) SHA1(38d1ad1b1287cadef0c999aff9357927315f8e6b) ) // usually position 3d, but device really needs a way to specify it
ROM_END
-
+// C68 looks like a drop-in replacement for C65, so the port mappings must be scrambled in one instance, since this already has a multiplex on the port, assume here
READ8_MEMBER(namcoc68_device::c68_p5_r)
{
- return (m_player_mux) ? m_in_pb2_cb() : m_in_pb_cb();
+ uint16_t ret = (m_in_ph_cb() << 8) | m_in_pb_cb();
+
+ if (m_player_mux)
+ {
+ return bitswap<8>(ret, 6, 8, 10, 12, 4, 2, 0, 14);
+ }
+ else
+ {
+ return bitswap<8>(ret, 7, 9, 11, 13, 5, 3, 1, 15);
+ }
+}
+
+READ8_MEMBER(namcoc68_device::mcuc_r)
+{
+ uint8_t ret = m_in_pc_cb();
+ ret = bitswap<8>(ret, 3, 2, 1, 0, 7, 6, 5, 4);
+ return ret;
}
WRITE8_MEMBER(namcoc68_device::c68_p3_w)
@@ -61,6 +76,11 @@ WRITE8_MEMBER(namcoc68_device::dpram_byte_w)
m_dp_out(offset,data);
}
+READ8_MEMBER(namcoc68_device::unk_r)
+{
+ return 0x00;
+}
+
void namcoc68_device::c68_default_am(address_map &map)
{
/* input ports and dips are mapped here */
@@ -79,16 +99,15 @@ void namcoc68_device::device_add_mconfig(machine_config &config)
m3745x_device* device = &M37450(config, m_mcu, DERIVED_CLOCK(1, 1)); // ugly, needs modernizing
MCFG_M3745X_ADC14_CALLBACKS(READ8(*this, namcoc68_device, mcuan0_r), READ8(*this, namcoc68_device, mcuan1_r), READ8(*this, namcoc68_device, mcuan2_r), READ8(*this, namcoc68_device, mcuan3_r))
MCFG_M3745X_ADC58_CALLBACKS(READ8(*this, namcoc68_device, mcuan4_r), READ8(*this, namcoc68_device, mcuan5_r), READ8(*this, namcoc68_device, mcuan6_r), READ8(*this, namcoc68_device, mcuan7_r))
- MCFG_M3745X_PORT3_CALLBACKS(READ8(*this, namcoc68_device, mcuh_r), WRITE8(*this, namcoc68_device, c68_p3_w)) // coins/test/service
+ MCFG_M3745X_PORT3_CALLBACKS(READ8(*this, namcoc68_device, mcuc_r), WRITE8(*this, namcoc68_device, c68_p3_w)) // coins/test/service
MCFG_M3745X_PORT5_CALLBACKS(READ8(*this, namcoc68_device, c68_p5_r), NOOP) // muxed player 1/2
- MCFG_M3745X_PORT6_CALLBACKS(READ8(*this, namcoc68_device, mcuc_r), NOOP) // unused in sgunner2
+ MCFG_M3745X_PORT6_CALLBACKS(READ8(*this, namcoc68_device, unk_r), NOOP) // unused in sgunner2
MCFG_DEVICE_PROGRAM_MAP(c68_default_am)
}
void namcoc68_device::device_resolve_objects()
{
m_in_pb_cb.resolve_safe(0xff);
- m_in_pb2_cb.resolve_safe(0xff);
m_in_pc_cb.resolve_safe(0xff);
m_in_ph_cb.resolve_safe(0xff);
m_in_pdsw_cb.resolve_safe(0xff);