summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-01-06 22:00:00 +1100
committer Vas Crabb <vas@vastheman.com>2017-01-07 02:02:42 +1100
commitb2a66f5f5dfa09ef04256f7ab47b106fdacfbf22 (patch)
treea1f7da4d43c65e966678dd74822857bf0f92d171
parent7b95b103796f4a281c92660624499ac5a24be610 (diff)
gladiatr.cpp: Improvements
* separate gladiatr and ppking state classes * hook up all four MCUs in greatgur * eliminate tagmap lookups on input read * this fixes coinage in greatgur (nw) When starting for the first time, greatgur will come up with one credit, and when doing an F3 reset it will randomly come up with one credit or no credits. I think this has something to do with the dodgy code for synchronising the master CPUs in the bootleg MCUs that depends on how MAME initialises memory. (The MCU dumps we have come from a bootleg set as far as I can ascertain.)
-rw-r--r--src/mame/drivers/gladiatr.cpp464
-rw-r--r--src/mame/includes/gladiatr.h205
-rw-r--r--src/mame/video/gladiatr.cpp42
3 files changed, 495 insertions, 216 deletions
diff --git a/src/mame/drivers/gladiatr.cpp b/src/mame/drivers/gladiatr.cpp
index 2fdda445943..b3182e0c4d9 100644
--- a/src/mame/drivers/gladiatr.cpp
+++ b/src/mame/drivers/gladiatr.cpp
@@ -1,5 +1,5 @@
// license:BSD-3-Clause
-// copyright-holders:Victor Trucco,Steve Ellenoff,Phil Stroffolino,Tatsuyuki Satoh,Tomasz Slanina,Nicola Salmoria
+// copyright-holders:Victor Trucco,Steve Ellenoff,Phil Stroffolino,Tatsuyuki Satoh,Tomasz Slanina,Nicola Salmoria,Vas Crabb
/***************************************************************************
Ping Pong King (c) Taito 1985
@@ -12,13 +12,15 @@ Credits:
Golden Castle Rom Set Support
- Phil Stroffolino: palette, sprites, misc video driver fixes
- Tatsuyuki Satoh: YM2203 sound improvements, NEC 8741 simulation, ADPCM with MC6809
-- Tomasz Slanina preliminary Ping Pong King driver
-- Nicola Salmoria clean up
+- Tomasz Slanina: preliminary Ping Pong King driver
+- Nicola Salmoria: clean up
+- Vas Crabb: MCU hookup
special thanks to:
- Camilty for precious hardware information and screenshots
- Jason Richmond for hardware information and misc. notes
- Joe Rounceville for schematics
+- JunoMan for measuring and tracing signals on a bootleg
- and everyone else who's offered support along the way!
@@ -184,13 +186,19 @@ TODO:
***************************************************************************/
#include "emu.h"
+#include "includes/gladiatr.h"
+
#include "cpu/m6809/m6809.h"
-#include "machine/tait8741.h"
+#include "cpu/mcs48/mcs48.h"
#include "cpu/z80/z80.h"
+
+#include "machine/clock.h"
+#include "machine/nvram.h"
+
+#include "machine/tait8741.h"
+
#include "sound/2203intf.h"
#include "sound/msm5205.h"
-#include "machine/nvram.h"
-#include "includes/gladiatr.h"
/*Rom bankswitching*/
@@ -202,42 +210,37 @@ WRITE8_MEMBER(gladiatr_state::gladiatr_bankswitch_w)
READ8_MEMBER(gladiatr_state::gladiator_dsw1_r )
{
- int orig = ioport("DSW1")->read()^0xff;
-
- return BITSWAP8(orig, 0,1,2,3,4,5,6,7);
+ return BITSWAP8(~m_dsw1->read(), 0,1,2,3,4,5,6,7);
}
READ8_MEMBER(gladiatr_state::gladiator_dsw2_r )
{
- int orig = ioport("DSW2")->read()^0xff;
-
- return BITSWAP8(orig, 2,3,4,5,6,7,1,0);
+ return BITSWAP8(~m_dsw2->read(), 2,3,4,5,6,7,1,0);
}
READ8_MEMBER(gladiatr_state::gladiator_controls_r )
{
- int coins = 0;
+ u8 const coins = (~m_coins->read() & 0x07) ? 0x80 : 0x00;
- if(ioport("COINS")->read() & 0xc0 ) coins = 0x80;
switch(offset)
{
- case 0x01: /* start button , coins */
- return ioport("IN0")->read() | coins;
- case 0x02: /* Player 1 Controller , coins */
- return ioport("IN1")->read() | coins;
- case 0x04: /* Player 2 Controller , coins */
- return ioport("IN2")->read() | coins;
+ case 0x01: // start button , coins
+ return ((~m_in0->read() >> 6) & 0x03) | coins;
+ case 0x02: // Player 1 Controller , coins
+ return (~m_in0->read() & 0x3f) | coins;
+ case 0x04: // Player 2 Controller , coins
+ return (~m_in1->read() & 0x3f) | coins;
}
- /* unknown */
+ // unknown
return 0;
}
-READ8_MEMBER(gladiatr_state::gladiator_button3_r )
+READ8_MEMBER(gladiatr_state::gladiator_button3_r)
{
switch(offset)
{
case 0x01: /* button 3 */
- return ioport("IN3")->read();
+ return (~m_in2->read() >> 6) & 0x03;
}
/* unknown */
return 0;
@@ -304,60 +307,182 @@ WRITE8_MEMBER(gladiatr_state::gladiatr_irq_patch_w)
#endif
+WRITE_LINE_MEMBER(gladiatr_state::tclk_w)
+{
+ m_tclk_val = state != 0;
+
+ // these are actually edge-triggered, but MAME only supports polled inputs
+
+ u8 const new_in0_val(m_in0->read());
+ if (BIT(~new_in0_val & (new_in0_val ^ m_in0_val), 5))
+ m_cctl_p1 = (m_cctl_p1 & 0xfc) | BIT(~new_in0_val, 5) | (BIT(~new_in0_val, 5) << 1);
+ else
+ m_cctl_p1 = (m_cctl_p1 & 0xfe) | BIT(~new_in0_val, 5);
+ m_in0_val = new_in0_val;
+
+ u8 const new_in1_val(m_in0->read());
+ if (BIT(~new_in1_val & (new_in1_val ^ m_in1_val), 5))
+ m_cctl_p2 = (m_cctl_p2 & 0xfc) | BIT(~new_in1_val, 5) | (BIT(~new_in1_val, 5) << 1);
+ else
+ m_cctl_p2 = (m_cctl_p2 & 0xfe) | BIT(~new_in1_val, 5);
+ m_in1_val = new_in1_val;
+}
+
+READ8_MEMBER(gladiatr_state::cctl_p1_r)
+{
+ return m_cctl_p1 & m_in2->read();
+}
+
+READ8_MEMBER(gladiatr_state::cctl_p2_r)
+{
+ return m_cctl_p2;
+}
+
+READ8_MEMBER(gladiatr_state::ucpu_p2_r)
+{
+ return BITSWAP8(m_dsw1->read(), 0,1,2,3,4,5,6,7);
+}
+
+READ8_MEMBER(gladiatr_state::cctl_t_r)
+{
+ return BIT(m_coins->read(), offset + 2);
+}
+
+READ8_MEMBER(gladiatr_state::ccpu_t_r)
+{
+ return BIT(m_coins->read(), offset);
+}
+
+WRITE8_MEMBER(gladiatr_state::ccpu_p2_w)
+{
+ // FIXME: active high or active low? (bootleg MCU never uses these outputs)
+ machine().bookkeeping().coin_counter_w(0, BIT(data, 6));
+ machine().bookkeeping().coin_counter_w(1, BIT(data, 7));
+}
+
+READ8_MEMBER(gladiatr_state::tclk_r)
+{
+ // fed to t0 on comms MCUs
+ return m_tclk_val ? 0x01 : 0x00;
+}
+
+READ8_MEMBER(gladiatr_state::ucpu_t1_r)
+{
+ // connected to p1 on other MCU
+ return BIT(m_csnd_p1, 1);
+}
+
+READ8_MEMBER(gladiatr_state::ucpu_p1_r)
+{
+ // p10 connected to corresponding line on other MCU
+ // p11 connected to t1 on other MCU
+ // other lines floating
+ return m_csnd_p1 |= 0xfe;
+}
+
+WRITE8_MEMBER(gladiatr_state::ucpu_p1_w)
+{
+ m_ucpu_p1 = data;
+}
+
+READ8_MEMBER(gladiatr_state::csnd_t1_r)
+{
+ // connected to p1 on other MCU
+ return BIT(m_ucpu_p1, 1);
+}
+READ8_MEMBER(gladiatr_state::csnd_p1_r)
+{
+ // p10 connected to corresponding line on other MCU
+ // p11 connected to t1 on other MCU
+ // other lines floating
+ return m_ucpu_p1 |= 0xfe;
+}
+WRITE8_MEMBER(gladiatr_state::csnd_p1_w)
+{
+ m_csnd_p1 = data;
+}
+
+READ8_MEMBER(gladiatr_state::csnd_p2_r)
+{
+ return BITSWAP8(m_dsw2->read(), 2,3,4,5,6,7,1,0);
+}
-WRITE8_MEMBER(gladiatr_state::ppking_qx0_w)
+READ8_MEMBER(ppking_state::ppking_f1_r)
+{
+ return machine().rand();
+}
+
+READ8_MEMBER(ppking_state::ppking_f6a3_r)
+{
+ if (space.device().safe_pcbase() == 0x8e)
+ m_nvram[0x6a3] = 1;
+
+ return m_nvram[0x6a3];
+}
+
+WRITE8_MEMBER(ppking_state::ppking_qx0_w)
{
if(!offset)
{
- m_data2=data;
- m_flag2=1;
+ m_data2 = data;
+ m_flag2 = 1;
}
}
-WRITE8_MEMBER(gladiatr_state::ppking_qx1_w)
+WRITE8_MEMBER(ppking_state::ppking_qx1_w)
{
if(!offset)
{
- m_data1=data;
- m_flag1=1;
+ m_data1 = data;
+ m_flag1 = 1;
}
}
-WRITE8_MEMBER(gladiatr_state::ppking_qx2_w){ }
-
-WRITE8_MEMBER(gladiatr_state::ppking_qx3_w){ }
-
-READ8_MEMBER(gladiatr_state::ppking_qx2_r){ return machine().rand(); }
+WRITE8_MEMBER(ppking_state::ppking_qx2_w)
+{
+}
-READ8_MEMBER(gladiatr_state::ppking_qx3_r){ return machine().rand()&0xf; }
+WRITE8_MEMBER(ppking_state::ppking_qx3_w)
+{
+}
-READ8_MEMBER(gladiatr_state::ppking_qx0_r)
+READ8_MEMBER(ppking_state::ppking_qx0_r)
{
- if(!offset)
- return m_data1;
+ if (!offset)
+ return m_data1;
else
return m_flag2;
}
-READ8_MEMBER(gladiatr_state::ppking_qx1_r)
+READ8_MEMBER(ppking_state::ppking_qx1_r)
{
- if(!offset)
+ if (!offset)
return m_data2;
else
return m_flag1;
}
-MACHINE_RESET_MEMBER(gladiatr_state,ppking)
+READ8_MEMBER(ppking_state::ppking_qx2_r)
+{
+ return machine().rand();
+}
+
+READ8_MEMBER(ppking_state::ppking_qx3_r)
+{
+ return machine().rand()&0xf;
+}
+
+MACHINE_RESET_MEMBER(ppking_state, ppking)
{
m_data1 = m_data2 = 0;
m_flag1 = m_flag2 = 1;
}
-static ADDRESS_MAP_START( ppking_cpu1_map, AS_PROGRAM, 8, gladiatr_state )
+static ADDRESS_MAP_START( ppking_cpu1_map, AS_PROGRAM, 8, ppking_state )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xcbff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0xcc00, 0xcfff) AM_WRITE(ppking_video_registers_w)
@@ -369,12 +494,12 @@ static ADDRESS_MAP_START( ppking_cpu1_map, AS_PROGRAM, 8, gladiatr_state )
ADDRESS_MAP_END
-static ADDRESS_MAP_START( ppking_cpu3_map, AS_PROGRAM, 8, gladiatr_state )
+static ADDRESS_MAP_START( ppking_cpu3_map, AS_PROGRAM, 8, ppking_state )
AM_RANGE(0x2000, 0x2fff) AM_ROM
AM_RANGE(0xc000, 0xffff) AM_ROM
ADDRESS_MAP_END
-static ADDRESS_MAP_START( ppking_cpu1_io, AS_IO, 8, gladiatr_state )
+static ADDRESS_MAP_START( ppking_cpu1_io, AS_IO, 8, ppking_state )
// ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0xc000, 0xc000) AM_WRITE(spritebuffer_w)
AM_RANGE(0xc004, 0xc004) AM_NOP // WRITE(ppking_irq_patch_w)
@@ -382,7 +507,7 @@ static ADDRESS_MAP_START( ppking_cpu1_io, AS_IO, 8, gladiatr_state )
AM_RANGE(0xc0bf, 0xc0bf) AM_NOP
ADDRESS_MAP_END
-static ADDRESS_MAP_START( ppking_cpu2_io, AS_IO, 8, gladiatr_state )
+static ADDRESS_MAP_START( ppking_cpu2_io, AS_IO, 8, ppking_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write)
AM_RANGE(0x20, 0x21) AM_READ(ppking_qx1_r) AM_WRITE(ppking_qx1_w)
@@ -440,22 +565,71 @@ static ADDRESS_MAP_START( gladiatr_cpu2_io, AS_IO, 8, gladiatr_state )
AM_RANGE(0xe0, 0xe0) AM_WRITE(gladiator_cpu_sound_command_w)
ADDRESS_MAP_END
+static ADDRESS_MAP_START( greatgur_cpu1_io, AS_IO, 8, gladiatr_state )
+// ADDRESS_MAP_GLOBAL_MASK(0xff)
+ AM_RANGE(0xc000, 0xc000) AM_WRITE(spritebuffer_w)
+ AM_RANGE(0xc001, 0xc001) AM_WRITE(gladiatr_spritebank_w)
+ AM_RANGE(0xc002, 0xc002) AM_WRITE(gladiatr_bankswitch_w)
+ AM_RANGE(0xc004, 0xc004) AM_WRITE(gladiatr_irq_patch_w) /* !!! patch to 2nd CPU IRQ !!! */
+ AM_RANGE(0xc007, 0xc007) AM_WRITE(gladiatr_flipscreen_w)
+ AM_RANGE(0xc09e, 0xc09f) AM_DEVREADWRITE("ucpu", upi41_cpu_device, upi41_master_r, upi41_master_w)
+ AM_RANGE(0xc0bf, 0xc0bf) AM_NOP // watchdog_reset_w doesn't work
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( greatgur_cpu2_io, AS_IO, 8, gladiatr_state )
+ ADDRESS_MAP_GLOBAL_MASK(0xff)
+ AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write)
+ AM_RANGE(0x20, 0x21) AM_DEVREADWRITE("csnd", upi41_cpu_device, upi41_master_r, upi41_master_w)
+ AM_RANGE(0x40, 0x40) AM_NOP // WRITE(sub_irq_ack_w)
+ AM_RANGE(0x60, 0x61) AM_DEVREADWRITE("cctl", upi41_cpu_device, upi41_master_r, upi41_master_w)
+ AM_RANGE(0x80, 0x81) AM_DEVREADWRITE("ccpu", upi41_cpu_device, upi41_master_r, upi41_master_w)
+ AM_RANGE(0xa0, 0xa7) AM_NOP // filters on sound output
+ AM_RANGE(0xe0, 0xe0) AM_WRITE(gladiator_cpu_sound_command_w)
+ADDRESS_MAP_END
+
+
+
+static ADDRESS_MAP_START( cctl_io_map, AS_IO, 8, gladiatr_state )
+ AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T1) AM_READ(cctl_t_r)
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(cctl_p1_r)
+ AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(cctl_p2_r)
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( ccpu_io_map, AS_IO, 8, gladiatr_state )
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ_PORT("IN0")
+ AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ_PORT("IN1") AM_WRITE(ccpu_p2_w)
+ AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T1) AM_READ(ccpu_t_r)
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( ucpu_io_map, AS_IO, 8, gladiatr_state )
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(ucpu_p1_r, ucpu_p1_w)
+ AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(ucpu_p2_r)
+ AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(tclk_r)
+ AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(ucpu_t1_r)
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START( csnd_io_map, AS_IO, 8, gladiatr_state )
+ AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(csnd_p1_r, csnd_p1_w)
+ AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(csnd_p2_r)
+ AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(tclk_r)
+ AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(csnd_t1_r)
+ADDRESS_MAP_END
static INPUT_PORTS_START( gladiatr )
PORT_START("DSW1") /* (8741-0 parallel port)*/
- PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2")
+ PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2")
PORT_DIPSETTING( 0x03, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x02, DEF_STR( Medium ) )
PORT_DIPSETTING( 0x01, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
- PORT_DIPNAME( 0x04, 0x00, "After 4 Stages" ) PORT_DIPLOCATION("SW1:3")
+ PORT_DIPNAME( 0x04, 0x00, "After 4 Stages" ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x00, DEF_STR( Continues ) )
PORT_DIPSETTING( 0x04, "Ends" )
- PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:4") /*NOTE: Actual manual has these settings reversed(typo?)! */
- PORT_DIPSETTING( 0x00, "Only at 100000" )
+ PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:4") /*NOTE: Actual manual has these settings reversed(typo?)! */
+ PORT_DIPSETTING( 0x08, "Only at 100000" )
PORT_DIPSETTING( 0x00, "Every 100000" )
- PORT_DIPNAME( 0x30, 0x10, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:5,6")
+ PORT_DIPNAME( 0x30, 0x10, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:5,6")
PORT_DIPSETTING( 0x30, "1" )
PORT_DIPSETTING( 0x20, "2" )
PORT_DIPSETTING( 0x10, "3" )
@@ -463,29 +637,29 @@ static INPUT_PORTS_START( gladiatr )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
PORT_DIPSETTING( 0x40, DEF_STR( Yes ) )
- PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:8")
+ PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW2") /* (8741-1 parallel port) - Dips 6 Unused */
- PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2")
+ PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2")
PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) )
- PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:3,4")
+ PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:3,4")
PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 2C_1C ) )
- PORT_DIPNAME( 0x10, 0x10, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:5")
+ PORT_DIPNAME( 0x10, 0x10, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:5")
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW2:6" ) /* Listed as "Unused" */
- PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:7")
+ PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW2:6" ) /* Listed as "Unused" */
+ PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) )
- PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
+ PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@@ -493,68 +667,48 @@ static INPUT_PORTS_START( gladiatr )
PORT_DIPNAME( 0x01, 0x01, "Invulnerability (Cheat)") PORT_DIPLOCATION("SW3:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x02, 0x02, "Memory Backup" ) PORT_DIPLOCATION("SW3:2")
+ PORT_DIPNAME( 0x02, 0x02, "Memory Backup" ) PORT_DIPLOCATION("SW3:2")
PORT_DIPSETTING( 0x02, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x00, "Clear" )
- PORT_DIPNAME( 0x0c, 0x0c, "Starting Stage" ) PORT_DIPLOCATION("SW3:3,4")
+ PORT_DIPNAME( 0x0c, 0x0c, "Starting Stage" ) PORT_DIPLOCATION("SW3:3,4")
PORT_DIPSETTING( 0x0c, "1" )
PORT_DIPSETTING( 0x08, "2" )
PORT_DIPSETTING( 0x04, "3" )
PORT_DIPSETTING( 0x00, "4" )
- PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW3:5" ) /* Listed as "Unused" */
- PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW3:6" ) /* Listed as "Unused" */
- PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW3:7" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW3:5" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW3:6" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW3:7" ) /* Listed as "Unused" */
PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW3:8" )
- PORT_START("IN0") /*(8741-3 parallel port 1) */
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* COINS */
-
- PORT_START("COINS") /*(8741-3 parallel port bit7) */
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
-
- PORT_START("IN1") /* (8741-3 parallel port 2) */
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 )
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* COINS */
-
- PORT_START("IN2") /* (8741-3 parallel port 4) */
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* COINS */
-
- PORT_START("IN3") /* (8741-2 parallel port 1) */
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 )
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_COCKTAIL
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
+ PORT_START("IN0") // ccpu p1
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_8WAY
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_8WAY
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
+
+ PORT_START("IN1") // ccpu p2
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
+ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) // coin counter outputs
+
+ PORT_START("IN2") // cctl p1
+ PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED ) // other stuff mixed here
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
+
+ PORT_START("COINS") // ccpu test, cctl test
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(1)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
/*******************************************************************/
@@ -608,12 +762,7 @@ GFXDECODE_END
-READ8_MEMBER(gladiatr_state::ppking_f1_r)
-{
- return machine().rand();
-}
-
-static MACHINE_CONFIG_START( ppking, gladiatr_state )
+static MACHINE_CONFIG_START( ppking, ppking_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) /* verified on pcb */
@@ -631,7 +780,7 @@ static MACHINE_CONFIG_START( ppking, gladiatr_state )
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
- MCFG_MACHINE_RESET_OVERRIDE(gladiatr_state,ppking)
+ MCFG_MACHINE_RESET_OVERRIDE(ppking_state, ppking)
MCFG_NVRAM_ADD_0FILL("nvram")
/* video hardware */
@@ -640,13 +789,13 @@ static MACHINE_CONFIG_START( ppking, gladiatr_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
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(gladiatr_state, screen_update_ppking)
+ MCFG_SCREEN_UPDATE_DRIVER(ppking_state, screen_update_ppking)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", ppking)
MCFG_PALETTE_ADD("palette", 1024)
- MCFG_VIDEO_START_OVERRIDE(gladiatr_state,ppking)
+ MCFG_VIDEO_START_OVERRIDE(ppking_state, ppking)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@@ -654,8 +803,8 @@ static MACHINE_CONFIG_START( ppking, gladiatr_state )
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/8) /* verified on pcb */
- MCFG_AY8910_PORT_A_READ_CB(READ8(gladiatr_state, ppking_f1_r))
- MCFG_AY8910_PORT_B_READ_CB(READ8(gladiatr_state, ppking_f1_r))
+ MCFG_AY8910_PORT_A_READ_CB(READ8(ppking_state, ppking_f1_r))
+ MCFG_AY8910_PORT_B_READ_CB(READ8(ppking_state, ppking_f1_r))
MCFG_SOUND_ROUTE(0, "mono", 0.60)
MCFG_SOUND_ROUTE(1, "mono", 0.60)
MCFG_SOUND_ROUTE(2, "mono", 0.60)
@@ -724,6 +873,37 @@ static MACHINE_CONFIG_START( gladiatr, gladiatr_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
MACHINE_CONFIG_END
+MACHINE_CONFIG_DERIVED( greatgur, gladiatr )
+
+ /* basic machine hardware */
+ MCFG_CPU_MODIFY("maincpu")
+ MCFG_CPU_IO_MAP(greatgur_cpu1_io)
+
+ MCFG_CPU_MODIFY("sub")
+ MCFG_CPU_IO_MAP(greatgur_cpu2_io)
+
+ MCFG_DEVICE_ADD("cctl", I8741, XTAL_12MHz/2) /* verified on pcb */
+ MCFG_CPU_IO_MAP(cctl_io_map)
+
+ MCFG_DEVICE_ADD("ccpu", I8741, XTAL_12MHz/2) /* verified on pcb */
+ MCFG_CPU_IO_MAP(ccpu_io_map)
+
+ MCFG_DEVICE_ADD("ucpu", I8741, XTAL_12MHz/2) /* verified on pcb */
+ MCFG_CPU_IO_MAP(ucpu_io_map)
+
+ MCFG_DEVICE_ADD("csnd", I8741, XTAL_12MHz/2) /* verified on pcb */
+ MCFG_CPU_IO_MAP(csnd_io_map)
+
+ MCFG_CLOCK_ADD("tclk", XTAL_12MHz/8/128/2) /* verified on pcb */
+ MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(gladiatr_state, tclk_w));
+
+ /* lazy way to make polled serial between MCUs work */
+ MCFG_QUANTUM_PERFECT_CPU("ucpu")
+
+ MCFG_DEVICE_REMOVE("taito8741")
+MACHINE_CONFIG_END
+
+
/***************************************************************************
Game driver(s)
@@ -898,10 +1078,16 @@ ROM_START( greatgur )
ROM_LOAD( "q3.2b", 0x00000, 0x0020, CRC(6a7c3c60) SHA1(5125bfeb03752c8d76b140a4e74d5cac29dcdaa6) ) /* address decoding */
ROM_LOAD( "q4.5s", 0x00020, 0x0020, CRC(e325808e) SHA1(5fd92ad4eff24f6ccf2df19d268a6cafba72202e) )
- ROM_REGION( 0x0400, "user1", 0 ) /* ROMs for the four 8741 (not emulated yet) */
+ ROM_REGION( 0x0400, "cctl", 0 ) /* I/O MCU */
ROM_LOAD( "gladcctl.1", 0x00000, 0x0400, CRC(b30d225f) SHA1(f383286530975c440589c276aa8c46fdfe5292b6) )
+
+ ROM_REGION( 0x0400, "ccpu", 0 ) /* I/O MCU */
ROM_LOAD( "gladccpu.2", 0x00000, 0x0400, CRC(1d02cd5f) SHA1(f7242039788c66a1d91b01852d7d447330b847c4) )
+
+ ROM_REGION( 0x0400, "ucpu", 0 ) /* comms MCU */
ROM_LOAD( "gladucpu.17", 0x00000, 0x0400, CRC(3c5ca4c6) SHA1(0d8c2e1c2142ada11e30cfb9a48663386fee9cb8) )
+
+ ROM_REGION( 0x0400, "csnd", 0 ) /* comms MCU */
ROM_LOAD( "gladcsnd.18", 0x00000, 0x0400, CRC(3c5ca4c6) SHA1(0d8c2e1c2142ada11e30cfb9a48663386fee9cb8) )
ROM_END
@@ -1001,18 +1187,26 @@ DRIVER_INIT_MEMBER(gladiatr_state,gladiatr)
/* make sure bank is valid in cpu-reset */
membank("bank2")->set_entry(0);
-}
-
-READ8_MEMBER(gladiatr_state::ppking_f6a3_r)
-{
- if(space.device().safe_pcbase()==0x8e)
- m_nvram[0x6a3]=1;
-
- return m_nvram[0x6a3];
+ m_tclk_val = false;
+ m_in0_val = 0xff;
+ m_in1_val = 0xff;
+ m_cctl_p1 = 0xff;
+ m_cctl_p2 = 0xff;
+ m_ucpu_p1 = 0xff;
+ m_csnd_p1 = 0xff;
+
+ save_item(NAME(m_tclk_val));
+ save_item(NAME(m_in0_val));
+ save_item(NAME(m_in1_val));
+ save_item(NAME(m_cctl_p1));
+ save_item(NAME(m_cctl_p2));
+ save_item(NAME(m_ucpu_p1));
+ save_item(NAME(m_csnd_p1));
}
-DRIVER_INIT_MEMBER(gladiatr_state,ppking)
+
+DRIVER_INIT_MEMBER(ppking_state, ppking)
{
uint8_t *rom;
int i,j;
@@ -1034,7 +1228,7 @@ DRIVER_INIT_MEMBER(gladiatr_state,ppking)
rom[i+2*j*0x2000] = rom[i+j*0x2000];
}
}
- m_maincpu->space(AS_PROGRAM).install_read_handler(0xf6a3,0xf6a3,read8_delegate(FUNC(gladiatr_state::ppking_f6a3_r),this));
+ m_maincpu->space(AS_PROGRAM).install_read_handler(0xf6a3,0xf6a3,read8_delegate(FUNC(ppking_state::ppking_f6a3_r),this));
save_item(NAME(m_data1));
save_item(NAME(m_data2));
@@ -1042,8 +1236,8 @@ DRIVER_INIT_MEMBER(gladiatr_state,ppking)
-GAME( 1985, ppking, 0, ppking, 0, gladiatr_state, ppking, ROT90, "Taito America Corporation", "Ping-Pong King", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
+GAME( 1985, ppking, 0, ppking, 0, ppking_state, ppking, ROT90, "Taito America Corporation", "Ping-Pong King", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
GAME( 1986, gladiatr, 0, gladiatr, gladiatr, gladiatr_state, gladiatr, ROT0, "Allumer / Taito America Corporation", "Gladiator (US)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, ogonsiro, gladiatr, gladiatr, gladiatr, gladiatr_state, gladiatr, ROT0, "Allumer / Taito Corporation", "Ougon no Shiro (Japan)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, greatgur, gladiatr, gladiatr, gladiatr, gladiatr_state, gladiatr, ROT0, "Allumer / Taito Corporation", "Great Gurianos (Japan?)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, greatgur, gladiatr, greatgur, gladiatr, gladiatr_state, gladiatr, ROT0, "Allumer / Taito Corporation", "Great Gurianos (Japan?)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, gcastle, gladiatr, gladiatr, gladiatr, gladiatr_state, gladiatr, ROT0, "Allumer / Taito Corporation", "Golden Castle (prototype?)", MACHINE_SUPPORTS_SAVE ) // incomplete dump
diff --git a/src/mame/includes/gladiatr.h b/src/mame/includes/gladiatr.h
index 1ed36a46947..97ddf67f5af 100644
--- a/src/mame/includes/gladiatr.h
+++ b/src/mame/includes/gladiatr.h
@@ -1,66 +1,100 @@
// license:BSD-3-Clause
-// copyright-holders:Victor Trucco,Steve Ellenoff,Phil Stroffolino,Tatsuyuki Satoh,Tomasz Slanina,Nicola Salmoria
+// copyright-holders:Victor Trucco,Steve Ellenoff,Phil Stroffolino,Tatsuyuki Satoh,Tomasz Slanina,Nicola Salmoria,Vas Crabb
#include "machine/gen_latch.h"
+
#include "sound/msm5205.h"
-class gladiatr_state : public driver_device
+
+class gladiatr_state_base : public driver_device
{
public:
- gladiatr_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_subcpu(*this, "sub"),
- m_msm(*this, "msm"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch"),
- m_nvram(*this, "nvram") ,
- m_spriteram(*this, "spriteram"),
- m_videoram(*this, "videoram"),
- m_colorram(*this, "colorram"),
- m_textram(*this, "textram"),
- m_generic_paletteram_8(*this, "paletteram") { }
-
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<cpu_device> m_subcpu;
- required_device<msm5205_device> m_msm;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- required_device<generic_latch_8_device> m_soundlatch;
-
- required_shared_ptr<uint8_t> m_nvram;
- required_shared_ptr<uint8_t> m_spriteram;
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_textram;
- required_shared_ptr<uint8_t> m_generic_paletteram_8;
-
- int m_data1;
- int m_data2;
- int m_flag1;
- int m_flag2;
- int m_video_attributes;
- int m_fg_scrollx;
- int m_fg_scrolly;
- int m_bg_scrollx;
- int m_bg_scrolly;
- int m_sprite_bank;
- int m_sprite_buffer;
- tilemap_t *m_fg_tilemap;
- tilemap_t *m_bg_tilemap;
- int m_fg_tile_bank;
- int m_bg_tile_bank;
-
- // common
DECLARE_WRITE8_MEMBER(videoram_w);
DECLARE_WRITE8_MEMBER(colorram_w);
DECLARE_WRITE8_MEMBER(textram_w);
DECLARE_WRITE8_MEMBER(paletteram_w);
DECLARE_WRITE8_MEMBER(spritebuffer_w);
+protected:
+ gladiatr_state_base(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_subcpu(*this, "sub")
+ , m_audiocpu(*this, "audiocpu")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_palette(*this, "palette")
+ , m_msm(*this, "msm")
+ , m_soundlatch(*this, "soundlatch")
+ , m_videoram(*this, "videoram")
+ , m_colorram(*this, "colorram")
+ , m_textram(*this, "textram")
+ , m_paletteram(*this, "paletteram")
+ , m_spriteram(*this, "spriteram")
+ , m_video_attributes(0)
+ , m_fg_scrolly(0)
+ , m_fg_tile_bank(0)
+ , m_bg_tile_bank(0)
+ , m_sprite_bank(0)
+ , m_sprite_buffer(0)
+ , m_fg_tilemap(nullptr)
+ , m_bg_tilemap(nullptr)
+ {
+ }
+
+ TILE_GET_INFO_MEMBER(bg_get_tile_info);
+ TILE_GET_INFO_MEMBER(fg_get_tile_info);
+
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_subcpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_device<msm5205_device> m_msm;
+ required_device<generic_latch_8_device> m_soundlatch;
+
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_textram;
+ required_shared_ptr<uint8_t> m_paletteram;
+ required_shared_ptr<uint8_t> m_spriteram;
+
+ int m_video_attributes;
+ int m_fg_scrolly;
+ int m_fg_tile_bank;
+ int m_bg_tile_bank;
+ int m_sprite_bank;
+ int m_sprite_buffer;
+
+ tilemap_t *m_fg_tilemap;
+ tilemap_t *m_bg_tilemap;
+};
+
+class gladiatr_state : public gladiatr_state_base
+{
+public:
+ gladiatr_state(const machine_config &mconfig, device_type type, const char *tag)
+ : gladiatr_state_base(mconfig, type, tag)
+ , m_dsw1(*this, "DSW1")
+ , m_dsw2(*this, "DSW2")
+ , m_in0(*this, "IN0")
+ , m_in1(*this, "IN1")
+ , m_in2(*this, "IN2")
+ , m_coins(*this, "COINS")
+ , m_tclk_val(false)
+ , m_in0_val(0xff)
+ , m_in1_val(0xff)
+ , m_cctl_p1(0xff)
+ , m_cctl_p2(0xff)
+ , m_ucpu_p1(0xff)
+ , m_csnd_p1(0xff)
+ , m_fg_scrollx(0)
+ , m_bg_scrollx(0)
+ , m_bg_scrolly(0)
+ {
+ }
+
// gladiator specific
DECLARE_READ8_MEMBER(gladiator_dsw1_r);
DECLARE_READ8_MEMBER(gladiator_dsw2_r);
@@ -77,7 +111,59 @@ public:
DECLARE_WRITE8_MEMBER(gladiator_adpcm_w);
DECLARE_WRITE_LINE_MEMBER(gladiator_ym_irq);
- // ppking specific
+ // greatgur MCU hookup
+ DECLARE_WRITE_LINE_MEMBER(tclk_w);
+ DECLARE_READ8_MEMBER(cctl_t_r);
+ DECLARE_READ8_MEMBER(cctl_p1_r);
+ DECLARE_READ8_MEMBER(cctl_p2_r);
+ DECLARE_READ8_MEMBER(ccpu_t_r);
+ DECLARE_WRITE8_MEMBER(ccpu_p2_w);
+ DECLARE_READ8_MEMBER(tclk_r);
+ DECLARE_READ8_MEMBER(ucpu_t1_r);
+ DECLARE_READ8_MEMBER(ucpu_p1_r);
+ DECLARE_WRITE8_MEMBER(ucpu_p1_w);
+ DECLARE_READ8_MEMBER(ucpu_p2_r);
+ DECLARE_READ8_MEMBER(csnd_t1_r);
+ DECLARE_READ8_MEMBER(csnd_p1_r);
+ DECLARE_WRITE8_MEMBER(csnd_p1_w);
+ DECLARE_READ8_MEMBER(csnd_p2_r);
+
+ DECLARE_DRIVER_INIT(gladiatr);
+
+ DECLARE_MACHINE_RESET(gladiator);
+ DECLARE_VIDEO_START(gladiatr);
+
+ uint32_t screen_update_gladiatr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void swap_block(uint8_t *src1,uint8_t *src2,int len);
+
+private:
+ required_ioport m_dsw1, m_dsw2;
+ required_ioport m_in0, m_in1, m_in2;
+ required_ioport m_coins;
+
+ bool m_tclk_val;
+ u8 m_in0_val, m_in1_val;
+ u8 m_cctl_p1, m_cctl_p2;
+ u8 m_ucpu_p1, m_csnd_p1;
+
+ int m_fg_scrollx;
+ int m_bg_scrollx;
+ int m_bg_scrolly;
+};
+
+class ppking_state : public gladiatr_state_base
+{
+public:
+ ppking_state(const machine_config &mconfig, device_type type, const char *tag)
+ : gladiatr_state_base(mconfig, type, tag)
+ , m_nvram(*this, "nvram")
+ , m_data1(0)
+ , m_data2(0)
+ , m_flag1(0)
+ , m_flag2(0)
+ {
+ }
+
DECLARE_READ8_MEMBER(ppking_f1_r);
DECLARE_READ8_MEMBER(ppking_f6a3_r);
DECLARE_WRITE8_MEMBER(ppking_qx0_w);
@@ -90,19 +176,18 @@ public:
DECLARE_READ8_MEMBER(ppking_qx1_r);
DECLARE_WRITE8_MEMBER(ppking_video_registers_w);
- DECLARE_DRIVER_INIT(gladiatr);
DECLARE_DRIVER_INIT(ppking);
- TILE_GET_INFO_MEMBER(bg_get_tile_info);
- TILE_GET_INFO_MEMBER(fg_get_tile_info);
-
DECLARE_MACHINE_RESET(ppking);
DECLARE_VIDEO_START(ppking);
- DECLARE_MACHINE_RESET(gladiator);
- DECLARE_VIDEO_START(gladiatr);
uint32_t screen_update_ppking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- uint32_t screen_update_gladiatr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
- void swap_block(uint8_t *src1,uint8_t *src2,int len);
+
+private:
+ required_shared_ptr<uint8_t> m_nvram;
+
+ u8 m_data1;
+ u8 m_data2;
+ u8 m_flag1;
+ u8 m_flag2;
};
diff --git a/src/mame/video/gladiatr.cpp b/src/mame/video/gladiatr.cpp
index 5460125c975..2d206ac5975 100644
--- a/src/mame/video/gladiatr.cpp
+++ b/src/mame/video/gladiatr.cpp
@@ -16,7 +16,7 @@
***************************************************************************/
-TILE_GET_INFO_MEMBER(gladiatr_state::bg_get_tile_info)
+TILE_GET_INFO_MEMBER(gladiatr_state_base::bg_get_tile_info)
{
uint8_t attr = m_colorram[tile_index];
@@ -26,7 +26,7 @@ TILE_GET_INFO_MEMBER(gladiatr_state::bg_get_tile_info)
0);
}
-TILE_GET_INFO_MEMBER(gladiatr_state::fg_get_tile_info)
+TILE_GET_INFO_MEMBER(gladiatr_state_base::fg_get_tile_info)
{
SET_TILE_INFO_MEMBER(0,
m_textram[tile_index] + (m_fg_tile_bank << 8),
@@ -42,10 +42,10 @@ TILE_GET_INFO_MEMBER(gladiatr_state::fg_get_tile_info)
***************************************************************************/
-VIDEO_START_MEMBER(gladiatr_state,ppking)
+VIDEO_START_MEMBER(ppking_state,ppking)
{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(gladiatr_state::bg_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,64);
- m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(gladiatr_state::fg_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,64);
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(ppking_state::bg_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,64);
+ m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(ppking_state::fg_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,64);
m_fg_tilemap->set_transparent_pen(0);
@@ -90,44 +90,44 @@ VIDEO_START_MEMBER(gladiatr_state,gladiatr)
***************************************************************************/
-WRITE8_MEMBER(gladiatr_state::videoram_w)
+WRITE8_MEMBER(gladiatr_state_base::videoram_w)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
-WRITE8_MEMBER(gladiatr_state::colorram_w)
+WRITE8_MEMBER(gladiatr_state_base::colorram_w)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
-WRITE8_MEMBER(gladiatr_state::textram_w)
+WRITE8_MEMBER(gladiatr_state_base::textram_w)
{
m_textram[offset] = data;
m_fg_tilemap->mark_tile_dirty(offset);
}
-WRITE8_MEMBER(gladiatr_state::paletteram_w)
+WRITE8_MEMBER(gladiatr_state_base::paletteram_w)
{
int r,g,b;
- m_generic_paletteram_8[offset] = data;
+ m_paletteram[offset] = data;
offset &= 0x3ff;
- r = (m_generic_paletteram_8[offset] >> 0) & 0x0f;
- g = (m_generic_paletteram_8[offset] >> 4) & 0x0f;
- b = (m_generic_paletteram_8[offset + 0x400] >> 0) & 0x0f;
+ r = (m_paletteram[offset] >> 0) & 0x0f;
+ g = (m_paletteram[offset] >> 4) & 0x0f;
+ b = (m_paletteram[offset + 0x400] >> 0) & 0x0f;
- r = (r << 1) + ((m_generic_paletteram_8[offset + 0x400] >> 4) & 0x01);
- g = (g << 1) + ((m_generic_paletteram_8[offset + 0x400] >> 5) & 0x01);
- b = (b << 1) + ((m_generic_paletteram_8[offset + 0x400] >> 6) & 0x01);
+ r = (r << 1) + ((m_paletteram[offset + 0x400] >> 4) & 0x01);
+ g = (g << 1) + ((m_paletteram[offset + 0x400] >> 5) & 0x01);
+ b = (b << 1) + ((m_paletteram[offset + 0x400] >> 6) & 0x01);
- m_palette->set_pen_color(offset,pal5bit(r),pal5bit(g),pal5bit(b));
+ m_palette->set_pen_color(offset, pal5bit(r), pal5bit(g), pal5bit(b));
}
-WRITE8_MEMBER(gladiatr_state::spritebuffer_w)
+WRITE8_MEMBER(gladiatr_state_base::spritebuffer_w)
{
m_sprite_buffer = data & 1;
}
@@ -138,7 +138,7 @@ WRITE8_MEMBER(gladiatr_state::gladiatr_spritebank_w)
}
-WRITE8_MEMBER(gladiatr_state::ppking_video_registers_w)
+WRITE8_MEMBER(ppking_state::ppking_video_registers_w)
{
switch (offset & 0x300)
{
@@ -204,7 +204,7 @@ WRITE8_MEMBER(gladiatr_state::gladiatr_video_registers_w)
***************************************************************************/
-void gladiatr_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+void gladiatr_state_base::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int offs;
@@ -254,7 +254,7 @@ void gladiatr_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
-uint32_t gladiatr_state::screen_update_ppking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t ppking_state::screen_update_ppking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0);
draw_sprites(bitmap,cliprect);