mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
taito refactoring pt1.
This commit is contained in:
parent
9ade6db46e
commit
878f436343
@ -3546,8 +3546,8 @@ files {
|
||||
MAME_DIR .. "src/mame/video/bublbobl.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/buggychl.cpp",
|
||||
MAME_DIR .. "src/mame/includes/buggychl.h",
|
||||
MAME_DIR .. "src/mame/machine/buggychl.cpp",
|
||||
MAME_DIR .. "src/mame/machine/buggychl.h",
|
||||
MAME_DIR .. "src/mame/machine/taito68705interface.cpp",
|
||||
MAME_DIR .. "src/mame/machine/taito68705interface.h",
|
||||
MAME_DIR .. "src/mame/video/buggychl.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/capr1.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/caprcyc.cpp",
|
||||
|
@ -628,8 +628,8 @@ WRITE8_MEMBER(fortyl_state::to_main_w)
|
||||
static ADDRESS_MAP_START( 40love_map, AS_PROGRAM, 8, fortyl_state )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM /* M5517P on main board */
|
||||
AM_RANGE(0x8800, 0x8800) AM_DEVREADWRITE("bmcu", buggychl_mcu_device, buggychl_mcu_r, buggychl_mcu_w)
|
||||
AM_RANGE(0x8801, 0x8801) AM_DEVREAD("bmcu", buggychl_mcu_device, buggychl_mcu_status_r) AM_WRITE(pix1_mcu_w) //pixel layer related
|
||||
AM_RANGE(0x8800, 0x8800) AM_DEVREADWRITE("bmcu", taito68705_mcu_device, mcu_r, mcu_w)
|
||||
AM_RANGE(0x8801, 0x8801) AM_DEVREAD("bmcu", taito68705_mcu_device, mcu_status_r) AM_WRITE(pix1_mcu_w) //pixel layer related
|
||||
AM_RANGE(0x8802, 0x8802) AM_WRITE(bank_select_w)
|
||||
AM_RANGE(0x8803, 0x8803) AM_READWRITE(pix2_r, pix2_w) //pixel layer related
|
||||
AM_RANGE(0x8804, 0x8804) AM_READWRITE(from_snd_r, sound_command_w)
|
||||
@ -1011,8 +1011,6 @@ MACHINE_RESET_MEMBER(fortyl_state,common)
|
||||
|
||||
MACHINE_RESET_MEMBER(fortyl_state,40love)
|
||||
{
|
||||
m_mcu->set_input_line(0, CLEAR_LINE);
|
||||
|
||||
MACHINE_RESET_CALL_MEMBER(common);
|
||||
}
|
||||
|
||||
@ -1046,9 +1044,7 @@ static MACHINE_CONFIG_START( 40love, fortyl_state )
|
||||
MCFG_CPU_PROGRAM_MAP(sound_map)
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(fortyl_state, irq0_line_hold, 2*60) /* source/number of IRQs is unknown */
|
||||
|
||||
MCFG_CPU_ADD("mcu",M68705,18432000/6) /* OK */
|
||||
MCFG_CPU_PROGRAM_MAP(buggychl_mcu_map)
|
||||
MCFG_DEVICE_ADD("bmcu", BUGGYCHL_MCU, 0)
|
||||
MCFG_DEVICE_ADD("bmcu", TAITO68705_MCU, 18432000/6) /* OK */
|
||||
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* high interleave to ensure proper synchronization of CPUs */
|
||||
MCFG_MACHINE_START_OVERRIDE(fortyl_state,40love)
|
||||
@ -1107,9 +1103,7 @@ static MACHINE_CONFIG_START( undoukai, fortyl_state )
|
||||
MCFG_CPU_PROGRAM_MAP(sound_map)
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(fortyl_state, irq0_line_hold, 2*60) /* source/number of IRQs is unknown */
|
||||
|
||||
// MCFG_CPU_ADD("mcu",M68705,18432000/6)
|
||||
// MCFG_CPU_PROGRAM_MAP(buggychl_mcu_map)
|
||||
// MCFG_DEVICE_ADD("bmcu", BUGGYCHL_MCU, 0)
|
||||
// MCFG_DEVICE_ADD("bmcu", TAITO68705_MCU, 18432000/6)
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(fortyl_state,undoukai)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(fortyl_state,undoukai) /* init machine */
|
||||
@ -1175,7 +1169,7 @@ ROM_START( 40love )
|
||||
ROM_LOAD( "a30-12.u38", 0x8000, 0x2000, CRC(f7afd475) SHA1(dd09d5ca7fec5e0454f9efb8ebc722561010f124) )
|
||||
ROM_LOAD( "a30-13.u39", 0xa000, 0x2000, CRC(e806630f) SHA1(09022aae88ea0171a0aacf3260fa3a95e8faeb21) )
|
||||
|
||||
ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller */
|
||||
ROM_REGION( 0x0800, "bmcu:mcu", 0 ) /* 2k for the microcontroller */
|
||||
ROM_LOAD( "a30-14" , 0x0000, 0x0800, CRC(c4690279) SHA1(60bc77e03b9be434bb97a374a2fedeb8d049a660) )
|
||||
|
||||
ROM_REGION( 0x8000, "gfx1", 0 )
|
||||
|
@ -120,8 +120,8 @@ static ADDRESS_MAP_START( bking3_io_map, AS_IO, 8, bking_state )
|
||||
// AM_RANGE(0x0c, 0x0c) AM_WRITE(bking_eport2_w) this is not shown to be connected anywhere
|
||||
AM_RANGE(0x0d, 0x0d) AM_WRITE(bking_hitclr_w)
|
||||
AM_RANGE(0x07, 0x1f) AM_READ(bking_pos_r)
|
||||
AM_RANGE(0x2f, 0x2f) AM_DEVREADWRITE("bmcu", buggychl_mcu_device, buggychl_mcu_r, buggychl_mcu_w)
|
||||
AM_RANGE(0x4f, 0x4f) AM_DEVREAD("bmcu", buggychl_mcu_device, buggychl_mcu_status_r) AM_WRITE(unk_w)
|
||||
AM_RANGE(0x2f, 0x2f) AM_DEVREADWRITE("bmcu", taito68705_mcu_device, mcu_r, mcu_w)
|
||||
AM_RANGE(0x4f, 0x4f) AM_DEVREAD("bmcu", taito68705_mcu_device, mcu_status_r) AM_WRITE(unk_w)
|
||||
AM_RANGE(0x60, 0x60) AM_READ(bking3_extrarom_r)
|
||||
AM_RANGE(0x6f, 0x6f) AM_READWRITE(bking3_ext_check_r, bking3_addr_h_w)
|
||||
AM_RANGE(0x8f, 0x8f) AM_WRITE(bking3_addr_l_w)
|
||||
@ -140,68 +140,6 @@ static ADDRESS_MAP_START( bking_audio_map, AS_PROGRAM, 8, bking_state )
|
||||
AM_RANGE(0xe000, 0xefff) AM_ROM /* Space for diagnostic ROM */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
#if 0
|
||||
READ8_MEMBER(bking_state::bking3_68705_port_a_r)
|
||||
{
|
||||
//printf("port_a_r = %02X\n",(m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a));
|
||||
return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(bking_state::bking3_68705_port_a_w)
|
||||
{
|
||||
m_port_a_out = data;
|
||||
// printf("port_a_out = %02X\n",data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(bking_state::bking3_68705_ddr_a_w)
|
||||
{
|
||||
m_ddr_a = data;
|
||||
}
|
||||
|
||||
READ8_MEMBER(bking_state::bking3_68705_port_b_r)
|
||||
{
|
||||
return (m_port_b_out & m_ddr_b) | (m_port_b_in & ~m_ddr_b);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(bking_state::bking3_68705_port_b_w)
|
||||
{
|
||||
// if(data != 0xff)
|
||||
// printf("port_b_out = %02X\n",data);
|
||||
|
||||
if (~data & 0x02)
|
||||
{
|
||||
m_port_a_in = from_main;
|
||||
if (main_sent) m_mcu->set_input_line(0, CLEAR_LINE);
|
||||
main_sent = 0;
|
||||
}
|
||||
|
||||
if (~data & 0x04)
|
||||
{
|
||||
/* 68705 is writing data for the Z80 */
|
||||
from_mcu = m_port_a_out;
|
||||
mcu_sent = 1;
|
||||
}
|
||||
|
||||
if(data != 0xff && data != 0xfb && data != 0xfd)
|
||||
printf("port_b_w = %X\n",data);
|
||||
|
||||
m_port_b_out = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(bking_state::bking3_68705_ddr_b_w)
|
||||
{
|
||||
m_ddr_b = data;
|
||||
}
|
||||
|
||||
READ8_MEMBER(bking_state::bking3_68705_port_c_r)
|
||||
{
|
||||
int port_c_in = 0;
|
||||
if (main_sent) port_c_in |= 0x01;
|
||||
if (!mcu_sent) port_c_in |= 0x02;
|
||||
//logerror("%04x: 68705 port C read %02x\n",space.device().safe_pc(),port_c_in);
|
||||
return port_c_in;
|
||||
}
|
||||
#endif
|
||||
|
||||
static INPUT_PORTS_START( bking )
|
||||
PORT_START("IN0")
|
||||
@ -440,8 +378,6 @@ void bking_state::machine_reset()
|
||||
|
||||
MACHINE_RESET_MEMBER(bking_state,bking3)
|
||||
{
|
||||
m_mcu->set_input_line(0, CLEAR_LINE);
|
||||
|
||||
bking_state::machine_reset();
|
||||
|
||||
/* misc */
|
||||
@ -505,9 +441,7 @@ static MACHINE_CONFIG_DERIVED( bking3, bking )
|
||||
MCFG_CPU_MODIFY("main_cpu")
|
||||
MCFG_CPU_IO_MAP(bking3_io_map)
|
||||
|
||||
MCFG_CPU_ADD("mcu", M68705, XTAL_3MHz) /* xtal is 3MHz, divided by 4 internally */
|
||||
MCFG_CPU_PROGRAM_MAP(buggychl_mcu_map)
|
||||
MCFG_DEVICE_ADD("bmcu", BUGGYCHL_MCU, 0)
|
||||
MCFG_DEVICE_ADD("bmcu", TAITO68705_MCU, XTAL_3MHz) /* xtal is 3MHz, divided by 4 internally */
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(bking_state,bking3)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(bking_state,bking3)
|
||||
@ -774,7 +708,7 @@ ROM_START( bking3 )
|
||||
ROM_LOAD( "a24-19.4d", 0x1000, 0x1000, CRC(817f9c2a) SHA1(7365ecf2700e1fd13016408f5493f8d51aab5bbd) )
|
||||
ROM_LOAD( "a24-20.4b", 0x2000, 0x1000, CRC(0e9e16d6) SHA1(43c69602a8d9c34c527ce54472db84168acc4ef4) )
|
||||
|
||||
ROM_REGION( 0x0800, "mcu", 0 ) /* 2k for the microcontroller */
|
||||
ROM_REGION( 0x0800, "bmcu:mcu", 0 ) /* 2k for the microcontroller */
|
||||
ROM_LOAD( "a24_22.ic17", 0x000000, 0x000800, CRC(27c497d5) SHA1(c6c72bbf0537da53148fa0a56d412ab46129d29c) ) //M68705P5S uC 3MHz xtal
|
||||
|
||||
ROM_REGION( 0x6000, "gfx1", 0 ) /* Tiles */
|
||||
|
@ -140,8 +140,8 @@ static ADDRESS_MAP_START( buggychl_map, AS_PROGRAM, 8, buggychl_state )
|
||||
AM_RANGE(0xd200, 0xd200) AM_WRITE(bankswitch_w)
|
||||
AM_RANGE(0xd300, 0xd300) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w)
|
||||
AM_RANGE(0xd303, 0xd303) AM_WRITE(buggychl_sprite_lookup_bank_w)
|
||||
AM_RANGE(0xd400, 0xd400) AM_DEVREADWRITE("bmcu", buggychl_mcu_device, buggychl_mcu_r, buggychl_mcu_w)
|
||||
AM_RANGE(0xd401, 0xd401) AM_DEVREAD("bmcu", buggychl_mcu_device, buggychl_mcu_status_r)
|
||||
AM_RANGE(0xd400, 0xd400) AM_DEVREADWRITE("bmcu", taito68705_mcu_device, mcu_r, mcu_w)
|
||||
AM_RANGE(0xd401, 0xd401) AM_DEVREAD("bmcu", taito68705_mcu_device, mcu_status_r)
|
||||
AM_RANGE(0xd500, 0xd57f) AM_WRITEONLY AM_SHARE("spriteram")
|
||||
AM_RANGE(0xd600, 0xd600) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0xd601, 0xd601) AM_READ_PORT("DSW2")
|
||||
@ -347,8 +347,6 @@ void buggychl_state::machine_start()
|
||||
|
||||
void buggychl_state::machine_reset()
|
||||
{
|
||||
m_mcu->set_input_line(0, CLEAR_LINE);
|
||||
|
||||
m_sound_nmi_enable = 0;
|
||||
m_pending_nmi = 0;
|
||||
m_sl_bank = 0;
|
||||
@ -370,9 +368,8 @@ static MACHINE_CONFIG_START( buggychl, buggychl_state )
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(buggychl_state, irq0_line_hold, 60*60) /* irq is timed, tied to the cpu clock and not to vblank */
|
||||
/* nmi is caused by the main cpu */
|
||||
|
||||
MCFG_CPU_ADD("mcu", M68705,8000000/2) /* 4 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(buggychl_mcu_map)
|
||||
MCFG_DEVICE_ADD("bmcu", BUGGYCHL_MCU, 0)
|
||||
MCFG_DEVICE_ADD("bmcu", TAITO68705_MCU,8000000/2) /* 4 MHz */
|
||||
|
||||
|
||||
MCFG_WATCHDOG_ADD("watchdog")
|
||||
|
||||
@ -438,7 +435,7 @@ ROM_START( buggychl )
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound Z80 */
|
||||
ROM_LOAD( "a22-24.28", 0x00000, 0x4000, CRC(1e7f841f) SHA1(2dc0787b08d32acb78291b689c02dbb83d04d08c) )
|
||||
|
||||
ROM_REGION( 0x0800, "mcu", 0 ) /* 8k for the microcontroller */
|
||||
ROM_REGION( 0x0800, "bmcu:mcu", 0 ) /* 8k for the microcontroller */
|
||||
ROM_LOAD( "a22-19.31", 0x00000, 0x0800, CRC(06a71df0) SHA1(28183e6769e1471e7f28dc2a9f5b54e14b7ef339) )
|
||||
|
||||
ROM_REGION( 0x20000, "gfx1", 0 ) /* sprites */
|
||||
@ -468,7 +465,7 @@ ROM_START( buggychlt )
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound Z80 */
|
||||
ROM_LOAD( "a22-24.28", 0x00000, 0x4000, CRC(1e7f841f) SHA1(2dc0787b08d32acb78291b689c02dbb83d04d08c) )
|
||||
|
||||
ROM_REGION( 0x0800, "mcu", 0 ) /* 8k for the microcontroller */
|
||||
ROM_REGION( 0x0800, "bmcu:mcu", 0 ) /* 8k for the microcontroller */
|
||||
ROM_LOAD( "a22-19.31", 0x00000, 0x0800, CRC(06a71df0) SHA1(28183e6769e1471e7f28dc2a9f5b54e14b7ef339) )
|
||||
|
||||
ROM_REGION( 0x20000, "gfx1", 0 ) /* sprites */
|
||||
|
@ -1,7 +1,7 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Jarek Burczynski
|
||||
|
||||
#include "machine/buggychl.h"
|
||||
#include "machine/taito68705interface.h"
|
||||
#include "machine/gen_latch.h"
|
||||
#include "sound/msm5232.h"
|
||||
|
||||
@ -18,7 +18,7 @@ public:
|
||||
m_mcu_ram(*this, "mcu_ram"),
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_mcu(*this, "mcu"),
|
||||
//m_mcu(*this, "mcu"),
|
||||
m_bmcu(*this, "bmcu"),
|
||||
m_msm(*this, "msm"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
@ -75,8 +75,8 @@ public:
|
||||
/* devices */
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
optional_device<cpu_device> m_mcu;
|
||||
optional_device<buggychl_mcu_device> m_bmcu;
|
||||
//optional_device<cpu_device> m_mcu;
|
||||
optional_device<taito68705_mcu_device> m_bmcu;
|
||||
required_device<msm5232_device> m_msm;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Mike Balfour, Zsolt Vasvari
|
||||
|
||||
#include "machine/buggychl.h"
|
||||
#include "machine/taito68705interface.h"
|
||||
#include "machine/gen_latch.h"
|
||||
|
||||
class bking_state : public driver_device
|
||||
@ -11,7 +11,7 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_playfield_ram(*this, "playfield_ram"),
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_mcu(*this, "mcu"),
|
||||
//m_mcu(*this, "mcu"),
|
||||
m_bmcu(*this, "bmcu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
@ -51,8 +51,8 @@ public:
|
||||
|
||||
/* devices */
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
optional_device<cpu_device> m_mcu;
|
||||
optional_device<buggychl_mcu_device> m_bmcu;
|
||||
//optional_device<cpu_device> m_mcu;
|
||||
optional_device<taito68705_mcu_device> m_bmcu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
@ -4,7 +4,7 @@
|
||||
buggychl
|
||||
*/
|
||||
|
||||
#include "machine/buggychl.h"
|
||||
#include "machine/taito68705interface.h"
|
||||
#include "machine/gen_latch.h"
|
||||
#include "sound/msm5232.h"
|
||||
|
||||
@ -20,7 +20,7 @@ public:
|
||||
m_scrollh(*this, "scrollh"),
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_mcu(*this, "mcu"),
|
||||
// m_mcu(*this, "mcu"),
|
||||
m_bmcu(*this, "bmcu"),
|
||||
m_msm(*this, "msm"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
@ -53,8 +53,8 @@ public:
|
||||
/* devices */
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_mcu;
|
||||
required_device<buggychl_mcu_device> m_bmcu;
|
||||
//required_device<cpu_device> m_mcu;
|
||||
required_device<taito68705_mcu_device> m_bmcu;
|
||||
required_device<msm5232_device> m_msm;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// license:GPL-2.0+
|
||||
// copyright-holders:Jarek Burczynski
|
||||
|
||||
#include "machine/buggychl.h"
|
||||
#include "machine/taito68705interface.h"
|
||||
#include "machine/gen_latch.h"
|
||||
#include "sound/msm5232.h"
|
||||
|
||||
@ -58,7 +58,7 @@ public:
|
||||
/* devices */
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
optional_device<buggychl_mcu_device> m_bmcu;
|
||||
optional_device<taito68705_mcu_device> m_bmcu;
|
||||
required_device<msm5232_device> m_msm;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
@ -2,13 +2,22 @@
|
||||
// copyright-holders:Ernesto Corvi, Nicola Salmoria
|
||||
#include "emu.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "machine/buggychl.h"
|
||||
#include "machine/taito68705interface.h"
|
||||
|
||||
/*
|
||||
Most Taito 68705s share a similar (often identical) hookup.
|
||||
This file encapsulates that.
|
||||
|
||||
const device_type BUGGYCHL_MCU = &device_creator<buggychl_mcu_device>;
|
||||
used by:
|
||||
buggychl.cpp - buggychl
|
||||
bking.cpp - bking3
|
||||
40love.cpp - 40love
|
||||
*/
|
||||
|
||||
buggychl_mcu_device::buggychl_mcu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, BUGGYCHL_MCU, "M68705 MCU Simulation (Buggy Challenge)", tag, owner, clock, "buggychl_mcu", __FILE__),
|
||||
const device_type TAITO68705_MCU = &device_creator<taito68705_mcu_device>;
|
||||
|
||||
taito68705_mcu_device::taito68705_mcu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, TAITO68705_MCU, "Taito M68705 MCU Interface", tag, owner, clock, "taito68705", __FILE__),
|
||||
m_port_a_in(0),
|
||||
m_port_a_out(0),
|
||||
m_ddr_a(0),
|
||||
@ -21,17 +30,42 @@ buggychl_mcu_device::buggychl_mcu_device(const machine_config &mconfig, const ch
|
||||
m_from_main(0),
|
||||
m_from_mcu(0),
|
||||
m_mcu_sent(0),
|
||||
m_main_sent(0)
|
||||
m_main_sent(0),
|
||||
m_mcu(*this, "mcu")
|
||||
{
|
||||
}
|
||||
|
||||
ADDRESS_MAP_START( taito68705_mcu_map, AS_PROGRAM, 8, taito68705_mcu_device )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x7ff)
|
||||
AM_RANGE(0x0000, 0x0000) AM_READWRITE(buggychl_68705_port_a_r, buggychl_68705_port_a_w)
|
||||
AM_RANGE(0x0001, 0x0001) AM_READWRITE(buggychl_68705_port_b_r, buggychl_68705_port_b_w)
|
||||
AM_RANGE(0x0002, 0x0002) AM_READWRITE(buggychl_68705_port_c_r, buggychl_68705_port_c_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_WRITE(buggychl_68705_ddr_a_w)
|
||||
AM_RANGE(0x0005, 0x0005) AM_WRITE(buggychl_68705_ddr_b_w)
|
||||
AM_RANGE(0x0006, 0x0006) AM_WRITE(buggychl_68705_ddr_c_w)
|
||||
AM_RANGE(0x0010, 0x007f) AM_RAM
|
||||
AM_RANGE(0x0080, 0x07ff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( taito68705 )
|
||||
MCFG_CPU_ADD("mcu", M68705, DERIVED_CLOCK(1,1))
|
||||
MCFG_CPU_PROGRAM_MAP(taito68705_mcu_map)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
machine_config_constructor taito68705_mcu_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( taito68705 );
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void buggychl_mcu_device::device_config_complete()
|
||||
void taito68705_mcu_device::device_config_complete()
|
||||
{
|
||||
}
|
||||
|
||||
@ -39,10 +73,8 @@ void buggychl_mcu_device::device_config_complete()
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void buggychl_mcu_device::device_start()
|
||||
void taito68705_mcu_device::device_start()
|
||||
{
|
||||
m_mcu = machine().device("mcu");
|
||||
|
||||
save_item(NAME(m_from_main));
|
||||
save_item(NAME(m_from_mcu));
|
||||
save_item(NAME(m_mcu_sent));
|
||||
@ -62,7 +94,7 @@ void buggychl_mcu_device::device_start()
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void buggychl_mcu_device::device_reset()
|
||||
void taito68705_mcu_device::device_reset()
|
||||
{
|
||||
m_mcu_sent = 0;
|
||||
m_main_sent = 0;
|
||||
@ -77,6 +109,8 @@ void buggychl_mcu_device::device_reset()
|
||||
m_port_c_in = 0;
|
||||
m_port_c_out = 0;
|
||||
m_ddr_c = 0;
|
||||
|
||||
m_mcu->set_input_line(0, CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -88,19 +122,19 @@ void buggychl_mcu_device::device_reset()
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
READ8_MEMBER( buggychl_mcu_device::buggychl_68705_port_a_r )
|
||||
READ8_MEMBER( taito68705_mcu_device::buggychl_68705_port_a_r )
|
||||
{
|
||||
//logerror("%04x: 68705 port A read %02x\n", m_mcu->safe_pc(), m_port_a_in);
|
||||
return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( buggychl_mcu_device::buggychl_68705_port_a_w )
|
||||
WRITE8_MEMBER( taito68705_mcu_device::buggychl_68705_port_a_w )
|
||||
{
|
||||
//logerror("%04x: 68705 port A write %02x\n", m_mcu->safe_pc(), data);
|
||||
m_port_a_out = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( buggychl_mcu_device::buggychl_68705_ddr_a_w )
|
||||
WRITE8_MEMBER( taito68705_mcu_device::buggychl_68705_ddr_a_w )
|
||||
{
|
||||
m_ddr_a = data;
|
||||
}
|
||||
@ -126,20 +160,20 @@ WRITE8_MEMBER( buggychl_mcu_device::buggychl_68705_ddr_a_w )
|
||||
*/
|
||||
|
||||
|
||||
READ8_MEMBER( buggychl_mcu_device::buggychl_68705_port_b_r )
|
||||
READ8_MEMBER( taito68705_mcu_device::buggychl_68705_port_b_r )
|
||||
{
|
||||
return (m_port_b_out & m_ddr_b) | (m_port_b_in & ~m_ddr_b);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( buggychl_mcu_device::buggychl_68705_port_b_w )
|
||||
WRITE8_MEMBER( taito68705_mcu_device::buggychl_68705_port_b_w )
|
||||
{
|
||||
logerror("%04x: 68705 port B write %02x\n", m_mcu->safe_pc(), data);
|
||||
logerror("%s: 68705 port B write %02x\n", machine().describe_context(), data);
|
||||
|
||||
if ((m_ddr_b & 0x02) && (~data & 0x02) && (m_port_b_out & 0x02))
|
||||
{
|
||||
m_port_a_in = m_from_main;
|
||||
if (m_main_sent)
|
||||
m_mcu->execute().set_input_line(0, CLEAR_LINE);
|
||||
m_mcu->set_input_line(0, CLEAR_LINE);
|
||||
m_main_sent = 0;
|
||||
logerror("read command %02x from main cpu\n", m_port_a_in);
|
||||
}
|
||||
@ -153,7 +187,7 @@ WRITE8_MEMBER( buggychl_mcu_device::buggychl_68705_port_b_w )
|
||||
m_port_b_out = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( buggychl_mcu_device::buggychl_68705_ddr_b_w )
|
||||
WRITE8_MEMBER( taito68705_mcu_device::buggychl_68705_ddr_b_w )
|
||||
{
|
||||
m_ddr_b = data;
|
||||
}
|
||||
@ -168,51 +202,51 @@ WRITE8_MEMBER( buggychl_mcu_device::buggychl_68705_ddr_b_w )
|
||||
* 1 R 0 when pending command 68705->Z80
|
||||
*/
|
||||
|
||||
READ8_MEMBER( buggychl_mcu_device::buggychl_68705_port_c_r )
|
||||
READ8_MEMBER( taito68705_mcu_device::buggychl_68705_port_c_r )
|
||||
{
|
||||
m_port_c_in = 0;
|
||||
if (m_main_sent)
|
||||
m_port_c_in |= 0x01;
|
||||
if (!m_mcu_sent)
|
||||
m_port_c_in |= 0x02;
|
||||
logerror("%04x: 68705 port C read %02x\n", m_mcu->safe_pc(), m_port_c_in);
|
||||
logerror("$s: 68705 port C read %02x\n", machine().describe_context(), m_port_c_in);
|
||||
return (m_port_c_out & m_ddr_c) | (m_port_c_in & ~m_ddr_c);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( buggychl_mcu_device::buggychl_68705_port_c_w )
|
||||
WRITE8_MEMBER( taito68705_mcu_device::buggychl_68705_port_c_w )
|
||||
{
|
||||
logerror("%04x: 68705 port C write %02x\n", m_mcu->safe_pc(), data);
|
||||
logerror("%s: 68705 port C write %02x\n", machine().describe_context(), data);
|
||||
m_port_c_out = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( buggychl_mcu_device::buggychl_68705_ddr_c_w )
|
||||
WRITE8_MEMBER( taito68705_mcu_device::buggychl_68705_ddr_c_w )
|
||||
{
|
||||
m_ddr_c = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER( buggychl_mcu_device::buggychl_mcu_w )
|
||||
WRITE8_MEMBER( taito68705_mcu_device::mcu_w )
|
||||
{
|
||||
logerror("%04x: mcu_w %02x\n", m_mcu->safe_pc(), data);
|
||||
logerror("%s: mcu_w %02x\n", machine().describe_context(), data);
|
||||
m_from_main = data;
|
||||
m_main_sent = 1;
|
||||
m_mcu->execute().set_input_line(0, ASSERT_LINE);
|
||||
m_mcu->set_input_line(0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
READ8_MEMBER( buggychl_mcu_device::buggychl_mcu_r )
|
||||
READ8_MEMBER( taito68705_mcu_device::mcu_r )
|
||||
{
|
||||
logerror("%04x: mcu_r %02x\n", m_mcu->safe_pc(), m_from_mcu);
|
||||
logerror("%s: mcu_r %02x\n", machine().describe_context(), m_from_mcu);
|
||||
m_mcu_sent = 0;
|
||||
return m_from_mcu;
|
||||
}
|
||||
|
||||
READ8_MEMBER( buggychl_mcu_device::buggychl_mcu_status_r )
|
||||
READ8_MEMBER( taito68705_mcu_device::mcu_status_r )
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
/* 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 */
|
||||
//logerror("%04x: mcu_status_r\n",m_mcu->safe_pc());
|
||||
//logerror("%s: mcu_status_r\n",machine().describe_context());
|
||||
if (!m_main_sent)
|
||||
res |= 0x01;
|
||||
if (m_mcu_sent)
|
||||
@ -221,14 +255,3 @@ READ8_MEMBER( buggychl_mcu_device::buggychl_mcu_status_r )
|
||||
return res;
|
||||
}
|
||||
|
||||
ADDRESS_MAP_START( buggychl_mcu_map, AS_PROGRAM, 8, buggychl_mcu_device )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x7ff)
|
||||
AM_RANGE(0x0000, 0x0000) AM_DEVREADWRITE("bmcu", buggychl_mcu_device, buggychl_68705_port_a_r, buggychl_68705_port_a_w)
|
||||
AM_RANGE(0x0001, 0x0001) AM_DEVREADWRITE("bmcu", buggychl_mcu_device, buggychl_68705_port_b_r, buggychl_68705_port_b_w)
|
||||
AM_RANGE(0x0002, 0x0002) AM_DEVREADWRITE("bmcu", buggychl_mcu_device, buggychl_68705_port_c_r, buggychl_68705_port_c_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_DEVWRITE("bmcu", buggychl_mcu_device, buggychl_68705_ddr_a_w)
|
||||
AM_RANGE(0x0005, 0x0005) AM_DEVWRITE("bmcu", buggychl_mcu_device, buggychl_68705_ddr_b_w)
|
||||
AM_RANGE(0x0006, 0x0006) AM_DEVWRITE("bmcu", buggychl_mcu_device, buggychl_68705_ddr_c_w)
|
||||
AM_RANGE(0x0010, 0x007f) AM_RAM
|
||||
AM_RANGE(0x0080, 0x07ff) AM_ROM
|
||||
ADDRESS_MAP_END
|
@ -1,14 +1,17 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Ernesto Corvi, Nicola Salmoria
|
||||
class buggychl_mcu_device : public device_t
|
||||
|
||||
#include "cpu/m6805/m6805.h"
|
||||
|
||||
class taito68705_mcu_device : public device_t
|
||||
{
|
||||
public:
|
||||
buggychl_mcu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
~buggychl_mcu_device() {}
|
||||
taito68705_mcu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
~taito68705_mcu_device() {}
|
||||
|
||||
DECLARE_WRITE8_MEMBER( buggychl_mcu_w );
|
||||
DECLARE_READ8_MEMBER( buggychl_mcu_r );
|
||||
DECLARE_READ8_MEMBER( buggychl_mcu_status_r );
|
||||
DECLARE_WRITE8_MEMBER( mcu_w );
|
||||
DECLARE_READ8_MEMBER( mcu_r );
|
||||
DECLARE_READ8_MEMBER( mcu_status_r );
|
||||
DECLARE_READ8_MEMBER( buggychl_68705_port_a_r );
|
||||
DECLARE_WRITE8_MEMBER( buggychl_68705_port_a_w );
|
||||
DECLARE_WRITE8_MEMBER( buggychl_68705_ddr_a_w );
|
||||
@ -21,6 +24,7 @@ public:
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual machine_config_constructor device_mconfig_additions() const override;
|
||||
virtual void device_config_complete() override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
@ -40,9 +44,7 @@ private:
|
||||
uint8_t m_from_mcu;
|
||||
int m_mcu_sent;
|
||||
int m_main_sent;
|
||||
device_t *m_mcu;
|
||||
required_device<cpu_device> m_mcu;
|
||||
};
|
||||
|
||||
ADDRESS_MAP_EXTERN( buggychl_mcu_map, 8 );
|
||||
|
||||
extern const device_type BUGGYCHL_MCU;
|
||||
extern const device_type TAITO68705_MCU;
|
Loading…
Reference in New Issue
Block a user