mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
Converted qs1000_device to devcb2 (nw)
This commit is contained in:
parent
316bac013e
commit
818832987d
@ -183,6 +183,14 @@ qs1000_device::qs1000_device(const machine_config &mconfig, const char *tag, dev
|
||||
: device_t(mconfig, QS1000, "QS1000", tag, owner, clock, "qs1000", __FILE__),
|
||||
device_sound_interface(mconfig, *this),
|
||||
device_memory_interface(mconfig, *this),
|
||||
m_external_rom(false),
|
||||
m_in_p1_cb(*this),
|
||||
m_in_p2_cb(*this),
|
||||
m_in_p3_cb(*this),
|
||||
m_out_p1_cb(*this),
|
||||
m_out_p2_cb(*this),
|
||||
m_out_p3_cb(*this),
|
||||
//m_serial_w_cb(*this),
|
||||
m_space_config("samples", ENDIANNESS_LITTLE, 8, 24, 0, NULL),
|
||||
m_stream(NULL),
|
||||
m_direct(NULL),
|
||||
@ -226,13 +234,15 @@ void qs1000_device::device_start()
|
||||
m_stream = stream_alloc(0, 2, clock() / 32);
|
||||
|
||||
// Resolve CPU port callbacks
|
||||
m_p1_r_func.resolve(m_in_p1_cb, *this);
|
||||
m_p2_r_func.resolve(m_in_p2_cb, *this);
|
||||
m_p3_r_func.resolve(m_in_p3_cb, *this);
|
||||
m_in_p1_cb.resolve_safe(0);
|
||||
m_in_p2_cb.resolve_safe(0);
|
||||
m_in_p3_cb.resolve_safe(0);
|
||||
|
||||
m_p1_w_func.resolve(m_out_p1_cb, *this);
|
||||
m_p2_w_func.resolve(m_out_p2_cb, *this);
|
||||
m_p3_w_func.resolve(m_out_p3_cb, *this);
|
||||
m_out_p1_cb.resolve_safe();
|
||||
m_out_p2_cb.resolve_safe();
|
||||
m_out_p3_cb.resolve_safe();
|
||||
|
||||
//m_serial_w_cb.resolve_safe();
|
||||
|
||||
m_cpu->i8051_set_serial_rx_callback(read8_delegate(FUNC(qs1000_device::data_to_i8052),this));
|
||||
|
||||
@ -273,18 +283,6 @@ READ8_MEMBER(qs1000_device::data_to_i8052)
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete
|
||||
//-------------------------------------------------
|
||||
void qs1000_device::device_config_complete()
|
||||
{
|
||||
const qs1000_interface *intf = reinterpret_cast<const qs1000_interface *>(static_config());
|
||||
|
||||
if (intf != NULL)
|
||||
*static_cast<qs1000_interface *>(this) = *intf;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
@ -330,7 +328,7 @@ READ8_MEMBER( qs1000_device::p0_r )
|
||||
//-------------------------------------------------
|
||||
READ8_MEMBER( qs1000_device::p1_r )
|
||||
{
|
||||
return m_p1_r_func(0);
|
||||
return m_in_p1_cb(0);
|
||||
}
|
||||
|
||||
|
||||
@ -339,7 +337,7 @@ READ8_MEMBER( qs1000_device::p1_r )
|
||||
//-------------------------------------------------
|
||||
READ8_MEMBER( qs1000_device::p2_r )
|
||||
{
|
||||
return m_p2_r_func(0);
|
||||
return m_in_p2_cb(0);
|
||||
}
|
||||
|
||||
|
||||
@ -348,12 +346,12 @@ READ8_MEMBER( qs1000_device::p2_r )
|
||||
//-------------------------------------------------
|
||||
READ8_MEMBER( qs1000_device::p3_r )
|
||||
{
|
||||
return m_p3_r_func(0);
|
||||
return m_in_p3_cb(0);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// p1_w
|
||||
// p0_w
|
||||
//-------------------------------------------------
|
||||
WRITE8_MEMBER( qs1000_device::p0_w )
|
||||
{
|
||||
@ -366,7 +364,7 @@ WRITE8_MEMBER( qs1000_device::p0_w )
|
||||
|
||||
WRITE8_MEMBER( qs1000_device::p1_w )
|
||||
{
|
||||
m_p1_w_func(0, data);
|
||||
m_out_p1_cb((offs_t)0, data);
|
||||
}
|
||||
|
||||
|
||||
@ -376,7 +374,7 @@ WRITE8_MEMBER( qs1000_device::p1_w )
|
||||
|
||||
WRITE8_MEMBER( qs1000_device::p2_w )
|
||||
{
|
||||
m_p2_w_func(0, data);
|
||||
m_out_p2_cb((offs_t)0, data);
|
||||
}
|
||||
|
||||
|
||||
@ -386,7 +384,7 @@ WRITE8_MEMBER( qs1000_device::p2_w )
|
||||
|
||||
WRITE8_MEMBER( qs1000_device::p3_w )
|
||||
{
|
||||
m_p3_w_func(0, data);
|
||||
m_out_p3_cb((offs_t)0, data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,14 +18,29 @@
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_QS1000_ADD(_tag, _clock, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, QS1000, _clock) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
#define MCFG_QS1000_EXTERNAL_ROM(_bool) \
|
||||
qs1000_device::set_external_rom(*device, _bool);
|
||||
|
||||
#define QS1000_INTERFACE(name) \
|
||||
const qs1000_interface (name) =
|
||||
#define MCFG_QS1000_IN_P1_CB(_devcb) \
|
||||
devcb = &qs1000_device::set_in_p1_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_QS1000_IN_P2_CB(_devcb) \
|
||||
devcb = &qs1000_device::set_in_p2_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_QS1000_IN_P3_CB(_devcb) \
|
||||
devcb = &qs1000_device::set_in_p3_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_QS1000_OUT_P1_CB(_devcb) \
|
||||
devcb = &qs1000_device::set_out_p1_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_QS1000_OUT_P2_CB(_devcb) \
|
||||
devcb = &qs1000_device::set_out_p2_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_QS1000_OUT_P3_CB(_devcb) \
|
||||
devcb = &qs1000_device::set_out_p3_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
/*#define MCFG_QS1000_SERIAL_W_CB(_devcb) \
|
||||
devcb = &qs1000_device::set_serial_w_callback(*device, DEVCB2_##_devcb);*/
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
@ -34,35 +49,25 @@
|
||||
#define QS1000_CHANNELS 32
|
||||
#define QS1000_ADDRESS_MASK 0xffffff
|
||||
|
||||
class qs1000_device;
|
||||
|
||||
|
||||
struct qs1000_interface
|
||||
{
|
||||
bool m_external_rom;
|
||||
|
||||
devcb_read8 m_in_p1_cb;
|
||||
devcb_read8 m_in_p2_cb;
|
||||
devcb_read8 m_in_p3_cb;
|
||||
|
||||
devcb_write8 m_out_p1_cb;
|
||||
devcb_write8 m_out_p2_cb;
|
||||
devcb_write8 m_out_p3_cb;
|
||||
|
||||
devcb_write8 m_serial_w;
|
||||
};
|
||||
|
||||
// ======================> qs1000_device
|
||||
|
||||
class qs1000_device : public device_t,
|
||||
public device_sound_interface,
|
||||
public device_memory_interface,
|
||||
public qs1000_interface
|
||||
public device_memory_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
qs1000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
static void set_external_rom(device_t &device, bool external_rom) { downcast<qs1000_device &>(device).m_external_rom = external_rom; }
|
||||
template<class _Object> static devcb2_base &set_in_p1_callback(device_t &device, _Object object) { return downcast<qs1000_device &>(device).m_in_p1_cb.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_in_p2_callback(device_t &device, _Object object) { return downcast<qs1000_device &>(device).m_in_p2_cb.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_in_p3_callback(device_t &device, _Object object) { return downcast<qs1000_device &>(device).m_in_p3_cb.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_out_p1_callback(device_t &device, _Object object) { return downcast<qs1000_device &>(device).m_out_p1_cb.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_out_p2_callback(device_t &device, _Object object) { return downcast<qs1000_device &>(device).m_out_p2_cb.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_out_p3_callback(device_t &device, _Object object) { return downcast<qs1000_device &>(device).m_out_p3_cb.set_callback(object); }
|
||||
//template<class _Object> static devcb2_base &set_serial_w_callback(device_t &device, _Object object) { return downcast<qs1000_device &>(device).m_serial_w_cb.set_callback(object); }
|
||||
|
||||
// external
|
||||
void serial_in(UINT8 data);
|
||||
void set_irq(int state);
|
||||
@ -71,7 +76,6 @@ protected:
|
||||
// device-level overrides
|
||||
virtual const rom_entry *device_rom_region() const;
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
@ -108,13 +112,18 @@ public:
|
||||
void start_voice(int ch);
|
||||
void set_voice_regs(int ch);
|
||||
|
||||
bool m_external_rom;
|
||||
|
||||
// Callbacks
|
||||
devcb_resolved_read8 m_p1_r_func;
|
||||
devcb_resolved_read8 m_p2_r_func;
|
||||
devcb_resolved_read8 m_p3_r_func;
|
||||
devcb_resolved_write8 m_p1_w_func;
|
||||
devcb_resolved_write8 m_p2_w_func;
|
||||
devcb_resolved_write8 m_p3_w_func;
|
||||
devcb2_read8 m_in_p1_cb;
|
||||
devcb2_read8 m_in_p2_cb;
|
||||
devcb2_read8 m_in_p3_cb;
|
||||
|
||||
devcb2_write8 m_out_p1_cb;
|
||||
devcb2_write8 m_out_p2_cb;
|
||||
devcb2_write8 m_out_p3_cb;
|
||||
|
||||
//devcb2_write8 m_serial_w_cb;
|
||||
|
||||
// Internal state
|
||||
const address_space_config m_space_config;
|
||||
|
@ -537,29 +537,6 @@ static INPUT_PORTS_START( puzzlekg )
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* QS1000 interface
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static QS1000_INTERFACE( qs1000_intf )
|
||||
{
|
||||
/* External ROM */
|
||||
true,
|
||||
|
||||
/* P1-P3 read handlers */
|
||||
DEVCB_DRIVER_MEMBER(eolith_state, qs1000_p1_r),
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
|
||||
/* P1-P3 write handlers */
|
||||
DEVCB_DRIVER_MEMBER(eolith_state, qs1000_p1_w),
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
};
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
@ -600,7 +577,10 @@ static MACHINE_CONFIG_START( eolith45, eolith_state )
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
MCFG_QS1000_ADD("qs1000", XTAL_24MHz, qs1000_intf)
|
||||
MCFG_SOUND_ADD("qs1000", QS1000, XTAL_24MHz)
|
||||
MCFG_QS1000_EXTERNAL_ROM(true)
|
||||
MCFG_QS1000_IN_P1_CB(READ8(eolith_state, qs1000_p1_r))
|
||||
MCFG_QS1000_OUT_P1_CB(WRITE8(eolith_state, qs1000_p1_w))
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -625,22 +625,6 @@ void ghosteo_state::machine_reset()
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x4d000010, 0x4d000013,read32_delegate(FUNC(ghosteo_state::bballoon_speedup_r), this));
|
||||
}
|
||||
|
||||
static QS1000_INTERFACE( qs1000_intf )
|
||||
{
|
||||
/* External ROM */
|
||||
true,
|
||||
|
||||
/* P1-P3 read handlers */
|
||||
DEVCB_DRIVER_MEMBER(ghosteo_state, qs1000_p1_r),
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
|
||||
/* P1-P3 write handlers */
|
||||
DEVCB_DRIVER_MEMBER(ghosteo_state, qs1000_p1_w),
|
||||
DEVCB_DRIVER_MEMBER(ghosteo_state, qs1000_p2_w),
|
||||
DEVCB_DRIVER_MEMBER(ghosteo_state, qs1000_p3_w)
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_START( ghosteo, ghosteo_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
@ -666,7 +650,12 @@ static MACHINE_CONFIG_START( ghosteo, ghosteo_state )
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
MCFG_QS1000_ADD("qs1000", XTAL_24MHz, qs1000_intf)
|
||||
MCFG_SOUND_ADD("qs1000", QS1000, XTAL_24MHz)
|
||||
MCFG_QS1000_EXTERNAL_ROM(true)
|
||||
MCFG_QS1000_IN_P1_CB(READ8(ghosteo_state, qs1000_p1_r))
|
||||
MCFG_QS1000_OUT_P1_CB(WRITE8(ghosteo_state, qs1000_p1_w))
|
||||
MCFG_QS1000_OUT_P2_CB(WRITE8(ghosteo_state, qs1000_p2_w))
|
||||
MCFG_QS1000_OUT_P3_CB(WRITE8(ghosteo_state, qs1000_p3_w))
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -710,26 +710,6 @@ static GFXDECODE_START( limenko )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
/*****************************************************************************************************
|
||||
INTERFACES
|
||||
*****************************************************************************************************/
|
||||
|
||||
static QS1000_INTERFACE( qs1000_intf )
|
||||
{
|
||||
/* External ROM */
|
||||
true,
|
||||
|
||||
/* P1-P3 read handlers */
|
||||
DEVCB_DRIVER_MEMBER(limenko_state, qs1000_p1_r),
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
|
||||
/* P1-P3 write handlers */
|
||||
DEVCB_DRIVER_MEMBER(limenko_state, qs1000_p1_w),
|
||||
DEVCB_DRIVER_MEMBER(limenko_state, qs1000_p2_w),
|
||||
DEVCB_DRIVER_MEMBER(limenko_state, qs1000_p3_w),
|
||||
};
|
||||
|
||||
/*****************************************************************************************************
|
||||
MACHINE DRIVERS
|
||||
*****************************************************************************************************/
|
||||
@ -759,7 +739,12 @@ static MACHINE_CONFIG_START( limenko, limenko_state )
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
MCFG_QS1000_ADD("qs1000", XTAL_24MHz, qs1000_intf)
|
||||
MCFG_SOUND_ADD("qs1000", QS1000, XTAL_24MHz)
|
||||
MCFG_QS1000_EXTERNAL_ROM(true)
|
||||
MCFG_QS1000_IN_P1_CB(READ8(limenko_state, qs1000_p1_r))
|
||||
MCFG_QS1000_OUT_P1_CB(WRITE8(limenko_state, qs1000_p1_w))
|
||||
MCFG_QS1000_OUT_P2_CB(WRITE8(limenko_state, qs1000_p2_w))
|
||||
MCFG_QS1000_OUT_P3_CB(WRITE8(limenko_state, qs1000_p3_w))
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -945,28 +945,6 @@ static GFXDECODE_START( vamphalf )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
|
||||
|
||||
static QS1000_INTERFACE( qs1000_intf )
|
||||
{
|
||||
/* External ROM */
|
||||
true,
|
||||
|
||||
/* P1-P3 read handlers */
|
||||
DEVCB_DRIVER_MEMBER(vamphalf_state, qs1000_p1_r),
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
|
||||
/* P1-P3 write handlers */
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
DEVCB_DRIVER_MEMBER(vamphalf_state, qs1000_p3_w),
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( common, vamphalf_state )
|
||||
MCFG_CPU_ADD("maincpu", E116T, 50000000) /* 50 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(common_map)
|
||||
@ -1018,7 +996,10 @@ static MACHINE_CONFIG_FRAGMENT( sound_qs1000 )
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
MCFG_QS1000_ADD("qs1000", XTAL_24MHz, qs1000_intf)
|
||||
MCFG_SOUND_ADD("qs1000", QS1000, XTAL_24MHz)
|
||||
MCFG_QS1000_EXTERNAL_ROM(true)
|
||||
MCFG_QS1000_IN_P1_CB(READ8(vamphalf_state, qs1000_p1_r))
|
||||
MCFG_QS1000_OUT_P3_CB(WRITE8(vamphalf_state, qs1000_p3_w))
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -222,30 +222,6 @@ UINT32 vegaeo_state::screen_update_vega(screen_device &screen, bitmap_ind16 &bit
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* QS1000 interface
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static QS1000_INTERFACE( qs1000_intf )
|
||||
{
|
||||
/* External ROM */
|
||||
true,
|
||||
|
||||
/* P1-P3 read handlers */
|
||||
DEVCB_DRIVER_MEMBER(vegaeo_state, qs1000_p1_r),
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
|
||||
/* P1-P3 write handlers */
|
||||
DEVCB_DRIVER_MEMBER(vegaeo_state, qs1000_p1_w),
|
||||
DEVCB_DRIVER_MEMBER(vegaeo_state, qs1000_p2_w),
|
||||
DEVCB_DRIVER_MEMBER(vegaeo_state, qs1000_p3_w)
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( vega, vegaeo_state )
|
||||
MCFG_CPU_ADD("maincpu", GMS30C2132, XTAL_55MHz)
|
||||
MCFG_CPU_PROGRAM_MAP(vega_map)
|
||||
@ -270,7 +246,12 @@ static MACHINE_CONFIG_START( vega, vegaeo_state )
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
MCFG_QS1000_ADD("qs1000", XTAL_24MHz, qs1000_intf)
|
||||
MCFG_SOUND_ADD("qs1000", QS1000, XTAL_24MHz)
|
||||
MCFG_QS1000_EXTERNAL_ROM(true)
|
||||
MCFG_QS1000_IN_P1_CB(READ8(vegaeo_state, qs1000_p1_r))
|
||||
MCFG_QS1000_OUT_P1_CB(WRITE8(vegaeo_state, qs1000_p1_w))
|
||||
MCFG_QS1000_OUT_P2_CB(WRITE8(vegaeo_state, qs1000_p2_w))
|
||||
MCFG_QS1000_OUT_P3_CB(WRITE8(vegaeo_state, qs1000_p3_w))
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
Loading…
Reference in New Issue
Block a user