summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <salese_corp_ltd@email.it>2017-01-02 07:36:50 +0100
committer angelosa <salese_corp_ltd@email.it>2017-01-02 07:36:50 +0100
commitb766dee2159330b28ba880768a1a8fa9666df8a3 (patch)
tree89504bd44e24af420b0b8cde818fb4d33afd68e8
parent466e36dbb08b88b010ff1213a4959b9ca056e7c1 (diff)
Fix gsword.cpp (nw)
-rw-r--r--src/mame/drivers/gsword.cpp447
1 files changed, 293 insertions, 154 deletions
diff --git a/src/mame/drivers/gsword.cpp b/src/mame/drivers/gsword.cpp
index 7e7c2234c43..3d50ca8a73e 100644
--- a/src/mame/drivers/gsword.cpp
+++ b/src/mame/drivers/gsword.cpp
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Steve Ellenoff,Jarek Parchanski
+// copyright-holders:Steve Ellenoff,Jarek Parchanski,Vas Crabb
/*
Great Swordsman (Taito) 1984
Joshi Volleyball (Taito) 1983
@@ -9,9 +9,9 @@ TODO:
-joshi volleyball
-The incomplete graphic
-The implementation of DAC sound ?
- -MCU code DUMP and emulation
+ -MCU hookup is incomplete
-The true interrupt circuit of SUB CPU
- -unknown ROM (BANK ROM of sub-cpu ? )
+ -unknown ROM (BANK ROM of sub-cpu ?)
Credits:
- Steve Ellenoff: Original emulation and Mame driver
@@ -146,6 +146,7 @@ reg: 0->1 (main->2nd) / : (1->0) 2nd->main :
#include "emu.h"
#include "includes/gsword.h"
+#include "cpu/mcs48/mcs48.h"
#include "cpu/z80/z80.h"
#include "machine/i8255.h"
#include "machine/tait8741.h"
@@ -166,20 +167,48 @@ int gsword_state::coins_in(void)
}
#endif
-#include "cpu/z80/z80.h"
+void gsword_state_base::machine_start()
+{
+ save_item(NAME(m_fake8910_0));
+ save_item(NAME(m_fake8910_1));
+}
+
+void gsword_state_base::machine_reset()
+{
+}
+
+WRITE8_MEMBER(gsword_state_base::ay8910_control_port_0_w)
+{
+ m_ay0->address_w(space,offset,data);
+ m_fake8910_0 = data;
+}
+WRITE8_MEMBER(gsword_state_base::ay8910_control_port_1_w)
+{
+ m_ay1->address_w(space,offset,data);
+ m_fake8910_1 = data;
+}
+
+READ8_MEMBER(gsword_state_base::fake_0_r)
+{
+ return m_fake8910_0+1;
+}
+READ8_MEMBER(gsword_state_base::fake_1_r)
+{
+ return m_fake8910_1+1;
+}
/* CPU 2 memory hack */
/* (402E) timeout upcount must be under 0AH */
/* (4004,4005) clear down counter , if (4004,4005)==0 then (402E)=0 */
-READ8_MEMBER(gsword_state::gsword_hack_r)
+READ8_MEMBER(gsword_state::hack_r)
{
- uint8_t data = m_cpu2_ram[offset + 4];
+ u8 const data = m_cpu2_ram[offset + 4];
/*if(offset==1)osd_printf_debug("CNT %02X%02X\n",m_cpu2_ram[5],m_cpu2_ram[4]); */
/* speedup timeout count down */
- if(m_protect_hack)
+ if (m_protect_hack)
{
switch(offset)
{
@@ -190,7 +219,55 @@ READ8_MEMBER(gsword_state::gsword_hack_r)
return data;
}
-READ8_MEMBER(gsword_state::gsword_8741_2_r )
+WRITE8_MEMBER(gsword_state::nmi_set_w)
+{
+/* osd_printf_debug("AY write %02X\n",data);*/
+
+ m_protect_hack = (data & 0x80) ? false : true;
+#if 0
+ /* An actual circuit isn't known. */
+ /* write ff,02,ff,fe, 17 x 0d,0f */
+ m_nmi_enable = ((data>>7) & (data&1) &1) == 0;
+
+
+#else
+ switch(data)
+ {
+ case 0xff:
+ m_nmi_enable = false; /* NMI must be disabled */
+ break;
+ case 0x02:
+ m_nmi_enable = false; /* ANY */
+ break;
+ case 0x0d:
+ m_nmi_enable = true;
+ break;
+ case 0x0f:
+ m_nmi_enable = true; /* NMI must be enabled */
+ break;
+ case 0xfe:
+ m_nmi_enable = true; /* NMI must be enabled */
+ break;
+ }
+ /* bit1= nmi disable , for ram check */
+ logerror("NMI control %02x\n",data);
+#endif
+}
+
+WRITE8_MEMBER(gsword_state::sound_command_w)
+{
+ m_soundlatch->write(space, 0, data);
+ m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
+}
+
+WRITE8_MEMBER(gsword_state::adpcm_data_w)
+{
+ m_msm->data_w(data & 0x0f); // bit 0..3
+ m_msm->reset_w(BIT(data, 5)); // bit 5
+ m_msm->vclk_w(BIT(data, 4)); // bit 4
+}
+
+READ8_MEMBER(gsword_state::i8741_2_r )
{
switch (offset)
{
@@ -207,7 +284,7 @@ READ8_MEMBER(gsword_state::gsword_8741_2_r )
return 0;
}
-READ8_MEMBER(gsword_state::gsword_8741_3_r )
+READ8_MEMBER(gsword_state::i8741_3_r )
{
switch (offset)
{
@@ -223,99 +300,166 @@ READ8_MEMBER(gsword_state::gsword_8741_3_r )
return 0;
}
+INTERRUPT_GEN_MEMBER(gsword_state::sound_interrupt)
+{
+ if (m_nmi_enable)
+ device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
+}
+
+DRIVER_INIT_MEMBER(gsword_state, gsword)
+{
+#if 0
+ uint8_t *ROM2 = memregion("sub")->base();
+ ROM2[0x1da] = 0xc3; /* patch for rom self check */
+
+ ROM2[0x71e] = 0; /* patch for sound protection or time out function */
+ ROM2[0x71f] = 0;
+#endif
+#if 1
+ /* hack for sound protection or time out function */
+ m_subcpu->space(AS_PROGRAM).install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::hack_r),this));
+#endif
+}
+
+DRIVER_INIT_MEMBER(gsword_state, gsword2)
+{
+#if 0
+ uint8_t *ROM2 = memregion("sub")->base();
+
+ ROM2[0x1da] = 0xc3; /* patch for rom self check */
+ ROM2[0x726] = 0; /* patch for sound protection or time out function */
+ ROM2[0x727] = 0;
+#endif
+#if 1
+ /* hack for sound protection or time out function */
+ m_subcpu->space(AS_PROGRAM).install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::hack_r),this));
+#endif
+}
+
void gsword_state::machine_start()
{
- save_item(NAME(m_fake8910_0));
- save_item(NAME(m_fake8910_1));
- save_item(NAME(m_nmi_enable));
+ gsword_state_base::machine_start();
+
save_item(NAME(m_protect_hack));
+ save_item(NAME(m_nmi_enable));
}
void gsword_state::machine_reset()
{
- m_coins = 0;
+ gsword_state_base::machine_reset();
- /* snd CPU mask NMI during reset phase */
- m_nmi_enable = 0;
- m_protect_hack = 0;
+ m_protect_hack = false;
+ m_nmi_enable = false;
}
-INTERRUPT_GEN_MEMBER(gsword_state::gsword_snd_interrupt)
+
+READ8_MEMBER(josvolly_state::mcu1_p1_r)
{
- if(m_nmi_enable)
- device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
+ // the two MCUs appear to have port 1 tied together
+ return m_mcu1_p1 & m_mcu2_p1;
}
-WRITE8_MEMBER(gsword_state::nmi_set_w)
+READ8_MEMBER(josvolly_state::mcu1_p2_r)
{
-/* osd_printf_debug("AY write %02X\n",data);*/
+ // p27 needs to float high for the MCU to start in the right mode
+ // p20 and p21 drive the test inputs of the other MCU
+ // if DIPSW1:8 is allowed to pull p27 low, the game won't even boot to test mode
+ // DIPSW1:1 and DIPSW1:2 are shown in test mode, but switching them on will break comms
+ return 0x80U | ioport("DSW1")->read();
+}
- m_protect_hack = (data&0x80) ? 0 : 1;
-#if 0
- /* An actual circuit isn't known. */
- /* write ff,02,ff,fe, 17 x 0d,0f */
- m_nmi_enable = ((data>>7) & (data&1) &1) == 0;
+READ8_MEMBER(josvolly_state::mcu2_p1_r)
+{
+ // the two MCUs appear to have port 1 tied together
+ return m_mcu1_p1 & m_mcu2_p1;
+}
+READ8_MEMBER(josvolly_state::mcu2_p2_r)
+{
+ // p27 needs to be tied low for the MCU to start in the right mode
+ return 0x7fU & ioport("DSW2")->read();
+}
-#else
- switch(data)
- {
- case 0xff:
- m_nmi_enable = 0; /* NMI must be disabled */
- break;
- case 0x02:
- m_nmi_enable = 0; /* ANY */
- break;
- case 0x0d:
- m_nmi_enable = 1;
- break;
- case 0x0f:
- m_nmi_enable = 1; /* NMI must be enabled */
- break;
- case 0xfe:
- m_nmi_enable = 1; /* NMI must be enabled */
- break;
- }
- /* bit1= nmi disable , for ram check */
- logerror("NMI control %02x\n",data);
-#endif
+READ8_MEMBER(josvolly_state::mcu2_test_r)
+{
+ // TEST0 and TEST1 are driven by P20 and P21 on the other MCU
+ return BIT(m_mcu1_p2, offset);
}
-WRITE8_MEMBER(gsword_state::ay8910_control_port_0_w)
+WRITE8_MEMBER(josvolly_state::cpu2_nmi_enable_w)
{
- m_ay0->address_w(space,offset,data);
- m_fake8910_0 = data;
+ m_cpu2_nmi_enable = true;
+}
+
+WRITE8_MEMBER(josvolly_state::cpu2_irq_clear_w)
+{
+ m_audiocpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
}
-WRITE8_MEMBER(gsword_state::ay8910_control_port_1_w)
+
+WRITE8_MEMBER(josvolly_state::mcu1_p1_w)
{
- m_ay1->address_w(space,offset,data);
- m_fake8910_1 = data;
+ if (data != m_mcu1_p1)
+ {
+ logerror("mcu1 p1 = 0x%02x\n", data);
+ m_mcu1_p1 = data;
+ }
}
-READ8_MEMBER(gsword_state::fake_0_r)
+WRITE8_MEMBER(josvolly_state::mcu1_p2_w)
{
- return m_fake8910_0+1;
+ if (data != m_mcu1_p2)
+ {
+ logerror("mcu1 p2 = 0x%02x\n", data);
+
+ // the second CPU somehow gets an NMI when data is available
+ // it's probably implemented by the logic arrays somehow
+ // this is just a hacky guess at how it works
+ if (m_cpu2_nmi_enable && (data & (data ^ m_mcu1_p2) & 0x01))
+ {
+ m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
+ m_cpu2_nmi_enable = false;
+ }
+
+ m_mcu1_p2 = data;
+ }
}
-READ8_MEMBER(gsword_state::fake_1_r)
+
+WRITE8_MEMBER(josvolly_state::mcu2_p1_w)
{
- return m_fake8910_1+1;
+ if (data != m_mcu2_p1)
+ {
+ logerror("mcu2 p1 = 0x%02x\n", data);
+ m_mcu2_p1 = data;
+ }
}
-WRITE8_MEMBER(gsword_state::gsword_adpcm_data_w)
+WRITE8_MEMBER(josvolly_state::mcu2_p2_w)
{
- m_msm->data_w (data & 0x0f); /* bit 0..3 */
- m_msm->reset_w(BIT(data, 5)); /* bit 5 */
- m_msm->vclk_w(BIT(data, 4)); /* bit 4 */
+ logerror("mcu2 p2 = 0x%02x\n", data);
}
-WRITE8_MEMBER(gsword_state::adpcm_soundcommand_w)
+void josvolly_state::machine_start()
{
- m_soundlatch->write(space, 0, data);
- m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
+ gsword_state_base::machine_start();
+
+ save_item(NAME(m_cpu2_nmi_enable));
+ save_item(NAME(m_mcu1_p1));
+ save_item(NAME(m_mcu1_p2));
+ save_item(NAME(m_mcu2_p1));
+}
+
+void josvolly_state::machine_reset()
+{
+ gsword_state_base::machine_reset();
+
+ m_cpu2_nmi_enable = false;
+ m_mcu1_p1 = 0xffU;
+ m_mcu1_p2 = 0xffU;
+ m_mcu2_p1 = 0xffU;
}
-static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM , 8, gsword_state )
+static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM , 8, gsword_state_base )
AM_RANGE(0x0000, 0x8fff) AM_ROM
AM_RANGE(0x9000, 0x9fff) AM_RAM
AM_RANGE(0xa000, 0xa37f) AM_RAM
@@ -329,21 +473,16 @@ static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM , 8, gsword_state )
AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
ADDRESS_MAP_END
+
static ADDRESS_MAP_START( cpu1_io_map, AS_IO, 8, gsword_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x7e, 0x7f) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_0, write_0)
ADDRESS_MAP_END
-static ADDRESS_MAP_START( josvolly_cpu1_io_map, AS_IO, 8, gsword_state )
- ADDRESS_MAP_GLOBAL_MASK(0xff)
- AM_RANGE(0x7e, 0x7f) AM_DEVREADWRITE("josvolly_8741", josvolly8741_4pack_device, read_0, write_0)
-ADDRESS_MAP_END
-
-//
static ADDRESS_MAP_START( cpu2_map, AS_PROGRAM, 8, gsword_state )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x43ff) AM_RAM AM_SHARE("cpu2_ram")
- AM_RANGE(0x6000, 0x6000) AM_WRITE(adpcm_soundcommand_w)
+ AM_RANGE(0x6000, 0x6000) AM_WRITE(sound_command_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( cpu2_io_map, AS_IO, 8, gsword_state )
@@ -355,44 +494,58 @@ static ADDRESS_MAP_START( cpu2_io_map, AS_IO, 8, gsword_state )
AM_RANGE(0x61, 0x61) AM_DEVREADWRITE("ay1", ay8910_device, data_r, data_w)
AM_RANGE(0x80, 0x80) AM_READWRITE(fake_1_r, ay8910_control_port_1_w)
AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("ay2", ay8910_device, data_r, data_w)
-//
+
AM_RANGE(0xe0, 0xe0) AM_READNOP /* ?? */
AM_RANGE(0xa0, 0xa0) AM_WRITENOP /* ?? */
- AM_RANGE(0xe0, 0xe0) AM_WRITENOP /* watch dog ?*/
+ AM_RANGE(0xe0, 0xe0) AM_WRITENOP /* watchdog? */
ADDRESS_MAP_END
-//
-
static ADDRESS_MAP_START( cpu3_map, AS_PROGRAM, 8, gsword_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
- AM_RANGE(0x8000, 0x8000) AM_WRITE(gsword_adpcm_data_w)
+ AM_RANGE(0x8000, 0x8000) AM_WRITE(adpcm_data_w)
AM_RANGE(0xa000, 0xa000) AM_DEVREAD("soundlatch", generic_latch_8_device, read)
ADDRESS_MAP_END
-static ADDRESS_MAP_START( josvolly_cpu2_map, AS_PROGRAM, 8, gsword_state )
+static ADDRESS_MAP_START( josvolly_cpu1_io_map, AS_IO, 8, josvolly_state )
+ ADDRESS_MAP_GLOBAL_MASK(0xff)
+ AM_RANGE(0x7e, 0x7f) AM_DEVREADWRITE("mcu1", upi41_cpu_device, upi41_master_r, upi41_master_w)
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( josvolly_cpu2_map, AS_PROGRAM, 8, josvolly_state )
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0x4000, 0x43ff) AM_RAM AM_SHARE("cpu2_ram")
/* NEC D8255A with silkscreen removed and replaced with "AA 007" */
- AM_RANGE(0x8000, 0x8003) AM_DEVREADWRITE("josvolly_aa_007", i8255_device, read, write)
+ AM_RANGE(0x8000, 0x8003) AM_DEVREADWRITE("aa_007", i8255_device, read, write)
// AM_RANGE(0x6000, 0x6000) AM_WRITE(adpcm_soundcommand_w)
- AM_RANGE(0xA000, 0xA001) AM_DEVREADWRITE("josvolly_8741", josvolly8741_4pack_device, read_1, write_1)
+ AM_RANGE(0xA000, 0xA001) AM_DEVREADWRITE("mcu2", upi41_cpu_device, upi41_master_r, upi41_master_w)
ADDRESS_MAP_END
-static ADDRESS_MAP_START( josvolly_cpu2_io_map, AS_IO, 8, gsword_state )
+static ADDRESS_MAP_START( josvolly_cpu2_io_map, AS_IO, 8, josvolly_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_READWRITE(fake_0_r, ay8910_control_port_0_w)
AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("ay1", ay8910_device, data_r, data_w)
AM_RANGE(0x40, 0x40) AM_READWRITE(fake_1_r, ay8910_control_port_1_w)
AM_RANGE(0x41, 0x41) AM_DEVREADWRITE("ay2", ay8910_device, data_r, data_w)
- AM_RANGE(0x81, 0x81) AM_DEVWRITE("josvolly_8741", josvolly8741_4pack_device, nmi_enable_w)
- AM_RANGE(0xC1, 0xC1) AM_NOP // irq clear
+ AM_RANGE(0x81, 0x81) AM_WRITE(cpu2_nmi_enable_w);
+ AM_RANGE(0xC1, 0xC1) AM_WRITE(cpu2_irq_clear_w);
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( josvolly_mcu1_io_map, AS_IO, 8, josvolly_state )
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(mcu1_p1_r, mcu1_p1_w)
+ AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mcu1_p2_r, mcu1_p2_w)
+ADDRESS_MAP_END
+static ADDRESS_MAP_START( josvolly_mcu2_io_map, AS_IO, 8, josvolly_state )
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(mcu2_p1_r, mcu2_p1_w)
+ AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(mcu2_p2_r, mcu2_p2_w)
+ AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T1) AM_READ(mcu2_test_r)
ADDRESS_MAP_END
+
static INPUT_PORTS_START( gsword )
PORT_START("IN0") /* IN0 (8741-2 port1?) */
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
@@ -539,44 +692,55 @@ static INPUT_PORTS_START( josvolly )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START("DSW1") /* DSW1 */
- PORT_DIPNAME( 0x0c, 0x00, "DIP1-0c(982E)" )
+ PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("DIPSW1:1")
+ PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("DIPSW1:2")
+ PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x0c, 0x0c, "982E" ) PORT_DIPLOCATION("DIPSW1:3,4")
PORT_DIPSETTING( 0x0c, "0" )
PORT_DIPSETTING( 0x08, "1" )
- PORT_DIPSETTING( 0x00, "2" )
- PORT_DIPSETTING( 0x0c, "3" )
- PORT_DIPNAME( 0x30, 0x00, "DIP1-30(982A)" )
- PORT_DIPSETTING( 0x30, "96H" )
- PORT_DIPSETTING( 0x20, "78H" )
- PORT_DIPSETTING( 0x10, "5AH" )
- PORT_DIPSETTING( 0x00, "3CH" )
- PORT_DIPNAME( 0x40, 0x40, "TEST_MODE" )
+ PORT_DIPSETTING( 0x04, "2" )
+ PORT_DIPSETTING( 0x00, "3" )
+ PORT_DIPNAME( 0x30, 0x30, "982A" ) PORT_DIPLOCATION("DIPSW1:5,6")
+ PORT_DIPSETTING( 0x00, "60" )
+ PORT_DIPSETTING( 0x10, "90" )
+ PORT_DIPSETTING( 0x20, "120" )
+ PORT_DIPSETTING( 0x30, "150" )
+ PORT_DIPNAME( 0x40, 0x40, "TEST_MODE" ) PORT_DIPLOCATION("DIPSW1:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x80, 0x80, "DIP1-80(982C)" )
- PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x80, DEF_STR( On ) )
+ PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("DIPSW1:8")
+ PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW2") /* DSW2 */
-// PORT_DIPNAME( 0x01, 0x00, "DSW2-0" )
-// PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
-// PORT_DIPSETTING( 0x01, DEF_STR( On ) )
-// PORT_DIPNAME( 0x02, 0x00, "DSW2-1($9831)" )
-// PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
-// PORT_DIPSETTING( 0x02, DEF_STR( On ) )
- PORT_DIPNAME( 0x0C, 0x0C, DEF_STR( Coin_A ) )
+ PORT_DIPNAME( 0x01, 0x01, "982C" ) PORT_DIPLOCATION("DIPSW2:8")
+ PORT_DIPSETTING( 0x01, "0" )
+ PORT_DIPSETTING( 0x00, "1" )
+ PORT_DIPNAME( 0x02, 0x02, "9831" ) PORT_DIPLOCATION("DIPSW2:7")
+ PORT_DIPSETTING( 0x02, "0" )
+ PORT_DIPSETTING( 0x00, "1" )
+ PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("DIPSW2:6,5")
PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) )
- PORT_DIPSETTING( 0x0C, DEF_STR( 1C_1C ) )
- PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_B ) )
+ PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) )
+ PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("DIPSW2:4,3")
PORT_DIPSETTING( 0x30, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) )
-// PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
-// PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
+ PORT_DIPNAME( 0x40, 0x40, "9827" ) PORT_DIPLOCATION("DIPSW2:2")
+ PORT_DIPSETTING( 0x40, "1" )
+ PORT_DIPSETTING( 0x00, "3" )
+ PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("DIPSW2:1")
+ PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
INPUT_PORTS_END
+
static const gfx_layout gsword_text =
{
8,8, /* 8x8 characters */
@@ -636,7 +800,7 @@ static MACHINE_CONFIG_START( gsword, gsword_state )
MCFG_CPU_ADD("sub", Z80, XTAL_18MHz/6) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(cpu2_map)
MCFG_CPU_IO_MAP(cpu2_io_map)
- MCFG_CPU_PERIODIC_INT_DRIVER(gsword_state, gsword_snd_interrupt, 4*60)
+ MCFG_CPU_PERIODIC_INT_DRIVER(gsword_state, sound_interrupt, 4*60)
MCFG_CPU_ADD("audiocpu", Z80, XTAL_18MHz/6) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(cpu3_map)
@@ -646,7 +810,7 @@ static MACHINE_CONFIG_START( gsword, gsword_state )
MCFG_TAITO8741_ADD("taito8741")
MCFG_TAITO8741_MODES(TAITO8741_MASTER,TAITO8741_SLAVE,TAITO8741_PORT,TAITO8741_PORT)
MCFG_TAITO8741_CONNECT(1,0,0,0)
- MCFG_TAITO8741_PORT_HANDLERS(IOPORT("DSW2"),IOPORT("DSW1"),READ8(gsword_state,gsword_8741_2_r),READ8(gsword_state,gsword_8741_3_r))
+ MCFG_TAITO8741_PORT_HANDLERS(IOPORT("DSW2"),IOPORT("DSW1"),READ8(gsword_state,i8741_2_r),READ8(gsword_state,i8741_3_r))
#if 1
/* to MCU timeout champbbj */
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
@@ -683,27 +847,32 @@ static MACHINE_CONFIG_START( gsword, gsword_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
MACHINE_CONFIG_END
-static MACHINE_CONFIG_START( josvolly, gsword_state )
+static MACHINE_CONFIG_START( josvolly, josvolly_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu", Z80, 18000000/6) /* ? */
+ MCFG_CPU_ADD("maincpu", Z80, 18000000/4) /* ? */
MCFG_CPU_PROGRAM_MAP(cpu1_map)
MCFG_CPU_IO_MAP(josvolly_cpu1_io_map)
- MCFG_CPU_PERIODIC_INT_DRIVER(gsword_state, irq0_line_hold, 2*60)
+ MCFG_CPU_PERIODIC_INT_DRIVER(josvolly_state, irq0_line_hold, 2*60)
MCFG_CPU_ADD("audiocpu", Z80, 12000000/4) /* ? */
MCFG_CPU_PROGRAM_MAP(josvolly_cpu2_map)
MCFG_CPU_IO_MAP(josvolly_cpu2_io_map)
- MCFG_CPU_VBLANK_INT_DRIVER("screen", gsword_state, irq0_line_hold)
+ MCFG_CPU_VBLANK_INT_DRIVER("screen", josvolly_state, irq0_line_assert)
+
+ MCFG_DEVICE_ADD("mcu1", I8741, 18000000/2) /* ? */
+ MCFG_CPU_IO_MAP(josvolly_mcu1_io_map)
+
+ MCFG_DEVICE_ADD("mcu2", I8741, 12000000/2) /* ? */
+ MCFG_CPU_IO_MAP(josvolly_mcu2_io_map)
- MCFG_DEVICE_ADD("josvolly_aa_007", I8255, 0)
+ MCFG_DEVICE_ADD("aa_007", I8255, 0)
MCFG_I8255_IN_PORTA_CB(IOPORT("IN1")) // 1PL
MCFG_I8255_IN_PORTB_CB(IOPORT("IN2")) // 2PL / ACK
MCFG_I8255_IN_PORTC_CB(IOPORT("IN0")) // START
- MCFG_JOSVOLLY8741_ADD("josvolly_8741")
- MCFG_JOSVOLLY8741_CONNECT(1,0,0,0)
- MCFG_JOSVOLLY8741_PORT_HANDLERS(IOPORT("DSW1"),IOPORT("DSW2"),IOPORT("DSW1"),IOPORT("DSW2"))
+ // the second MCU polls the first MCU's outputs, so it needs tight sync
+ MCFG_QUANTUM_PERFECT_CPU("mcu2")
/* video hardware */
@@ -712,13 +881,13 @@ static MACHINE_CONFIG_START( josvolly, gsword_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
- MCFG_SCREEN_UPDATE_DRIVER(gsword_state, screen_update_gsword)
+ MCFG_SCREEN_UPDATE_DRIVER(josvolly_state, screen_update_gsword)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", gsword)
MCFG_PALETTE_ADD("palette", 64*4+64*4)
MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(gsword_state,josvolly)
+ MCFG_PALETTE_INIT_OWNER(josvolly_state, josvolly)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -727,7 +896,6 @@ static MACHINE_CONFIG_START( josvolly, gsword_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
MCFG_SOUND_ADD("ay2", AY8910, 1500000)
- MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(gsword_state, nmi_set_w)) /* portA write */
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
#if 0
@@ -851,11 +1019,12 @@ ROM_START( josvolly )
ROM_REGION( 0x04000, "user1", 0 ) /* music data and samples - not sure where it's mapped */
ROM_LOAD( "aa0-14.4j", 0x0000, 0x2000, CRC(436fe91f) SHA1(feb29501090c6db911e13ce6e9935ba004b0ce7e) )
- // there are other undumped chips on this, not sure how many
- // not hooked up yet
- ROM_REGION( 0x400, "mcu", 0 )
+ ROM_REGION( 0x400, "mcu1", 0 )
ROM_LOAD( "aa003.bin", 0x0000, 0x400, CRC(68b399d9) SHA1(053482d12c2b714c23fc80ad0589a2afd258a5a6) )
+ ROM_REGION( 0x400, "mcu2", 0 )
+ ROM_LOAD( "aa008.bin", 0x0000, 0x400, CRC(68b399d9) SHA1(053482d12c2b714c23fc80ad0589a2afd258a5a6) BAD_DUMP )
+
ROM_REGION( 0x4000, "gfx1", 0 )
ROM_LOAD( "aa0-10.9n", 0x0000, 0x2000, CRC(207c4f42) SHA1(4cf2922d55cfc9e68cc07c3252ea3b5619b8aca5) ) /* tiles */
ROM_LOAD( "aa1-11.9p", 0x2000, 0x1000, CRC(c130464a) SHA1(9d23577b8aaaffeefff3d8f93668d1b2bd0ba3d9) )
@@ -878,37 +1047,7 @@ ROM_START( josvolly )
ROM_LOAD( "005.3h", 0x0440, 0x0020, CRC(e8d6dec0) SHA1(d15cba9a4b24255d41046b15c2409391ab13ce95) ) /* address decoder? not used */
ROM_END
-DRIVER_INIT_MEMBER(gsword_state,gsword)
-{
-#if 0
- uint8_t *ROM2 = memregion("sub")->base();
- ROM2[0x1da] = 0xc3; /* patch for rom self check */
-
- ROM2[0x71e] = 0; /* patch for sound protection or time out function */
- ROM2[0x71f] = 0;
-#endif
-#if 1
- /* hack for sound protection or time out function */
- m_subcpu->space(AS_PROGRAM).install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),this));
-#endif
-}
-
-DRIVER_INIT_MEMBER(gsword_state,gsword2)
-{
-#if 0
- uint8_t *ROM2 = memregion("sub")->base();
-
- ROM2[0x1da] = 0xc3; /* patch for rom self check */
- ROM2[0x726] = 0; /* patch for sound protection or time out function */
- ROM2[0x727] = 0;
-#endif
-#if 1
- /* hack for sound protection or time out function */
- m_subcpu->space(AS_PROGRAM).install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),this));
-#endif
-}
-
-GAME( 1983, josvolly, 0, josvolly, josvolly, driver_device, 0, ROT90, "Allumer / Taito Corporation", "Joshi Volleyball", MACHINE_UNEMULATED_PROTECTION | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
+GAME( 1983, josvolly, 0, josvolly, josvolly, driver_device, 0, ROT90, "Allumer / Taito Corporation", "Joshi Volleyball", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1984, gsword, 0, gsword, gsword, gsword_state, gsword, ROT0, "Allumer / Taito Corporation", "Great Swordsman (World?)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, gsword2, gsword, gsword, gsword, gsword_state, gsword2, ROT0, "Allumer / Taito Corporation", "Great Swordsman (Japan?)", MACHINE_SUPPORTS_SAVE )