summaryrefslogtreecommitdiffstats
path: root/src/mame/drivers/bionicc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/bionicc.cpp')
-rw-r--r--src/mame/drivers/bionicc.cpp130
1 files changed, 73 insertions, 57 deletions
diff --git a/src/mame/drivers/bionicc.cpp b/src/mame/drivers/bionicc.cpp
index cd2041bb586..81dc99907a9 100644
--- a/src/mame/drivers/bionicc.cpp
+++ b/src/mame/drivers/bionicc.cpp
@@ -54,22 +54,16 @@
- see the beginning of level 3: background screwed
- gray tiles around the title in Top Secret
- ToDo:
- - get rid of input port hack
-
- Controls appear to be mapped at 0xFE4000, alongside dip switches, but there
- is something strange going on that I can't (yet) figure out.
- Player controls and coin inputs are supposed to magically appear at
- 0xFFFFFB (coin/start)
- 0xFFFFFD (player 2)
- 0xFFFFFF (player 1)
+ Note: The MCU rom contains the string
+ "<for dealer-location test & USA show. 87/03/10 >"
+ which indicates it could be from an earlier version, especially with it
+ coming from a 'Top Secret' bootleg with identical program but unprotected
+ MCU, however f1dream has a similar string, and is verified as being from
+ a production board.
- This is probably done by the Intel C8751H MCU on the board (whose internal ROM
- is not yet available).
-
- The MCU also takes care of the commands for the sound CPU, which are stored
- at FFFFF9.
+ The MCU hookup is currently wrong, maybe IRQ4 related?
+ ToDo:
IRQ4 seems to be control related.
On each interrupt, it reads 0xFE4000 (coin/start), shift the bits around
and move the resulting byte into a dword RAM location. The dword RAM location
@@ -96,42 +90,66 @@
*
*************************************/
-WRITE16_MEMBER(bionicc_state::hacked_controls_w)
+
+READ8_MEMBER(bionicc_state::mcu_shared_r)
{
- logerror("%06x: hacked_controls_w %04x %02x\n", m_maincpu->pc(), offset, data);
- COMBINE_DATA(&m_inp[offset]);
+ uint8_t ret = m_ram16[(0x3000 / 2) + offset];
+ return ret;
}
-READ16_MEMBER(bionicc_state::hacked_controls_r)
+WRITE8_MEMBER(bionicc_state::mcu_shared_w)
{
- logerror("%06x: hacked_controls_r %04x %04x\n", m_maincpu->pc(), offset, m_inp[offset]);
- return m_inp[offset];
+ m_ram16[(0x3000 / 2) + offset] = (m_ram16[(0x3000 / 2) + offset] & 0xff00) | data;
}
-WRITE16_MEMBER(bionicc_state::mpu_trigger_w)
+WRITE8_MEMBER(bionicc_state::out1_w)
+{
+ m_soundlatch->write(space,0,data);
+}
+
+WRITE8_MEMBER(bionicc_state::out3_w)
{
- data = ioport("SYSTEM")->read() >> 12;
- m_inp[0] = data ^ 0x0f;
+ if ((m_old_p3 & 0x20) != (data & 0x20))
+ {
+ // guess
+ if (!(data & 0x20))
+ m_mcu->set_input_line(MCS51_INT0_LINE, CLEAR_LINE);
+ }
- data = ioport("P2")->read();
- m_inp[1] = data ^ 0xff;
+ if ((m_old_p3 & 0x40) != (data & 0x40))
+ {
+ // used, but for what?
+ }
- data = ioport("P1")->read();
- m_inp[2] = data ^ 0xff;
-}
+ if ((m_old_p3 & 0x01) != (data & 0x01))
+ {
+ // guess, toggles at the end of interrupt
+ if (!(data & 0x01))
+ {
+ m_maincpu->resume(SUSPEND_REASON_HALT);
+ // the MCU should be doing this but is writing to the wrong bits?!
+ data = ioport("SYSTEM")->read() >> 12;
+ m_ram16[0x3ffa/2] = /*(m_ram16[0x3ffa/2] & 0xff00) |*/ (data ^ 0x0f);
-WRITE16_MEMBER(bionicc_state::hacked_soundcommand_w)
-{
- COMBINE_DATA(&m_soundcommand);
- m_soundlatch->write(space, 0, m_soundcommand & 0xff);
+ data = ioport("P2")->read();
+ m_ram16[0x3ffc/2] = /*(m_ram16[0x3ffc/2] & 0xff00) |*/ (data ^ 0xff);
+
+ data = ioport("P1")->read();
+ m_ram16[0x3ffe/2] = /*(m_ram16[0x3ffe/2] & 0xff00) |*/ (data ^ 0xff);
+ }
+ }
+
+ m_old_p3 = data;
}
-READ16_MEMBER(bionicc_state::hacked_soundcommand_r)
+
+WRITE16_MEMBER(bionicc_state::mpu_trigger_w)
{
- return m_soundcommand;
-}
+ m_mcu->set_input_line(MCS51_INT0_LINE, ASSERT_LINE);
+ m_maincpu->suspend(SUSPEND_REASON_HALT, true); // see notes in f1dream driver
+}
/********************************************************************
@@ -151,11 +169,10 @@ TIMER_DEVICE_CALLBACK_MEMBER(bionicc_state::scanline)
if(scanline == 240) // vblank-out irq
m_maincpu->set_input_line(2, HOLD_LINE);
- if(scanline == 0) // vblank-in or i8751 related irq
+ if(scanline == 128) // vblank-in or i8751 related irq (can't happen when the CPU is suspended)
m_maincpu->set_input_line(4, HOLD_LINE);
}
-
/*************************************
*
* Address maps
@@ -168,19 +185,17 @@ void bionicc_state::main_map(address_map &map)
map(0xfe0000, 0xfe07ff).ram(); /* RAM? */
map(0xfe0800, 0xfe0cff).ram().share("spriteram");
map(0xfe0d00, 0xfe3fff).ram(); /* RAM? */
- map(0xfe4000, 0xfe4001).w(this, FUNC(bionicc_state::gfxctrl_w)); /* + coin counters */
map(0xfe4000, 0xfe4001).portr("SYSTEM");
- map(0xfe4002, 0xfe4003).portr("DSW");
+ map(0xfe4000, 0xfe4001).w(this, FUNC(bionicc_state::gfxctrl_w)); /* + coin counters */
+ map(0xfe4002, 0xfe4003).portr("DSW").nopw();
map(0xfe8010, 0xfe8017).w(this, FUNC(bionicc_state::scroll_w));
map(0xfe8018, 0xfe8019).nopw(); // vblank irq ack?
- map(0xfe801a, 0xfe801b).w(this, FUNC(bionicc_state::mpu_trigger_w)); /* ??? not sure, but looks like it */
+ map(0xfe801a, 0xfe801b).w(this, FUNC(bionicc_state::mpu_trigger_w)); // based on the code this looks like the MCU trigger if compared to F1 Dream, but 0xfe4002 would match up closer in terms of addresses. Maybe this is IRQ4 related instead?
map(0xfec000, 0xfecfff).ram().w(this, FUNC(bionicc_state::txvideoram_w)).share("txvideoram");
map(0xff0000, 0xff3fff).ram().w(this, FUNC(bionicc_state::fgvideoram_w)).share("fgvideoram");
map(0xff4000, 0xff7fff).ram().w(this, FUNC(bionicc_state::bgvideoram_w)).share("bgvideoram");
map(0xff8000, 0xff87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
- map(0xffc000, 0xfffff7).ram(); /* working RAM */
- map(0xfffff8, 0xfffff9).rw(this, FUNC(bionicc_state::hacked_soundcommand_r), FUNC(bionicc_state::hacked_soundcommand_w)); /* hack */
- map(0xfffffa, 0xffffff).rw(this, FUNC(bionicc_state::hacked_controls_r), FUNC(bionicc_state::hacked_controls_w)); /* hack */
+ map(0xffc000, 0xffffff).ram().share("ram16");
}
@@ -192,6 +207,10 @@ void bionicc_state::sound_map(address_map &map)
map(0xc000, 0xc7ff).ram();
}
+void bionicc_state::mcu_io(address_map &map)
+{
+ map(0x000, 0x7ff).rw(this, FUNC(bionicc_state::mcu_shared_r), FUNC(bionicc_state::mcu_shared_w));
+}
/*************************************
*
@@ -354,21 +373,15 @@ GFXDECODE_END
void bionicc_state::machine_start()
{
- save_item(NAME(m_soundcommand));
- save_item(NAME(m_inp));
save_item(NAME(m_scroll));
}
void bionicc_state::machine_reset()
{
- m_inp[0] = 0;
- m_inp[1] = 0;
- m_inp[2] = 0;
m_scroll[0] = 0;
m_scroll[1] = 0;
m_scroll[2] = 0;
m_scroll[3] = 0;
- m_soundcommand = 0;
}
MACHINE_CONFIG_START(bionicc_state::bionicc)
@@ -378,7 +391,6 @@ MACHINE_CONFIG_START(bionicc_state::bionicc)
MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", bionicc_state, scanline, "screen", 0, 1)
- /* Protection MCU Intel C8751H-88 runs at 24MHz / 4 = 6MHz */
MCFG_CPU_ADD("audiocpu", Z80, XTAL(14'318'181) / 4) /* EXO3 C,B=GND, A=5V ==> Divisor 2^2 */
MCFG_CPU_PROGRAM_MAP(sound_map)
@@ -388,6 +400,11 @@ MACHINE_CONFIG_START(bionicc_state::bionicc)
*/
MCFG_CPU_PERIODIC_INT_DRIVER(bionicc_state, nmi_line_pulse, 4*60)
+ /* Protection MCU Intel C8751H-88 runs at 24MHz / 4 = 6MHz */
+ MCFG_CPU_ADD("mcu", I8751, XTAL(24'000'000) / 4)
+ MCFG_CPU_IO_MAP(mcu_io)
+ MCFG_MCS51_PORT_P1_OUT_CB(WRITE8(bionicc_state, out1_w))
+ MCFG_MCS51_PORT_P3_OUT_CB(WRITE8(bionicc_state, out3_w))
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -434,7 +451,7 @@ ROM_START( bionicc ) /* "Not for use in Japan" */
ROM_LOAD( "ts_01b.4e", 0x00000, 0x8000, CRC(a9a6cafa) SHA1(55e0a0e6ca11e8e73339d5b4604e130031211291) )
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */
- ROM_LOAD( "c8751h-88", 0x0000, 0x1000, NO_DUMP )
+ ROM_LOAD( "d8751h.bin", 0x0000, 0x1000, CRC(3ed7f0be) SHA1(db9e972065c8e60b5d74762dc3424271ea9524cb) ) /* from 'topsecrt' bootleg, but appears to be original */
ROM_REGION( 0x08000, "gfx1", 0 )
ROM_LOAD( "tsu_08.8l", 0x00000, 0x8000, CRC(9bf0b7a2) SHA1(1361335c3c2c8a9c6a7d99566048d8aac99e7c8f) ) /* VIDEORAM (text layer) tiles */
@@ -478,7 +495,7 @@ ROM_START( bionicc1 ) /* "Not for use outside of USA or Canada" revision B */
ROM_LOAD( "ts_01b.4e", 0x00000, 0x8000, CRC(a9a6cafa) SHA1(55e0a0e6ca11e8e73339d5b4604e130031211291) )
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */
- ROM_LOAD( "c8751h-88", 0x0000, 0x1000, NO_DUMP )
+ ROM_LOAD( "d8751h.bin", 0x0000, 0x1000, CRC(3ed7f0be) SHA1(db9e972065c8e60b5d74762dc3424271ea9524cb) ) /* from 'topsecrt' bootleg, but appears to be original */
ROM_REGION( 0x08000, "gfx1", 0 )
ROM_LOAD( "tsu_08.8l", 0x00000, 0x8000, CRC(9bf0b7a2) SHA1(1361335c3c2c8a9c6a7d99566048d8aac99e7c8f) ) /* VIDEORAM (text layer) tiles */
@@ -522,7 +539,7 @@ ROM_START( bionicc2 ) /* "Not for use outside of USA or Canada" 1st release */
ROM_LOAD( "ts_01b.4e", 0x00000, 0x8000, CRC(a9a6cafa) SHA1(55e0a0e6ca11e8e73339d5b4604e130031211291) )
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */
- ROM_LOAD( "c8751h-88", 0x0000, 0x1000, NO_DUMP )
+ ROM_LOAD( "d8751h.bin", 0x0000, 0x1000, CRC(3ed7f0be) SHA1(db9e972065c8e60b5d74762dc3424271ea9524cb) ) /* from 'topsecrt' bootleg, but appears to be original */
ROM_REGION( 0x08000, "gfx1", 0 )
ROM_LOAD( "tsu_08.8l", 0x00000, 0x8000, CRC(9bf0b7a2) SHA1(1361335c3c2c8a9c6a7d99566048d8aac99e7c8f) ) /* VIDEORAM (text layer) tiles */
@@ -566,8 +583,7 @@ ROM_START( topsecrt ) /* "Not for use in any other country but Japan" */
ROM_LOAD( "ts_01.4e", 0x00000, 0x8000, CRC(8ea07917) SHA1(e9ace70d89482fc3669860450a41aacacbee9083) )
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */
- //ROM_LOAD( "c8751h-88", 0x0000, 0x1000, NO_DUMP )
- ROM_LOAD( "d8751h.bin", 0x0000, 0x1000, CRC(3ed7f0be) SHA1(db9e972065c8e60b5d74762dc3424271ea9524cb) )
+ ROM_LOAD( "d8751h.bin", 0x0000, 0x1000, CRC(3ed7f0be) SHA1(db9e972065c8e60b5d74762dc3424271ea9524cb) ) /* from 'topsecrt' bootleg, but appears to be original */
ROM_REGION( 0x08000, "gfx1", 0 )
ROM_LOAD( "ts_08.8l", 0x00000, 0x8000, CRC(96ad379e) SHA1(accd3a560b259c186bc28cdc004ed8de0b12f9d5) ) /* VIDEORAM (text layer) tiles */
@@ -611,7 +627,7 @@ ROM_START( bioniccbl )
ROM_LOAD( "01.bin", 0x00000, 0x8000, CRC(8ea07917) SHA1(e9ace70d89482fc3669860450a41aacacbee9083) )
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */
- ROM_LOAD( "c8751h-88", 0x0000, 0x1000, NO_DUMP ) // 19.bin (protected)
+ ROM_LOAD( "d8751h.bin", 0x0000, 0x1000, CRC(3ed7f0be) SHA1(db9e972065c8e60b5d74762dc3424271ea9524cb) ) /* from 'topsecrt' bootleg, but appears to be original */
ROM_REGION( 0x08000, "gfx1", 0 )
ROM_LOAD( "06.bin", 0x00000, 0x4000, CRC(4e6b81d9) SHA1(052784d789b0c9193edf218fa1883b6e3b7df988) )
@@ -651,7 +667,7 @@ ROM_START( bioniccbl2 ) // only the 4 maincpu ROMs differ, they came from an ori
ROM_LOAD( "ts_01.4e", 0x00000, 0x8000, CRC(8ea07917) SHA1(e9ace70d89482fc3669860450a41aacacbee9083) )
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */
- ROM_LOAD( "c8751h-88", 0x0000, 0x1000, NO_DUMP )
+ ROM_LOAD( "d8751h.bin", 0x0000, 0x1000, CRC(3ed7f0be) SHA1(db9e972065c8e60b5d74762dc3424271ea9524cb) ) /* from 'topsecrt' bootleg, but appears to be original */
ROM_REGION( 0x08000, "gfx1", 0 )
ROM_LOAD( "ts_08.8l", 0x00000, 0x8000, CRC(96ad379e) SHA1(accd3a560b259c186bc28cdc004ed8de0b12f9d5) ) /* VIDEORAM (text layer) tiles */