summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author David Haywood <28625134+DavidHaywood@users.noreply.github.com>2020-08-30 01:47:48 +0100
committer GitHub <noreply@github.com>2020-08-29 20:47:48 -0400
commitd38ba70ae263fdcbb58d59e524f459a1d1674fa5 (patch)
tree6e91b3fb3fa43f56ab5168cac5aa228cb9490f6e
parent68fecdf7e01936df34261d944ad36fda29b3eb48 (diff)
pcp8718 / pcp8728 start using extracted internal ROM [Sean Riddle, David Haywood] (#7152)
* pcp8718 / pcp8728 start using extracted internal ROM [Sean Riddle, David Haywood] * new WORKING machine ---- Mega Man 2 (MSI Plug & Play) [Sean Riddle]
-rw-r--r--src/mame/drivers/generalplus_gpl_unknown.cpp121
-rw-r--r--src/mame/drivers/nes_vt.cpp32
-rw-r--r--src/mame/mame.lst1
3 files changed, 110 insertions, 44 deletions
diff --git a/src/mame/drivers/generalplus_gpl_unknown.cpp b/src/mame/drivers/generalplus_gpl_unknown.cpp
index 7deb40c5e7d..0e45a6c8288 100644
--- a/src/mame/drivers/generalplus_gpl_unknown.cpp
+++ b/src/mame/drivers/generalplus_gpl_unknown.cpp
@@ -86,6 +86,7 @@ public:
pcp8718_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
+ m_mainrom(*this, "maincpu"),
m_mainram(*this, "mainram"),
m_palette(*this, "palette"),
m_screen(*this, "screen"),
@@ -103,6 +104,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<unsp_20_device> m_maincpu;
+ required_region_ptr<uint16_t> m_mainrom;
required_shared_ptr<uint16_t> m_mainram;
required_device<palette_device> m_palette;
@@ -127,6 +129,7 @@ private:
uint16_t unk_7abf_r();
uint16_t unk_7860_r();
+ uint16_t unk_780f_r();
void unk_7868_w(uint16_t data);
@@ -154,8 +157,12 @@ private:
// probably not
SPI_STATE_WAITING_DUMMY1_ADDR = 4,
SPI_STATE_WAITING_DUMMY2_ADDR = 5,
- SPI_STATE_READING = 6
+ SPI_STATE_READING = 6,
+ SPI_STATE_WAITING_HIGH_ADDR_FAST = 8,
+ SPI_STATE_WAITING_MID_ADDR_FAST = 9,
+ SPI_STATE_WAITING_LOW_ADDR_FAST = 10,
+ SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY = 11
};
spistate m_spistate;
@@ -190,6 +197,13 @@ uint16_t pcp8718_state::unk_7860_r()
}
+uint16_t pcp8718_state::unk_780f_r()
+{
+ return 0x0002;
+}
+
+
+
uint16_t pcp8718_state::spi_misc_control_r()
{
logerror("%06x: spi_misc_control_r\n", machine().describe_context());
@@ -216,6 +230,11 @@ void pcp8718_state::spi_process_tx_data(uint8_t data)
logerror("set to read mode (need address) %02x\n", data);
m_spistate = SPI_STATE_WAITING_HIGH_ADDR;
}
+ else if (data == 0x0b)
+ {
+ logerror("set to fast read mode (need address) %02x\n", data);
+ m_spistate = SPI_STATE_WAITING_HIGH_ADDR_FAST;
+ }
else
{
logerror("invalid state request %02x\n", data);
@@ -265,6 +284,40 @@ void pcp8718_state::spi_process_tx_data(uint8_t data)
// m_spistate = SPI_STATE_READY;
break;
}
+
+
+ case SPI_STATE_WAITING_HIGH_ADDR_FAST:
+ {
+ m_spiaddress = (m_spiaddress & 0xff00ffff) | data << 16;
+ logerror("set to high address %02x address is now %08x\n", data, m_spiaddress);
+ m_spistate = SPI_STATE_WAITING_MID_ADDR_FAST;
+ break;
+ }
+
+ case SPI_STATE_WAITING_MID_ADDR_FAST:
+ {
+ m_spiaddress = (m_spiaddress & 0xffff00ff) | data << 8;
+ logerror("set to mid address %02x address is now %08x\n", data, m_spiaddress);
+ m_spistate = SPI_STATE_WAITING_LOW_ADDR_FAST;
+ break;
+ }
+
+ case SPI_STATE_WAITING_LOW_ADDR_FAST:
+ {
+ m_spiaddress = (m_spiaddress & 0xffffff00) | data;
+ logerror("set to low address %02x address is now %08x\n", data, m_spiaddress);
+ m_spistate = SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY;
+
+ break;
+ }
+
+ case SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY:
+ {
+ logerror("dummy write %08x\n", data, m_spiaddress);
+ m_spistate = SPI_STATE_READING;
+ break;
+ }
+
}
}
@@ -278,9 +331,9 @@ uint8_t pcp8718_state::spi_process_rx()
uint8_t dat = m_spirom[m_spiaddress & 0x3fffff];
// hack internal BIOS checksum check
- if (m_spiaddress == ((0x49d13 - 0x20000) * 2)+1)
- if (dat == 0x4e)
- dat = 0x5e;
+ //if (m_spiaddress == ((0x49d13 - 0x20000) * 2)+1)
+ // if (dat == 0x4e)
+ // dat = 0x5e;
logerror("reading SPI %02x from SPI Address %08x (adjusted word offset %08x)\n", dat, m_spiaddress, (m_spiaddress/2)+0x20000);
m_spiaddress++;
@@ -346,6 +399,9 @@ void pcp8718_state::map(address_map &map)
map(0x000000, 0x006fff).ram().share("mainram");
map(0x007000, 0x0077ff).ram(); // might be registers, but the call stubs for RAM calls explicitly use addresses in here for private stack so that previous snippets can be restored?
+ map(0x00780f, 0x00780f).r(FUNC(pcp8718_state::unk_780f_r));
+
+
map(0x007860, 0x007860).r(FUNC(pcp8718_state::unk_7860_r));
map(0x007868, 0x007868).w(FUNC(pcp8718_state::unk_7868_w));
@@ -378,6 +434,7 @@ uint16_t pcp8718_state::simulate_f000_r(offs_t offset)
if ((offset + 0xf000) == (realpc))
{
+ // still simulate this as it uses 'fast read' mode which doesn't work in the SPI handler at the moment
if (realpc == 0xf000)
{
address_space& mem = m_maincpu->space(AS_PROGRAM);
@@ -388,11 +445,16 @@ uint16_t pcp8718_state::simulate_f000_r(offs_t offset)
{
uint16_t data = m_spirom[((source - 0x20000) * 2) + 0] | (m_spirom[((source - 0x20000) * 2) + 1] << 8);
uint16_t data2 = m_spirom[((source - 0x20000) * 2) + 2] | (m_spirom[((source - 0x20000) * 2) + 3] << 8);
+ uint16_t data3 = m_spirom[((source - 0x20000) * 2) + 4] | (m_spirom[((source - 0x20000) * 2) + 5] << 8);
+ uint16_t data4 = m_spirom[((source - 0x20000) * 2) + 6] | (m_spirom[((source - 0x20000) * 2) + 7] << 8);
- logerror("call to 0xf000 - copying from %08x to 04/05\n", source); // some code only uses 04, but other code copies pointers and expects results in 04 and 05
+ logerror("call to 0xf000 - copying 4 words from %08x to 04/05/06/07\n", source); // some code only uses 04, but other code copies pointers and expects results in 04 and 05
mem.write_word(0x0004, data);
mem.write_word(0x0005, data2);
+ mem.write_word(0x0006, data3);
+ mem.write_word(0x0007, data4);
+
}
return 0x9a90; // retf
@@ -400,30 +462,31 @@ uint16_t pcp8718_state::simulate_f000_r(offs_t offset)
else if (realpc == 0xf58f)
{
logerror("call to 0xf58f - unknown function\n");
- return 0x9a90; // retf
+ return m_mainrom[offset];
}
else if (realpc == 0xfb26) // done with a call, and also a pc =
{
logerror("call to 0xfb26 - unknown function\n");
- return 0x9a90; // retf
+ return m_mainrom[offset];
}
else if (realpc == 0xf56f) // done with a pc =
{
logerror("call to 0xf56f - unknown function\n");
- return 0x9a90; // retf
+ return m_mainrom[offset];
}
else
{
- fatalerror("simulate_f000_r unhandled BIOS simulation offset %04x\n", offset);
+ return m_mainrom[offset];
}
}
else
{
logerror("simulate_f000_r reading BIOS area (for checksum?) %04x\n", offset);
+ return m_mainrom[offset];
}
}
- return 0x0000;
+ return m_mainrom[offset];
}
uint16_t pcp8718_state::ramcall_2060_logger_r()
@@ -501,14 +564,14 @@ void pcp8718_state::machine_reset()
{
// this looks like it might actually be part of the IRQ handler (increase counter at 00 at the very start) rather than where we should end up after startup
// it also looks like (from the pc = 2xxx opcodes) that maybe this code should be being executed in RAM as those don't give correct offsets in the data segment.
- m_maincpu->set_state_int(UNSP_PC, 0x4000);
- m_maincpu->set_state_int(UNSP_SR, 0x0000);
+ //m_maincpu->set_state_int(UNSP_PC, 0x4000);
+ //m_maincpu->set_state_int(UNSP_SR, 0x0000);
//uint16_t* ROM = (uint16_t*)memregion("maincpu")->base();
//ROM[0x0000] = 0x9a90; // retf from internal ROM call to 0xf000 (unknown purpose)
// there doesn't appear to be any code to set the SP, so it must be done by the internal ROM
- m_maincpu->set_state_int(UNSP_SP, 0x5fff);
+ //m_maincpu->set_state_int(UNSP_SP, 0x5fff);
m_maincpu->space(AS_PROGRAM).install_read_handler(0xf000, 0xffff, read16sm_delegate(*this, FUNC(pcp8718_state::simulate_f000_r)));
@@ -554,7 +617,7 @@ void pcp8718_state::pcp8718(machine_config &config)
ROM_START( pcp8718 )
ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF )
- ROM_LOAD16_WORD_SWAP( "internal.rom", 0x000000, 0x2000, NO_DUMP ) // exact size unknown
+ ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) )
ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF )
//ROM_LOAD16_WORD_SWAP( "8718_en25f32.bin", 0x000000, 0x400000, CRC(cc138db4) SHA1(379af3d94ae840f52c06416d6cf32e25923af5ae) ) // bad dump, some blocks are corrupt
@@ -563,7 +626,7 @@ ROM_END
ROM_START( pcp8728 )
ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF )
- ROM_LOAD16_WORD_SWAP( "internal.rom", 0x000000, 0x2000, NO_DUMP ) // exact size unknown
+ ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) )
ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF )
ROM_LOAD( "pcp 8728 788 in 1.bin", 0x000000, 0x400000, CRC(60115f21) SHA1(e15c39f11e442a76fae3823b6d510178f6166926) )
@@ -580,34 +643,6 @@ ROM_END
void pcp8718_state::spi_init()
{
- uint8_t* rom = memregion("spi")->base();
-
- uint32_t start = rom[0] | (rom[1] << 8) | (rom[2] << 16) | (rom[3] << 24);
- uint32_t end = rom[4] | (rom[5] << 8) | (rom[2] << 16) | (rom[3] << 24);
-
-
- logerror("start: %08x\n", start);
- logerror("end: %08x\n", end);
-
- int writebase = 0x4000;
-
- if (start > end)
- {
- logerror("invalid initial copy?\n");
- return;
- }
- else
- {
- start -= 0x20000;
- end -= 0x20000;
-
- for (int i = start*2; i <= end*2; i+=2)
- {
- uint16_t dat = rom[i] | (rom[i+1] << 8);
- m_mainram[writebase++] = dat;
- }
- }
-
}
diff --git a/src/mame/drivers/nes_vt.cpp b/src/mame/drivers/nes_vt.cpp
index 3711a62d69c..4856d3d6aa0 100644
--- a/src/mame/drivers/nes_vt.cpp
+++ b/src/mame/drivers/nes_vt.cpp
@@ -104,6 +104,7 @@ public:
void nes_vt_2mb(machine_config& config);
void nes_vt_1mb_baddma(machine_config& config);
void nes_vt_2mb_baddma(machine_config& config);
+ void nes_vt_4mb_baddma(machine_config& config);
void nes_vt_4mb(machine_config& config);
void nes_vt_8mb(machine_config& config);
void nes_vt_16mb(machine_config& config);
@@ -797,6 +798,13 @@ void nes_vt_state::nes_vt_2mb_baddma(machine_config& config)
m_soc->force_bad_dma();
}
+void nes_vt_state::nes_vt_4mb_baddma(machine_config& config)
+{
+ nes_vt_4mb(config);
+ m_soc->force_bad_dma();
+}
+
+
void nes_vt_state::nes_vt_4mb(machine_config& config)
{
NES_VT_SOC(config, m_soc, NTSC_APU_CLOCK);
@@ -1168,6 +1176,21 @@ static INPUT_PORTS_START( nes_vt_msi )
PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
+static INPUT_PORTS_START( nes_vt_msi_mm2 )
+ PORT_START("IO0")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("A")
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("B")
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_PLAYER(1)
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START ) PORT_PLAYER(1)
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
+
+ PORT_START("IO1")
+ PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
+INPUT_PORTS_END
+
static INPUT_PORTS_START( nes_vt_ddr )
PORT_START("IO0")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
@@ -1564,6 +1587,11 @@ ROM_START( msidd )
ROM_LOAD( "doubledragon_m29w160eb_00202249.bin", 0x00000, 0x200000, CRC(44df5bb6) SHA1(a984aa1644d2d313d4263afdfed1cd64009f1137) )
ROM_END
+ROM_START( msimm2 )
+ ROM_REGION( 0x400000, "mainrom", 0 )
+ ROM_LOAD( "megaman2_s99jl032hbt1_001227e_readas_s29jl032h.bin", 0x00000, 0x400000, CRC(f537a053) SHA1(bd9353df34c0c0ee7d0e5e9808fc36f1a5eecc22) )
+ROM_END
+
ROM_START( msimpac )
ROM_REGION( 0x100000, "mainrom", 0 )
ROM_LOAD( "mspacman_29dl800ba_000422cb.bin", 0x00000, 0x100000, CRC(c66300e3) SHA1(3fc0bdfbf449d884151f1b581e848243cd2df3a5) )
@@ -2075,14 +2103,16 @@ CONS( 200?, vtsndtest, 0, 0, nes_vt_512kb, nes_vt, nes_vt_state, empty_init
// Bundled as "Demo for VT03 Pic32" on the V.R. Technology VT SDK
CONS( 200?, vtboxing, 0, 0, nes_vt_512kb, nes_vt, nes_vt_state, empty_init, "VRT", "VRT VT SDK 'Boxing' (Demo for VT03 Pic32)", MACHINE_NOT_WORKING )
+// MSI games (MSI is the same company as Majesco)
CONS( 2017, msiwwe, 0, 0, nes_vt_2mb_baddma, nes_vt_msi, nes_vt_state, empty_init, "MSI", "WWE Wrestlemania Steel Cage Challenge (Plug & Play)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2017, msidd, 0, 0, nes_vt_2mb_baddma, nes_vt_msi, nes_vt_state, empty_init, "MSI / Arc System Works", "Double Dragon - 30 Years Anniversary (Plug & Play)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
CONS( 2016, msimpac, 0, 0, nes_vt_1mb_baddma, nes_vt_msi, nes_vt_state, empty_init, "MSI / Bandai Namco", "Ms. Pac-Man (MSI Plug & Play)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
-CONS( 2016, msisinv, 0, 0, nes_vt_1mb_baddma, nes_vt_msi, nes_vt_state, empty_init, "MSI / Taito", "Space Invaders (MSI Plug & Play)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
+CONS( 2017, msimm2, 0, 0, nes_vt_4mb_baddma, nes_vt_msi_mm2, nes_vt_state, empty_init, "MSI / Capcom", "Mega Man 2 (MSI Plug & Play)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // various issues (glitched Metal Man stage boss, missing 'ready' text) happen on real unit
+CONS( 2016, msisinv, 0, 0, nes_vt_1mb_baddma, nes_vt_msi, nes_vt_state, empty_init, "MSI / Taito", "Space Invaders (MSI Plug & Play)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
// MSI Midway (Joust+Gauntlet 2 + Defender 2) has 2x Globs, rather than Glob + Flash ROM
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index f4134f4416d..1a9aceca102 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -32118,6 +32118,7 @@ msiwwe
msidd
msimpac
msisinv
+msimm2
ablpinb
mc_dgear
dgun2500