mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
gladiatr.cpp: added preliminary MCU simulation for Ping Pong King inputs [Angelo Salese]
This commit is contained in:
parent
9753e78025
commit
9ee00a9096
@ -376,7 +376,7 @@ INPUT_CHANGED_MEMBER(gladiatr_state::p2_s2)
|
||||
|
||||
READ8_MEMBER(ppking_state::ppking_f1_r)
|
||||
{
|
||||
return machine().rand();
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
READ8_MEMBER(ppking_state::ppking_f6a3_r)
|
||||
@ -387,12 +387,138 @@ READ8_MEMBER(ppking_state::ppking_f6a3_r)
|
||||
return m_nvram[0x6a3];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(ppking_state::ppking_qx0_w)
|
||||
#include "debugger.h"
|
||||
|
||||
inline bool ppking_state::mcu_parity_check()
|
||||
{
|
||||
if(!offset)
|
||||
int i;
|
||||
uint8_t res = 0;
|
||||
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
m_data2 = data;
|
||||
m_flag2 = 1;
|
||||
if(m_mcu[0].rxd & (1 << i))
|
||||
res++;
|
||||
}
|
||||
|
||||
if(res % 2)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
READ8_MEMBER(ppking_state::ppking_qx0_r)
|
||||
{
|
||||
// status
|
||||
if(offset == 1)
|
||||
return 1;
|
||||
|
||||
if(m_mcu[0].rst)
|
||||
{
|
||||
switch(m_mcu[0].state)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_mcu[0].packet_type^=1;
|
||||
|
||||
if(m_mcu[0].packet_type & 1)
|
||||
{
|
||||
m_mcu[0].rxd = ((ioport("DSW3")->read()) & 0x9f) | 0x20;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mcu[0].rxd = ((ioport("SYSTEM")->read()) & 0x9f);
|
||||
}
|
||||
|
||||
//printf("%02x\n",m_mcu[0].rxd);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
//m_mcu[0].packet_type^=1;
|
||||
//if(m_mcu[0].packet_type & 1)
|
||||
//{
|
||||
// m_mcu[0].rxd = ((ioport("P2")->read()) & 0x9f);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
m_mcu[0].rxd = ((ioport("P1")->read()) & 0x3f);
|
||||
m_mcu[0].rxd |= ((ioport("SYSTEM")->read()) & 0x80);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(mcu_parity_check() == false)
|
||||
m_mcu[0].rxd |= 0x40;
|
||||
}
|
||||
|
||||
return m_mcu[0].rxd;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(ppking_state::ppking_qx0_w)
|
||||
{
|
||||
if(offset == 1)
|
||||
{
|
||||
switch(data)
|
||||
{
|
||||
case 0:
|
||||
m_mcu[0].rxd = 0x40;
|
||||
m_mcu[0].rst = 0;
|
||||
m_mcu[0].state = 0;
|
||||
break;
|
||||
case 1:
|
||||
/*
|
||||
status codes:
|
||||
0x06 sub NG IOX2
|
||||
0x05 sub NG IOX1
|
||||
0x04 sub NG CIOS
|
||||
0x03 sub NG OPN
|
||||
0x02 sub NG ROM
|
||||
0x01 sub NG RAM
|
||||
0x00 ok
|
||||
*/
|
||||
m_mcu[0].rxd = 0x40;
|
||||
m_mcu[0].rst = 0;
|
||||
break;
|
||||
case 2:
|
||||
m_mcu[0].rxd = 0;//(ioport("DSW2")->read() & 0x1f) << 2;
|
||||
m_mcu[0].rst = 0;
|
||||
//machine().debug_break();
|
||||
break;
|
||||
case 3:
|
||||
//m_mcu[0].rxd = (ioport("DSW1")->read() & 0x1f) << 2;
|
||||
m_mcu[0].rst = 1;
|
||||
m_mcu[0].txd = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("%02x %02x\n",offset,data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mcu[0].txd = data;
|
||||
|
||||
if(m_mcu[0].txd == 0x41)
|
||||
{
|
||||
m_mcu[0].state = 1;
|
||||
//m_mcu[0].packet_type = 0;
|
||||
}
|
||||
else if(m_mcu[0].txd == 0x42)
|
||||
{
|
||||
m_mcu[0].state = 2;
|
||||
//m_mcu[0].packet_type = 0;
|
||||
//machine().debug_break();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%02x DATA PC=%04x\n",data,m_maincpu->pc());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -413,13 +539,6 @@ WRITE8_MEMBER(ppking_state::ppking_qx3_w)
|
||||
{
|
||||
}
|
||||
|
||||
READ8_MEMBER(ppking_state::ppking_qx0_r)
|
||||
{
|
||||
if (!offset)
|
||||
return m_data1;
|
||||
else
|
||||
return m_flag2;
|
||||
}
|
||||
|
||||
READ8_MEMBER(ppking_state::ppking_qx1_r)
|
||||
{
|
||||
@ -525,6 +644,89 @@ static ADDRESS_MAP_START( gladiatr_cpu2_io, AS_IO, 8, gladiatr_state )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static INPUT_PORTS_START( ppking )
|
||||
PORT_START("P1")
|
||||
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( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
|
||||
PORT_START("P2")
|
||||
PORT_DIPNAME( 0x01, 0x00, "P2" )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( On ) )
|
||||
PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( On ) )
|
||||
|
||||
PORT_START("SYSTEM")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
|
||||
PORT_DIPNAME( 0x04, 0x00, "SYSTEM" )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( On ) )
|
||||
PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2)
|
||||
|
||||
PORT_START("DSW2")
|
||||
PORT_DIPNAME( 0x01, 0x00, "DSW2" ) // being it off makes game to freeze
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
|
||||
PORT_START("DSW3")
|
||||
PORT_DIPNAME( 0x01, 0x00, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW3:1")
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( Yes ) )
|
||||
PORT_DIPNAME( 0x02, 0x00, "Round" ) PORT_DIPLOCATION("SW3:2")
|
||||
PORT_DIPSETTING( 0x00, "Normal" )
|
||||
PORT_DIPSETTING( 0x02, "Free" )
|
||||
PORT_DIPNAME( 0x04, 0x00, "Backup Clear" ) PORT_DIPLOCATION("SW3:3")
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( Yes ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
|
||||
PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW3:4" )
|
||||
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW3:5")
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Yes ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
|
||||
PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_HIGH, "SW3:8" )
|
||||
|
||||
INPUT_PORTS_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")
|
||||
@ -1174,7 +1376,7 @@ DRIVER_INIT_MEMBER(ppking_state, ppking)
|
||||
rom[i+2*j*0x2000] = rom[i+j*0x2000];
|
||||
}
|
||||
}
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0xf6a3,0xf6a3,read8_delegate(FUNC(ppking_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));
|
||||
@ -1182,7 +1384,7 @@ DRIVER_INIT_MEMBER(ppking_state, ppking)
|
||||
|
||||
|
||||
|
||||
GAME( 1985, ppking, 0, ppking, 0, ppking_state, ppking, ROT90, "Taito America Corporation", "Ping-Pong King", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1985, ppking, 0, ppking, ppking, 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 )
|
||||
|
@ -192,4 +192,15 @@ private:
|
||||
u8 m_data2;
|
||||
u8 m_flag1;
|
||||
u8 m_flag2;
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t rxd;
|
||||
uint8_t txd;
|
||||
uint8_t rst;
|
||||
uint8_t state;
|
||||
uint8_t packet_type;
|
||||
} m_mcu[2];
|
||||
|
||||
bool mcu_parity_check();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user