summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/wyvernf0.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/wyvernf0.cpp')
-rw-r--r--src/mame/drivers/wyvernf0.cpp58
1 files changed, 19 insertions, 39 deletions
diff --git a/src/mame/drivers/wyvernf0.cpp b/src/mame/drivers/wyvernf0.cpp
index 964209360fd..09761cf9fde 100644
--- a/src/mame/drivers/wyvernf0.cpp
+++ b/src/mame/drivers/wyvernf0.cpp
@@ -34,6 +34,7 @@ TODO:
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m6805/m6805.h"
+#include "machine/taito68705interface.h"
#include "machine/gen_latch.h"
#include "sound/ay8910.h"
#include "sound/msm5232.h"
@@ -55,7 +56,7 @@ public:
m_spriteram(*this,"spriteram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
- m_mcu(*this, "mcu"),
+ m_bmcu(*this, "bmcu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch")
@@ -100,17 +101,12 @@ private:
DECLARE_WRITE8_MEMBER(nmi_enable_w);
TIMER_CALLBACK_MEMBER(nmi_callback);
- // MCU
- uint8_t m_mcu_val, m_mcu_ready;
-
- DECLARE_READ8_MEMBER(fake_mcu_r);
- DECLARE_WRITE8_MEMBER(fake_mcu_w);
- DECLARE_READ8_MEMBER(fake_status_r);
+ DECLARE_READ8_MEMBER(mcu_status_r);
// devices
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
- optional_device<cpu_device> m_mcu;
+ required_device<taito68705_mcu_device> m_bmcu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
@@ -302,26 +298,13 @@ if (machine().input().code_pressed(KEYCODE_Z))
***************************************************************************/
-READ8_MEMBER(wyvernf0_state::fake_mcu_r)
-{
- int result = 0;
-
- if ((m_mcu_val & 0x73) == 0x73)
- result = 0x42; // at boot
-
- return result;
-}
-
-WRITE8_MEMBER(wyvernf0_state::fake_mcu_w)
-{
- m_mcu_val = data;
-}
-
-READ8_MEMBER(wyvernf0_state::fake_status_r)
+READ8_MEMBER(wyvernf0_state::mcu_status_r)
{
- // bit 0 = ok to write
- // bit 1 = ok to read
- return 0x03;
+ // bit 0 = when 1, MCU is ready to receive data from main CPU
+ // bit 1 = when 1, MCU has sent data to the main CPU
+ return
+ ((CLEAR_LINE == m_bmcu->host_semaphore_r()) ? 0x01 : 0x00) |
+ ((CLEAR_LINE != m_bmcu->mcu_semaphore_r()) ? 0x02 : 0x00);
}
@@ -410,8 +393,8 @@ void wyvernf0_state::wyvernf0_map(address_map &map)
map(0xd300, 0xd303).ram().share("scrollram");
- map(0xd400, 0xd400).rw(FUNC(wyvernf0_state::fake_mcu_r), FUNC(wyvernf0_state::fake_mcu_w));
- map(0xd401, 0xd401).r(FUNC(wyvernf0_state::fake_status_r));
+ map(0xd400, 0xd400).rw(m_bmcu, FUNC(taito68705_mcu_device::data_r), FUNC(taito68705_mcu_device::data_w));
+ map(0xd401, 0xd401).r(FUNC(wyvernf0_state::mcu_status_r));
map(0xd500, 0xd5ff).ram().share("spriteram");
@@ -634,8 +617,6 @@ void wyvernf0_state::machine_start()
save_item(NAME(m_pending_nmi));
save_item(NAME(m_rombank));
save_item(NAME(m_rambank));
- save_item(NAME(m_mcu_val));
- save_item(NAME(m_mcu_ready));
}
void wyvernf0_state::machine_reset()
@@ -644,8 +625,6 @@ void wyvernf0_state::machine_reset()
m_pending_nmi = 0;
m_rombank = 0;
m_rambank = 0;
- m_mcu_val = 0;
- m_mcu_ready = 0;
}
void wyvernf0_state::wyvernf0(machine_config &config)
@@ -659,9 +638,10 @@ void wyvernf0_state::wyvernf0(machine_config &config)
m_audiocpu->set_addrmap(AS_PROGRAM, &wyvernf0_state::sound_map);
m_audiocpu->set_periodic_int(FUNC(wyvernf0_state::irq0_line_hold), attotime::from_hz(60*2)); // IRQ generated by ??? (drives music tempo), NMI by main cpu
-// M68705P5(config, "mcu", 48_MHz_XTAL/12); // 4MHz - Clock not verified
+ TAITO68705_MCU(config, m_bmcu, 48_MHz_XTAL/12); // 4MHz - Clock not verified
-// config.m_minimum_quantum = attotime::from_hz(6000); // 100 CPU slices per second to synchronize between the MCU and the main CPU
+ /* 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs */
+ config.m_minimum_quantum = attotime::from_hz(6000);
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@@ -729,8 +709,8 @@ ROM_START( wyvernf0 )
ROM_LOAD( "a39_16.ic26", 0x0000, 0x4000, CRC(5a681fb4) SHA1(e31e751a54fa9853acb462ce22dd2ff5286808f0) )
ROM_FILL( 0xe000, 0x2000, 0xff ) // diagnostics ROM
- ROM_REGION( 0x0800, "mcu", 0 ) // protected 68705P5 MCU
- ROM_LOAD( "a39_mcu.ic23", 0x0000, 0x0800, NO_DUMP )
+ ROM_REGION( 0x0800, "bmcu:mcu", 0 ) // 68705P5 MCU
+ ROM_LOAD( "a39_mc68705p5s.ic23", 0x0000, 0x0800, CRC(14bff574) SHA1(c91446540e7628b3e62135e2f560a118f7e0dad4) ) /* from other set, appears to be correct */
ROM_REGION( 0x10000, "sprites", 0 ) // sprites
ROM_LOAD( "a39_11.ic99", 0x0000, 0x4000, CRC(af70e1dc) SHA1(98dba673750cdfdf25c119c24da10428eff6591b) )
@@ -760,8 +740,8 @@ ROM_START( wyvernf0a ) /* Possibly the first version or even an earlier developm
ROM_LOAD( "sound_4182.ic26", 0x0000, 0x4000, CRC(5a681fb4) SHA1(e31e751a54fa9853acb462ce22dd2ff5286808f0) ) /* == a39_16.ic26 */
ROM_FILL( 0xe000, 0x2000, 0xff ) // diagnostics ROM
- ROM_REGION( 0x0800, "mcu", 0 ) // protected 68705P5 MCU
- ROM_LOAD( "mc68705p5s.ic23", 0x0000, 0x0800, NO_DUMP ) /* hand written label P5 5/1 */
+ ROM_REGION( 0x0800, "bmcu:mcu", 0 ) // 68705P5 MCU
+ ROM_LOAD( "a39_mc68705p5s.ic23", 0x0000, 0x0800, CRC(14bff574) SHA1(c91446540e7628b3e62135e2f560a118f7e0dad4) ) /* hand written label P5 5/1 - part was unprotected */
ROM_REGION( 0x10000, "sprites", 0 ) // sprites - These 4 ROMs had hand written labels
ROM_LOAD( "obj4_d779.ic99", 0x0000, 0x4000, CRC(af70e1dc) SHA1(98dba673750cdfdf25c119c24da10428eff6591b) ) /* == a39_11.ic99 */