mirror of
https://github.com/holub/mame
synced 2025-05-07 06:44:51 +03:00
Moved the Superman c-chip implementation in the driver state. (nw)
This commit is contained in:
parent
0d0a4e5d39
commit
a2eb4802b0
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -4128,7 +4128,6 @@ src/mame/includes/cbasebal.h svneol=native#text/plain
|
||||
src/mame/includes/cbuster.h svneol=native#text/plain
|
||||
src/mame/includes/ccastles.h svneol=native#text/plain
|
||||
src/mame/includes/cchasm.h svneol=native#text/plain
|
||||
src/mame/includes/cchip.h svneol=native#text/plain
|
||||
src/mame/includes/cclimber.h svneol=native#text/plain
|
||||
src/mame/includes/cd32.h svneol=native#text/plain
|
||||
src/mame/includes/cdi.h svneol=native#text/plain
|
||||
@ -4622,6 +4621,7 @@ src/mame/includes/taito_f3.h svneol=native#text/plain
|
||||
src/mame/includes/taito_h.h svneol=native#text/plain
|
||||
src/mame/includes/taito_l.h svneol=native#text/plain
|
||||
src/mame/includes/taito_o.h svneol=native#text/plain
|
||||
src/mame/includes/taito_x.h svneol=native#text/plain
|
||||
src/mame/includes/taito_z.h svneol=native#text/plain
|
||||
src/mame/includes/taitoair.h svneol=native#text/plain
|
||||
src/mame/includes/taitoipt.h svneol=native#text/plain
|
||||
|
@ -317,29 +317,9 @@ Stephh's notes (based on the game M68000 code and some tests) :
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "includes/taitoipt.h"
|
||||
#include "audio/taitosnd.h"
|
||||
#include "includes/seta.h"
|
||||
#include "includes/taito_x.h"
|
||||
#include "sound/2610intf.h"
|
||||
#include "sound/2151intf.h"
|
||||
#include "includes/cchip.h"
|
||||
#include "drivlgcy.h"
|
||||
|
||||
class taitox_state : public seta_state
|
||||
{
|
||||
public:
|
||||
taitox_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: seta_state(mconfig, type, tag) { }
|
||||
|
||||
int m_banknum;
|
||||
DECLARE_READ16_MEMBER(superman_dsw_input_r);
|
||||
DECLARE_READ16_MEMBER(daisenpu_input_r);
|
||||
DECLARE_WRITE16_MEMBER(daisenpu_input_w);
|
||||
DECLARE_WRITE16_MEMBER(kyustrkr_input_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_bankswitch_w);
|
||||
DECLARE_DRIVER_INIT(kyustrkr);
|
||||
DECLARE_MACHINE_START(taitox);
|
||||
void reset_sound_region();
|
||||
DECLARE_WRITE_LINE_MEMBER(irqhandler);
|
||||
};
|
||||
|
||||
READ16_MEMBER(taitox_state::superman_dsw_input_r)
|
||||
{
|
||||
@ -436,9 +416,9 @@ static ADDRESS_MAP_START( superman_map, AS_PROGRAM, 16, taitox_state )
|
||||
AM_RANGE(0x600000, 0x600001) AM_WRITENOP /* written each frame at $3ab0, mostly 0x10 */
|
||||
AM_RANGE(0x800000, 0x800001) AM_READNOP AM_DEVWRITE8("tc0140syt", tc0140syt_device, tc0140syt_port_w, 0x00ff)
|
||||
AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_device, tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
|
||||
AM_RANGE(0x900000, 0x9007ff) AM_READWRITE_LEGACY(cchip1_ram_r, cchip1_ram_w)
|
||||
AM_RANGE(0x900802, 0x900803) AM_READWRITE_LEGACY(cchip1_ctrl_r, cchip1_ctrl_w)
|
||||
AM_RANGE(0x900c00, 0x900c01) AM_WRITE_LEGACY(cchip1_bank_w)
|
||||
AM_RANGE(0x900000, 0x9007ff) AM_READWRITE(cchip1_ram_r, cchip1_ram_w)
|
||||
AM_RANGE(0x900802, 0x900803) AM_READWRITE(cchip1_ctrl_r, cchip1_ctrl_w)
|
||||
AM_RANGE(0x900c00, 0x900c01) AM_WRITE(cchip1_bank_w)
|
||||
AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
|
||||
AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spriteylow_r16, spriteylow_w16) // Sprites Y
|
||||
AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16)
|
||||
@ -804,6 +784,18 @@ MACHINE_START_MEMBER(taitox_state,taitox)
|
||||
machine().save().register_postload(save_prepost_delegate(FUNC(taitox_state::reset_sound_region), this));
|
||||
}
|
||||
|
||||
MACHINE_START_MEMBER(taitox_state,superman)
|
||||
{
|
||||
m_banknum = -1;
|
||||
save_item(NAME(m_banknum));
|
||||
machine().save().register_postload(save_prepost_delegate(FUNC(taitox_state::reset_sound_region), this));
|
||||
|
||||
m_current_bank = 0;
|
||||
m_cc_port = 0;
|
||||
save_item(NAME(m_current_bank));
|
||||
save_item(NAME(m_cc_port));
|
||||
}
|
||||
|
||||
static const tc0140syt_interface taitox_tc0140syt_intf =
|
||||
{
|
||||
"maincpu", "audiocpu"
|
||||
@ -824,9 +816,8 @@ static MACHINE_CONFIG_START( superman, taitox_state )
|
||||
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(taitox_state,taitox)
|
||||
MCFG_MACHINE_RESET(cchip1)
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(taitox_state,superman)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
|
||||
|
||||
/* video hardware */
|
||||
|
@ -1,8 +0,0 @@
|
||||
/*----------- defined in machine/cchip.c -----------*/
|
||||
|
||||
MACHINE_RESET( cchip1 );
|
||||
DECLARE_READ16_HANDLER( cchip1_ctrl_r );
|
||||
DECLARE_READ16_HANDLER( cchip1_ram_r );
|
||||
DECLARE_WRITE16_HANDLER( cchip1_ctrl_w );
|
||||
DECLARE_WRITE16_HANDLER( cchip1_bank_w );
|
||||
DECLARE_WRITE16_HANDLER( cchip1_ram_w );
|
29
src/mame/includes/taito_x.h
Normal file
29
src/mame/includes/taito_x.h
Normal file
@ -0,0 +1,29 @@
|
||||
#include "includes/seta.h"
|
||||
|
||||
class taitox_state : public seta_state
|
||||
{
|
||||
public:
|
||||
taitox_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: seta_state(mconfig, type, tag) { }
|
||||
|
||||
int m_banknum;
|
||||
DECLARE_READ16_MEMBER(superman_dsw_input_r);
|
||||
DECLARE_READ16_MEMBER(daisenpu_input_r);
|
||||
DECLARE_WRITE16_MEMBER(daisenpu_input_w);
|
||||
DECLARE_WRITE16_MEMBER(kyustrkr_input_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_bankswitch_w);
|
||||
DECLARE_DRIVER_INIT(kyustrkr);
|
||||
DECLARE_MACHINE_START(taitox);
|
||||
DECLARE_MACHINE_START(superman);
|
||||
void reset_sound_region();
|
||||
DECLARE_WRITE_LINE_MEMBER(irqhandler);
|
||||
|
||||
// superman c-chip
|
||||
UINT16 m_current_bank;
|
||||
UINT8 m_cc_port;
|
||||
DECLARE_READ16_MEMBER( cchip1_ctrl_r );
|
||||
DECLARE_READ16_MEMBER( cchip1_ram_r );
|
||||
DECLARE_WRITE16_MEMBER( cchip1_ctrl_w );
|
||||
DECLARE_WRITE16_MEMBER( cchip1_bank_w );
|
||||
DECLARE_WRITE16_MEMBER( cchip1_ram_w );
|
||||
};
|
@ -3,8 +3,8 @@
|
||||
cchip.c
|
||||
|
||||
This file contains routines to interface with the Taito Controller Chip
|
||||
(or "Command Chip") version 1. It's currently used by Superman and Mega
|
||||
Blast. [Further cchip emulation is in machine/rainbow.c, machine/volfied.c,
|
||||
(or "Command Chip") version 1. It's currently used by Superman.
|
||||
[Further cchip emulation is in machine/rainbow.c, machine/volfied.c,
|
||||
drivers/opwolf.c and drivers/taito_f2.c]
|
||||
|
||||
According to Richard Bush, the C-Chip is an encrypted Z80 which communicates
|
||||
@ -30,11 +30,7 @@ This code requires that the player & coin inputs be in input ports 2-4.
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/cchip.h"
|
||||
|
||||
static UINT16 current_bank = 0;
|
||||
|
||||
static UINT8 cc_port = 0;
|
||||
#include "includes/taito_x.h"
|
||||
|
||||
/* This code for sound communication is a hack, it will not be
|
||||
identical to the code derived from the real c-chip */
|
||||
@ -55,33 +51,27 @@ static const UINT8 superman_code[40] =
|
||||
0x4e, 0x75 /* RTS ( Return ) */
|
||||
};
|
||||
|
||||
MACHINE_RESET( cchip1 )
|
||||
{
|
||||
machine.save().save_item(NAME(current_bank));
|
||||
machine.save().save_item(NAME(cc_port));
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Writes to C-Chip - Important Bits
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE16_HANDLER( cchip1_ctrl_w )
|
||||
WRITE16_MEMBER( taitox_state::cchip1_ctrl_w )
|
||||
{
|
||||
/* value 2 is written here */
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( cchip1_bank_w )
|
||||
WRITE16_MEMBER( taitox_state::cchip1_bank_w )
|
||||
{
|
||||
current_bank = data & 7;
|
||||
m_current_bank = data & 7;
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( cchip1_ram_w )
|
||||
WRITE16_MEMBER( taitox_state::cchip1_ram_w )
|
||||
{
|
||||
if (current_bank == 0 && offset == 0x03)
|
||||
if (m_current_bank == 0 && offset == 0x03)
|
||||
{
|
||||
cc_port = data;
|
||||
m_cc_port = data;
|
||||
|
||||
coin_lockout_w(space.machine(), 1, data & 0x08);
|
||||
coin_lockout_w(space.machine(), 0, data & 0x04);
|
||||
@ -90,7 +80,7 @@ WRITE16_HANDLER( cchip1_ram_w )
|
||||
}
|
||||
else
|
||||
{
|
||||
logerror("cchip1_w pc: %06x bank %02x offset %04x: %02x\n",space.device().safe_pc(),current_bank,offset,data);
|
||||
logerror("cchip1_w pc: %06x bank %02x offset %04x: %02x\n",space.device().safe_pc(),m_current_bank,offset,data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +91,7 @@ logerror("cchip1_w pc: %06x bank %02x offset %04x: %02x\n",space.device().safe_p
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ16_HANDLER( cchip1_ctrl_r )
|
||||
READ16_MEMBER( taitox_state::cchip1_ctrl_r )
|
||||
{
|
||||
/*
|
||||
Bit 2 = Error signal
|
||||
@ -110,23 +100,23 @@ READ16_HANDLER( cchip1_ctrl_r )
|
||||
return 0x01; /* Return 0x05 for C-Chip error */
|
||||
}
|
||||
|
||||
READ16_HANDLER( cchip1_ram_r )
|
||||
READ16_MEMBER( taitox_state::cchip1_ram_r )
|
||||
{
|
||||
/* Check for input ports */
|
||||
if (current_bank == 0)
|
||||
if (m_current_bank == 0)
|
||||
{
|
||||
switch (offset)
|
||||
{
|
||||
case 0x00: return space.machine().root_device().ioport("IN0")->read(); /* Player 1 controls + START1 */
|
||||
case 0x01: return space.machine().root_device().ioport("IN1")->read(); /* Player 2 controls + START2 */
|
||||
case 0x02: return space.machine().root_device().ioport("IN2")->read(); /* COINn + SERVICE1 + TILT */
|
||||
case 0x03: return cc_port;
|
||||
case 0x03: return m_cc_port;
|
||||
}
|
||||
}
|
||||
|
||||
/* Other non-standard offsets */
|
||||
|
||||
if (current_bank == 1 && offset <= 0xff)
|
||||
if (m_current_bank == 1 && offset <= 0xff)
|
||||
{
|
||||
if (offset < 40) /* our hack code is only 40 bytes long */
|
||||
return superman_code[offset];
|
||||
@ -134,7 +124,7 @@ READ16_HANDLER( cchip1_ram_r )
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (current_bank == 2)
|
||||
if (m_current_bank == 2)
|
||||
{
|
||||
switch (offset)
|
||||
{
|
||||
@ -144,6 +134,6 @@ READ16_HANDLER( cchip1_ram_r )
|
||||
}
|
||||
}
|
||||
|
||||
logerror("cchip1_r bank: %02x offset: %04x\n",current_bank,offset);
|
||||
logerror("cchip1_r bank: %02x offset: %04x\n",m_current_bank,offset);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user