mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
ok, made TMPZ84C011 pins external instead of making drivers having to interface with its internal peripherals
This commit is contained in:
parent
676af85696
commit
bf4d8f4cfd
@ -13,7 +13,7 @@
|
||||
const device_type TMPZ84C011 = &device_creator<tmpz84c011_device>;
|
||||
|
||||
static ADDRESS_MAP_START( tmpz84c011_internal_io_map, AS_IO, 8, tmpz84c011_device )
|
||||
AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_DEVREADWRITE("ctc", z80ctc_device, read, write)
|
||||
AM_RANGE(0x10, 0x13) AM_MIRROR(0xff00) AM_DEVREADWRITE("tmpz84c011_ctc", z80ctc_device, read, write)
|
||||
|
||||
AM_RANGE(0x50, 0x50) AM_MIRROR(0xff00) AM_READWRITE(tmpz84c011_pa_r, tmpz84c011_pa_w)
|
||||
AM_RANGE(0x51, 0x51) AM_MIRROR(0xff00) AM_READWRITE(tmpz84c011_pb_r, tmpz84c011_pb_w)
|
||||
@ -30,8 +30,8 @@ ADDRESS_MAP_END
|
||||
|
||||
tmpz84c011_device::tmpz84c011_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: z80_device(mconfig, TMPZ84C011, "TMPZ84C011", tag, owner, clock, "tmpz84c011", __FILE__),
|
||||
m_ctc(*this, "ctc"),
|
||||
m_io_space_config( "io", ENDIANNESS_LITTLE, 8, 16, 0, ADDRESS_MAP_NAME( tmpz84c011_internal_io_map ) ),
|
||||
m_ctc(*this, "tmpz84c011_ctc"),
|
||||
m_outportsa(*this),
|
||||
m_outportsb(*this),
|
||||
m_outportsc(*this),
|
||||
@ -41,7 +41,10 @@ tmpz84c011_device::tmpz84c011_device(const machine_config &mconfig, const char *
|
||||
m_inportsb(*this),
|
||||
m_inportsc(*this),
|
||||
m_inportsd(*this),
|
||||
m_inportse(*this)
|
||||
m_inportse(*this),
|
||||
m_zc0_cb(*this),
|
||||
m_zc1_cb(*this),
|
||||
m_zc2_cb(*this)
|
||||
{
|
||||
memset(m_pio_dir, 0, 5);
|
||||
memset(m_pio_latch, 0, 5);
|
||||
@ -69,6 +72,10 @@ void tmpz84c011_device::device_start()
|
||||
m_inportsd.resolve_safe(0);
|
||||
m_inportse.resolve_safe(0);
|
||||
|
||||
m_zc0_cb.resolve_safe();
|
||||
m_zc1_cb.resolve_safe();
|
||||
m_zc2_cb.resolve_safe();
|
||||
|
||||
// register for save states
|
||||
save_item(NAME(m_pio_dir[0]));
|
||||
save_item(NAME(m_pio_latch[0]));
|
||||
@ -91,7 +98,7 @@ void tmpz84c011_device::device_reset()
|
||||
{
|
||||
z80_device::device_reset();
|
||||
|
||||
// initialize TMPZ84C011 PIO
|
||||
// initialize I/O
|
||||
tmpz84c011_dir_pa_w(*m_io, 0, 0); tmpz84c011_pa_w(*m_io, 0, 0xff);
|
||||
tmpz84c011_dir_pb_w(*m_io, 0, 0); tmpz84c011_pb_w(*m_io, 0, 0xff);
|
||||
tmpz84c011_dir_pc_w(*m_io, 0, 0); tmpz84c011_pc_w(*m_io, 0, 0xff);
|
||||
@ -207,8 +214,11 @@ WRITE8_MEMBER(tmpz84c011_device::tmpz84c011_dir_pe_w)
|
||||
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( tmpz84c011 )
|
||||
MCFG_DEVICE_ADD("ctc", Z80CTC, DERIVED_CLOCK(1,1) )
|
||||
MCFG_DEVICE_ADD("tmpz84c011_ctc", Z80CTC, DERIVED_CLOCK(1,1) )
|
||||
MCFG_Z80CTC_INTR_CB(INPUTLINE(DEVICE_SELF, INPUT_LINE_IRQ0))
|
||||
MCFG_Z80CTC_ZC0_CB(WRITELINE(tmpz84c011_device, zc0_cb_trampoline_w))
|
||||
MCFG_Z80CTC_ZC1_CB(WRITELINE(tmpz84c011_device, zc1_cb_trampoline_w))
|
||||
MCFG_Z80CTC_ZC2_CB(WRITELINE(tmpz84c011_device, zc2_cb_trampoline_w))
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
machine_config_constructor tmpz84c011_device::device_mconfig_additions() const
|
||||
|
@ -5,12 +5,35 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __TMPZ84C011__
|
||||
#define __TMPZ84C011__
|
||||
|
||||
#include "emu.h"
|
||||
#include "z80.h"
|
||||
#include "machine/z80ctc.h"
|
||||
|
||||
// NOTE: for CTC callbacks, see machine/z80ctc.h
|
||||
// TMPZ84C011 PIO callbacks
|
||||
|
||||
/***************************************************************************
|
||||
DEVICE CONFIGURATION MACROS
|
||||
***************************************************************************/
|
||||
|
||||
// For daisy chain configuration, insert this:
|
||||
#define TMPZ84C011_DAISY_INTERNAL { "tmpz84c011_ctc" }
|
||||
|
||||
// CTC callbacks
|
||||
#define MCFG_TMPZ84C011_ZC0_CB(_devcb) \
|
||||
devcb = &tmpz84c011_device::set_zc0_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_TMPZ84C011_ZC1_CB(_devcb) \
|
||||
devcb = &tmpz84c011_device::set_zc1_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_TMPZ84C011_ZC2_CB(_devcb) \
|
||||
devcb = &tmpz84c011_device::set_zc2_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
|
||||
// I/O callbacks
|
||||
#define MCFG_TMPZ84C011_PORTA_READ_CB(_devcb) \
|
||||
devcb = &tmpz84c011_device::set_inportsa_cb(*device, DEVCB_##_devcb);
|
||||
|
||||
@ -43,12 +66,20 @@
|
||||
devcb = &tmpz84c011_device::set_outportse_cb(*device, DEVCB_##_devcb);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
class tmpz84c011_device : public z80_device
|
||||
{
|
||||
public:
|
||||
tmpz84c011_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
|
||||
|
||||
// static configuration helpers
|
||||
template<class _Object> static devcb_base &set_zc0_callback(device_t &device, _Object object) { return downcast<tmpz84c011_device &>(device).m_zc0_cb.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_zc1_callback(device_t &device, _Object object) { return downcast<tmpz84c011_device &>(device).m_zc1_cb.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_zc2_callback(device_t &device, _Object object) { return downcast<tmpz84c011_device &>(device).m_zc2_cb.set_callback(object); }
|
||||
|
||||
template<class _Object> static devcb_base & set_outportsa_cb(device_t &device, _Object object) { return downcast<tmpz84c011_device &>(device).m_outportsa.set_callback(object); }
|
||||
template<class _Object> static devcb_base & set_outportsb_cb(device_t &device, _Object object) { return downcast<tmpz84c011_device &>(device).m_outportsb.set_callback(object); }
|
||||
template<class _Object> static devcb_base & set_outportsc_cb(device_t &device, _Object object) { return downcast<tmpz84c011_device &>(device).m_outportsc.set_callback(object); }
|
||||
@ -61,29 +92,39 @@ public:
|
||||
template<class _Object> static devcb_base & set_inportsd_cb(device_t &device, _Object object) { return downcast<tmpz84c011_device &>(device).m_inportsd.set_callback(object); }
|
||||
template<class _Object> static devcb_base & set_inportse_cb(device_t &device, _Object object) { return downcast<tmpz84c011_device &>(device).m_inportse.set_callback(object); }
|
||||
|
||||
// devices/pointers
|
||||
required_device<z80ctc_device> m_ctc;
|
||||
// CTC public interface
|
||||
DECLARE_WRITE_LINE_MEMBER( trg0 ) { m_ctc->trg0(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( trg1 ) { m_ctc->trg1(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( trg2 ) { m_ctc->trg2(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( trg3 ) { m_ctc->trg3(state); }
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
DECLARE_READ8_MEMBER(tmpz84c011_pa_r);
|
||||
DECLARE_READ8_MEMBER(tmpz84c011_pb_r);
|
||||
DECLARE_READ8_MEMBER(tmpz84c011_pc_r);
|
||||
DECLARE_READ8_MEMBER(tmpz84c011_pd_r);
|
||||
DECLARE_READ8_MEMBER(tmpz84c011_pe_r);
|
||||
DECLARE_WRITE8_MEMBER(tmpz84c011_pa_w);
|
||||
DECLARE_WRITE8_MEMBER(tmpz84c011_pb_w);
|
||||
DECLARE_WRITE8_MEMBER(tmpz84c011_pc_w);
|
||||
DECLARE_WRITE8_MEMBER(tmpz84c011_pd_w);
|
||||
DECLARE_WRITE8_MEMBER(tmpz84c011_pe_w);
|
||||
DECLARE_READ8_MEMBER(tmpz84c011_dir_pa_r);
|
||||
DECLARE_READ8_MEMBER(tmpz84c011_dir_pb_r);
|
||||
DECLARE_READ8_MEMBER(tmpz84c011_dir_pc_r);
|
||||
DECLARE_READ8_MEMBER(tmpz84c011_dir_pd_r);
|
||||
DECLARE_READ8_MEMBER(tmpz84c011_dir_pe_r);
|
||||
DECLARE_WRITE8_MEMBER(tmpz84c011_dir_pa_w);
|
||||
DECLARE_WRITE8_MEMBER(tmpz84c011_dir_pb_w);
|
||||
DECLARE_WRITE8_MEMBER(tmpz84c011_dir_pc_w);
|
||||
DECLARE_WRITE8_MEMBER(tmpz84c011_dir_pd_w);
|
||||
DECLARE_WRITE8_MEMBER(tmpz84c011_dir_pe_w);
|
||||
DECLARE_READ8_MEMBER( tmpz84c011_pa_r );
|
||||
DECLARE_READ8_MEMBER( tmpz84c011_pb_r );
|
||||
DECLARE_READ8_MEMBER( tmpz84c011_pc_r );
|
||||
DECLARE_READ8_MEMBER( tmpz84c011_pd_r );
|
||||
DECLARE_READ8_MEMBER( tmpz84c011_pe_r );
|
||||
DECLARE_WRITE8_MEMBER( tmpz84c011_pa_w );
|
||||
DECLARE_WRITE8_MEMBER( tmpz84c011_pb_w );
|
||||
DECLARE_WRITE8_MEMBER( tmpz84c011_pc_w );
|
||||
DECLARE_WRITE8_MEMBER( tmpz84c011_pd_w );
|
||||
DECLARE_WRITE8_MEMBER( tmpz84c011_pe_w );
|
||||
|
||||
DECLARE_READ8_MEMBER( tmpz84c011_dir_pa_r );
|
||||
DECLARE_READ8_MEMBER( tmpz84c011_dir_pb_r );
|
||||
DECLARE_READ8_MEMBER( tmpz84c011_dir_pc_r );
|
||||
DECLARE_READ8_MEMBER( tmpz84c011_dir_pd_r );
|
||||
DECLARE_READ8_MEMBER( tmpz84c011_dir_pe_r );
|
||||
DECLARE_WRITE8_MEMBER( tmpz84c011_dir_pa_w );
|
||||
DECLARE_WRITE8_MEMBER( tmpz84c011_dir_pb_w );
|
||||
DECLARE_WRITE8_MEMBER( tmpz84c011_dir_pc_w );
|
||||
DECLARE_WRITE8_MEMBER( tmpz84c011_dir_pd_w );
|
||||
DECLARE_WRITE8_MEMBER( tmpz84c011_dir_pe_w );
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( zc0_cb_trampoline_w ) { m_zc0_cb(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( zc1_cb_trampoline_w ) { m_zc1_cb(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( zc2_cb_trampoline_w ) { m_zc2_cb(state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -103,6 +144,9 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
// devices/pointers
|
||||
required_device<z80ctc_device> m_ctc;
|
||||
|
||||
// internal state
|
||||
UINT8 m_pio_dir[5];
|
||||
UINT8 m_pio_latch[5];
|
||||
@ -119,6 +163,15 @@ private:
|
||||
devcb_read8 m_inportsc;
|
||||
devcb_read8 m_inportsd;
|
||||
devcb_read8 m_inportse;
|
||||
|
||||
devcb_write_line m_zc0_cb;
|
||||
devcb_write_line m_zc1_cb;
|
||||
devcb_write_line m_zc2_cb;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
extern const device_type TMPZ84C011;
|
||||
|
||||
|
||||
#endif /// __TMPZ84C011__
|
||||
|
@ -5,18 +5,32 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __TMPZ84C015__
|
||||
#define __TMPZ84C015__
|
||||
|
||||
#include "emu.h"
|
||||
#include "z80.h"
|
||||
#include "machine/z80dart.h"
|
||||
#include "machine/z80ctc.h"
|
||||
#include "machine/z80pio.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
DEVICE CONFIGURATION MACROS
|
||||
***************************************************************************/
|
||||
|
||||
// If an external daisy chain is used, insert this before your own device tags:
|
||||
#define TMPZ84C015_DAISY_INTERNAL { "ctc" }, { "sio" }, { "pio" }
|
||||
|
||||
// NOTE: for callbacks, see machine/z80dart.h, machine/z80ctc.h, machine/z80pio.h
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
class tmpz84c015_device : public z80_device
|
||||
{
|
||||
public:
|
||||
@ -51,4 +65,9 @@ private:
|
||||
UINT8 m_irq_priority;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
extern const device_type TMPZ84C015;
|
||||
|
||||
|
||||
#endif // __TMPZ84C015__
|
||||
|
@ -1,3 +1,9 @@
|
||||
/***************************************************************************
|
||||
|
||||
Fujitsu MB89363 Parallel Communication Interface
|
||||
(this acts as a trampoline to 2x i8255 chips)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -450,7 +450,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(csplayh5_state::csplayh5_irq)
|
||||
|
||||
static const z80_daisy_config daisy_chain_sound[] =
|
||||
{
|
||||
{ "audiocpu:ctc" },
|
||||
TMPZ84C011_DAISY_INTERNAL,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -480,8 +480,7 @@ static MACHINE_CONFIG_START( csplayh5, csplayh5_state )
|
||||
MCFG_TMPZ84C011_PORTC_WRITE_CB(WRITE8(csplayh5_state, soundcpu_dac1_w))
|
||||
MCFG_TMPZ84C011_PORTD_READ_CB(READ8(csplayh5_state, soundcpu_portd_r))
|
||||
MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(csplayh5_state, soundcpu_porte_w))
|
||||
MCFG_DEVICE_MODIFY("audiocpu:ctc")
|
||||
MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("ctc", z80ctc_device, trg3))
|
||||
MCFG_TMPZ84C011_ZC0_CB(DEVWRITELINE("audiocpu", tmpz84c011_device, trg3))
|
||||
|
||||
MCFG_NVRAM_ADD_0FILL("nvram")
|
||||
|
||||
|
@ -11,13 +11,13 @@
|
||||
https://www.youtube.com/watch?v=yQpMvRL0FfM
|
||||
|
||||
todo:
|
||||
we have no way of telling the physical order of the moles on the control panel vs. the reads / writes
|
||||
so our moles could be in the wrong positions - maybe there are fixed patterns in the video we can use
|
||||
to figure it out? * the big mole appears to be worth 2 points so that one we can identify
|
||||
- we have no way of telling the physical order of the moles on the control panel vs. the reads / writes
|
||||
so our moles could be in the wrong positions - maybe there are fixed patterns in the video we can use
|
||||
to figure it out? * the big mole appears to be worth 2 points so that one we can identify
|
||||
|
||||
|
||||
|
||||
Additional 'DRIVE BOARD' PCB (todo, improve ascii layout)
|
||||
Additional 'DRIVE BOARD' PCB
|
||||
|
||||
--------------------------------------------------------------------------------------------------------------|
|
||||
| |
|
||||
@ -466,7 +466,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static const z80_daisy_config daisy_chain_gamecpu[] =
|
||||
{
|
||||
{ "gamecpu:ctc" },
|
||||
TMPZ84C011_DAISY_INTERNAL,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -321,9 +321,8 @@ WRITE8_MEMBER(nbmj9195_state::soundcpu_porte_w)
|
||||
/* CTC of main cpu, ch0 trigger is vblank */
|
||||
INTERRUPT_GEN_MEMBER(nbmj9195_state::ctc0_trg1)
|
||||
{
|
||||
z80ctc_device *ctc = machine().device<z80ctc_device>("maincpu:ctc");
|
||||
ctc->trg1(1);
|
||||
ctc->trg1(0);
|
||||
m_maincpu->trg1(1);
|
||||
m_maincpu->trg1(0);
|
||||
}
|
||||
|
||||
void nbmj9195_state::machine_reset()
|
||||
@ -2780,13 +2779,13 @@ INPUT_PORTS_END
|
||||
|
||||
static const z80_daisy_config daisy_chain_main[] =
|
||||
{
|
||||
{ "maincpu:ctc" },
|
||||
TMPZ84C011_DAISY_INTERNAL,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const z80_daisy_config daisy_chain_sound[] =
|
||||
{
|
||||
{ "audiocpu:ctc" },
|
||||
TMPZ84C011_DAISY_INTERNAL,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -2838,8 +2837,7 @@ static MACHINE_CONFIG_START( NBMJDRV1_base, nbmj9195_state )
|
||||
MCFG_CPU_CONFIG(daisy_chain_sound)
|
||||
MCFG_CPU_PROGRAM_MAP(sailorws_sound_map)
|
||||
MCFG_CPU_IO_MAP(sailorws_sound_io_map)
|
||||
MCFG_DEVICE_MODIFY("audiocpu:ctc")
|
||||
MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("ctc", z80ctc_device, trg3))
|
||||
MCFG_TMPZ84C011_ZC0_CB(DEVWRITELINE("audiocpu", tmpz84c011_device, trg3))
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
|
@ -762,7 +762,7 @@ INTERRUPT_GEN_MEMBER(niyanpai_state::niyanpai_interrupt)
|
||||
|
||||
static const z80_daisy_config daisy_chain_sound[] =
|
||||
{
|
||||
{ "audiocpu:ctc" },
|
||||
TMPZ84C011_DAISY_INTERNAL,
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -786,8 +786,7 @@ static MACHINE_CONFIG_START( niyanpai, niyanpai_state )
|
||||
MCFG_TMPZ84C011_PORTB_WRITE_CB(WRITE8(niyanpai_state, cpu_portb_w))
|
||||
MCFG_TMPZ84C011_PORTC_WRITE_CB(WRITE8(niyanpai_state, cpu_portc_w))
|
||||
MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(niyanpai_state, cpu_porte_w))
|
||||
MCFG_DEVICE_MODIFY("audiocpu:ctc")
|
||||
MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("ctc", z80ctc_device, trg3))
|
||||
MCFG_TMPZ84C011_ZC0_CB(DEVWRITELINE("audiocpu", tmpz84c011_device, trg3))
|
||||
|
||||
MCFG_NVRAM_ADD_0FILL("nvram")
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/******************************************************************************
|
||||
|
||||
nbmj9195 - Nichibutsu Mahjong games for years 1991-1995
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "cpu/z80/tmpz84c011.h"
|
||||
#include "sound/dac.h"
|
||||
|
||||
#define VRAM_MAX 2
|
||||
@ -20,7 +27,14 @@ public:
|
||||
m_dac1(*this, "dac1"),
|
||||
m_dac2(*this, "dac2"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette")
|
||||
{ }
|
||||
|
||||
required_device<tmpz84c011_device> m_maincpu;
|
||||
required_device<dac_device> m_dac1;
|
||||
required_device<dac_device> m_dac2;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
int m_inputport;
|
||||
int m_dipswbitsel;
|
||||
@ -114,11 +128,6 @@ public:
|
||||
int nbmj9195_dipsw_r();
|
||||
void nbmj9195_dipswbitsel_w(int data);
|
||||
void mscoutm_inputportsel_w(int data);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<dac_device> m_dac1;
|
||||
required_device<dac_device> m_dac2;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
Loading…
Reference in New Issue
Block a user