mc6843: devcb2. (nw)

This commit is contained in:
Curt Coder 2014-03-19 07:55:52 +00:00
parent 53973835dc
commit fdc8593fe1
6 changed files with 16 additions and 61 deletions

View File

@ -40,12 +40,6 @@ WRITE_LINE_MEMBER( bml3bus_mp1805_device::bml3_mc6843_intrq_w )
}
}
const mc6843_interface bml3_6843_if =
{
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, bml3bus_mp1805_device, bml3_mc6843_intrq_w)
};
#define MP1805_ROM_REGION "mp1805_rom"
ROM_START( mp1805 )
@ -55,7 +49,8 @@ ROM_START( mp1805 )
ROM_END
MACHINE_CONFIG_FRAGMENT( mp1805 )
MCFG_MC6843_ADD( "mc6843", bml3_6843_if )
MCFG_DEVICE_ADD( "mc6843", MC6843, 0 )
MCFG_MC6843_IRQ_CALLBACK(WRITELINE(bml3bus_mp1805_device, bml3_mc6843_intrq_w))
MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(bml3_mp1805_floppy_interface)
MACHINE_CONFIG_END

View File

@ -74,6 +74,7 @@ const device_type MC6843 = &device_creator<mc6843_device>;
mc6843_device::mc6843_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MC6843, "Motorola MC6843 floppy controller", tag, owner, clock, "mc6843", __FILE__),
m_write_irq(*this),
m_CTAR(0),
m_CMR(0),
m_ISR(0),
@ -98,33 +99,15 @@ mc6843_device::mc6843_device(const machine_config &mconfig, const char *tag, dev
}
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void mc6843_device::device_config_complete()
{
// inherit a copy of the static data
const mc6843_interface *intf = reinterpret_cast<const mc6843_interface *>(static_config());
if (intf != NULL)
*static_cast<mc6843_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
memset(&m_irq_cb, 0, sizeof(m_irq_cb));
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void mc6843_device::device_start()
{
m_timer_cont = timer_alloc(TIMER_CONT) ;
m_write_irq.resolve_safe();
m_timer_cont = timer_alloc(TIMER_CONT);
save_item(NAME(m_CTAR));
save_item(NAME(m_CMR));
@ -162,8 +145,6 @@ void mc6843_device::device_reset()
floppy_drive_set_rpm( img, 300. );
}
m_irq_func.resolve(m_irq_cb, *this);
/* reset registers */
m_CMR &= 0xf0; /* zero only command */
m_ISR = 0;
@ -248,11 +229,8 @@ void mc6843_device::status_update( )
irq = 1;
}
if ( !m_irq_func.isnull() )
{
m_irq_func( irq );
LOG(( "status_update: irq=%i (CMR=%02X, ISR=%02X)\n", irq, m_CMR, m_ISR ));
}
m_write_irq( irq );
LOG(( "status_update: irq=%i (CMR=%02X, ISR=%02X)\n", irq, m_CMR, m_ISR ));
}

View File

@ -11,19 +11,17 @@
#include "imagedev/flopdrv.h"
#define MCFG_MC6843_IRQ_CALLBACK(_write) \
devcb = &mc6843_device::set_irq_wr_callback(*device, DEVCB2_##_write);
struct mc6843_interface
{
devcb_write_line m_irq_cb;
};
class mc6843_device : public device_t,
public mc6843_interface
class mc6843_device : public device_t
{
public:
mc6843_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~mc6843_device() {}
template<class _Object> static devcb2_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast<mc6843_device &>(device).m_write_irq.set_callback(object); }
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
@ -33,7 +31,6 @@ public:
protected:
// device-level overrides
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);
@ -44,7 +41,7 @@ private:
TIMER_CONT
};
devcb_resolved_write_line m_irq_func;
devcb2_write_line m_write_irq;
/* registers */
UINT8 m_CTAR; /* current track */
@ -86,13 +83,4 @@ private:
extern const device_type MC6843;
#define MCFG_MC6843_ADD(_tag, _intrf) \
MCFG_DEVICE_ADD(_tag, MC6843, 0) \
MCFG_DEVICE_CONFIG(_intrf)
#define MCFG_MC6843_REMOVE(_tag) \
MCFG_DEVICE_REMOVE(_tag)
#endif

View File

@ -699,8 +699,8 @@ static MACHINE_CONFIG_START( to7, thomson_state )
MCFG_MEA8000_ADD( "mea8000", to7_speech )
/* floppy */
MCFG_MC6843_ADD( "mc6843", to7_6843_itf )
MCFG_WD2793_ADD( "wd2793", default_wd17xx_interface )
MCFG_DEVICE_ADD("mc6843", MC6843, 0)
MCFG_WD2793_ADD("wd2793", default_wd17xx_interface )
MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0)
MCFG_DEVICE_CONFIG(thomson_floppy_interface_0)
MCFG_DEVICE_ADD(FLOPPY_1, LEGACY_FLOPPY, 0)

View File

@ -439,11 +439,6 @@ void thomson_state::to7_5p14sd_reset()
}
const mc6843_interface to7_6843_itf = { DEVCB_NULL };
void thomson_state::to7_5p14sd_init()
{
LOG(( "to7_5p14sd_init: CD 90-015 controller\n" ));

View File

@ -14,7 +14,6 @@
#include "machine/mc6843.h"
#include "machine/mc6854.h"
extern const mc6843_interface to7_6843_itf;
extern const mc6854_interface to7_network_iface;
extern UINT8 to7_controller_type; /* set during init */