(MESS) ql: zx8301 devcb2. (nw)

This commit is contained in:
Curt Coder 2014-03-14 12:52:02 +00:00
parent a72e0f1822
commit 939e03a724
3 changed files with 24 additions and 66 deletions

View File

@ -707,18 +707,6 @@ INPUT_PORTS_END
// DEVICE CONFIGURATION // DEVICE CONFIGURATION
//************************************************************************** //**************************************************************************
//-------------------------------------------------
// ZX8301_INTERFACE( ql_zx8301_intf )
//-------------------------------------------------
static ZX8301_INTERFACE( ql_zx8301_intf )
{
M68008_TAG,
SCREEN_TAG,
DEVCB_DEVICE_LINE_MEMBER(ZX8302_TAG, zx8302_device, vsync_w)
};
//------------------------------------------------- //-------------------------------------------------
// ZX8302_INTERFACE( ql_zx8302_intf ) // ZX8302_INTERFACE( ql_zx8302_intf )
//------------------------------------------------- //-------------------------------------------------
@ -996,7 +984,9 @@ static MACHINE_CONFIG_START( ql, ql_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
// devices // devices
MCFG_ZX8301_ADD(ZX8301_TAG, X1, ql_zx8301_intf) MCFG_DEVICE_ADD(ZX8301_TAG, ZX8301, X1)
MCFG_ZX8301_CPU(M68008_TAG)
MCFG_ZX8301_VSYNC_CALLBACK(DEVWRITELINE(ZX8302_TAG, zx8302_device, vsync_w))
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
MCFG_ZX8302_ADD(ZX8302_TAG, X1, ql_zx8302_intf) MCFG_ZX8302_ADD(ZX8302_TAG, X1, ql_zx8302_intf)
MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(ql_floppy_interface) MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(ql_floppy_interface)

View File

@ -19,7 +19,6 @@
*/ */
#include "emu.h"
#include "zx8301.h" #include "zx8301.h"
@ -62,6 +61,7 @@ static ADDRESS_MAP_START( zx8301, AS_0, 8, zx8301_device )
AM_RANGE(0x00000, 0x1ffff) AM_RAM AM_RANGE(0x00000, 0x1ffff) AM_RAM
ADDRESS_MAP_END ADDRESS_MAP_END
//------------------------------------------------- //-------------------------------------------------
// memory_space_config - return a description of // memory_space_config - return a description of
// any address spaces owned by this device // any address spaces owned by this device
@ -73,27 +73,6 @@ const address_space_config *zx8301_device::memory_space_config(address_spacenum
} }
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void zx8301_device::device_config_complete()
{
// inherit a copy of the static data
const zx8301_interface *intf = reinterpret_cast<const zx8301_interface *>(static_config());
if (intf != NULL)
*static_cast<zx8301_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
memset(&out_vsync_cb, 0, sizeof(out_vsync_cb));
}
}
//************************************************************************** //**************************************************************************
// INLINE HELPERS // INLINE HELPERS
@ -133,6 +112,7 @@ zx8301_device::zx8301_device(const machine_config &mconfig, const char *tag, dev
device_memory_interface(mconfig, *this), device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this), device_video_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, NULL, *ADDRESS_MAP_NAME(zx8301)), m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, NULL, *ADDRESS_MAP_NAME(zx8301)),
m_write_vsync(*this),
m_dispoff(1), m_dispoff(1),
m_mode8(0), m_mode8(0),
m_base(0), m_base(0),
@ -150,11 +130,11 @@ zx8301_device::zx8301_device(const machine_config &mconfig, const char *tag, dev
void zx8301_device::device_start() void zx8301_device::device_start()
{ {
// get the CPU // get the CPU
m_cpu = machine().device<cpu_device>(cpu_tag); m_cpu = machine().device<cpu_device>(m_cpu_tag);
assert(m_cpu != NULL); assert(m_cpu != NULL);
// resolve callbacks // resolve callbacks
m_out_vsync_func.resolve(out_vsync_cb, *this); m_write_vsync.resolve_safe();
// allocate timers // allocate timers
m_vsync_timer = timer_alloc(TIMER_VSYNC); m_vsync_timer = timer_alloc(TIMER_VSYNC);
@ -184,7 +164,7 @@ void zx8301_device::device_timer(emu_timer &timer, device_timer_id id, int param
{ {
case TIMER_VSYNC: case TIMER_VSYNC:
//m_vsync = !m_vsync; //m_vsync = !m_vsync;
m_out_vsync_func(m_vsync); m_write_vsync(m_vsync);
break; break;
case TIMER_FLASH: case TIMER_FLASH:

View File

@ -37,12 +37,7 @@
#ifndef __ZX8301__ #ifndef __ZX8301__
#define __ZX8301__ #define __ZX8301__
#include "emu.h"
///*************************************************************************
// MACROS / CONSTANTS
///*************************************************************************
@ -50,12 +45,11 @@
// INTERFACE CONFIGURATION MACROS // INTERFACE CONFIGURATION MACROS
///************************************************************************* ///*************************************************************************
#define MCFG_ZX8301_ADD(_tag, _clock, _config) \ #define MCFG_ZX8301_CPU(_cpu_tag) \
MCFG_DEVICE_ADD(_tag, ZX8301, _clock) \ zx8301_device::static_set_cpu_tag(*device, _cpu_tag);
MCFG_DEVICE_CONFIG(_config)
#define ZX8301_INTERFACE(name) \ #define MCFG_ZX8301_VSYNC_CALLBACK(_write) \
const zx8301_interface(name) = devcb = &zx8301_device::set_vsync_wr_callback(*device, DEVCB2_##_write);
@ -63,28 +57,19 @@
// TYPE DEFINITIONS // TYPE DEFINITIONS
///************************************************************************* ///*************************************************************************
// ======================> zx8301_interface
struct zx8301_interface
{
const char *cpu_tag;
const char *screen_tag;
devcb_write_line out_vsync_cb;
};
// ======================> zx8301_device // ======================> zx8301_device
class zx8301_device : public device_t, class zx8301_device : public device_t,
public device_memory_interface, public device_memory_interface,
public device_video_interface, public device_video_interface
public zx8301_interface
{ {
public: public:
// construction/destruction // construction/destruction
zx8301_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); zx8301_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
template<class _Object> static devcb2_base &set_vsync_wr_callback(device_t &device, _Object object) { return downcast<zx8301_device &>(device).m_write_vsync.set_callback(object); }
static void static_set_cpu_tag(device_t &device, const char *tag) { downcast<zx8301_device &>(device).m_cpu_tag = tag; }
DECLARE_WRITE8_MEMBER( control_w ); DECLARE_WRITE8_MEMBER( control_w );
DECLARE_READ8_MEMBER( data_r ); DECLARE_READ8_MEMBER( data_r );
DECLARE_WRITE8_MEMBER( data_w ); DECLARE_WRITE8_MEMBER( data_w );
@ -95,7 +80,6 @@ protected:
// device-level overrides // device-level overrides
virtual void device_start(); virtual void device_start();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
virtual void device_config_complete();
// device_config_memory_interface overrides // device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
@ -110,11 +94,15 @@ protected:
void draw_line_mode8(bitmap_rgb32 &bitmap, int y, UINT16 da); void draw_line_mode8(bitmap_rgb32 &bitmap, int y, UINT16 da);
private: private:
static const device_timer_id TIMER_VSYNC = 0; enum
static const device_timer_id TIMER_FLASH = 1; {
TIMER_VSYNC,
TIMER_FLASH
};
devcb_resolved_write_line m_out_vsync_func; devcb2_write_line m_write_vsync;
const char *m_cpu_tag;
cpu_device *m_cpu; cpu_device *m_cpu;
//address_space *m_data; //address_space *m_data;