bfmdm01_device: converted to devcb2 (nw)

This commit is contained in:
Ivan Vangelista 2014-03-24 18:38:12 +00:00
parent 0e133a4cd0
commit 6b0e6c7a1c
5 changed files with 24 additions and 55 deletions

View File

@ -237,6 +237,7 @@ public:
int m_e2data_to_read; int m_e2data_to_read;
UINT8 m_codec_data[256]; UINT8 m_codec_data[256];
void e2ram_init(nvram_device &nvram, void *data, size_t size); void e2ram_init(nvram_device &nvram, void *data, size_t size);
DECLARE_WRITE_LINE_MEMBER(bfmdm01_busy);
DECLARE_WRITE8_MEMBER(bankswitch_w); DECLARE_WRITE8_MEMBER(bankswitch_w);
DECLARE_WRITE8_MEMBER(reel12_vid_w); DECLARE_WRITE8_MEMBER(reel12_vid_w);
DECLARE_WRITE8_MEMBER(reel12_w); DECLARE_WRITE8_MEMBER(reel12_w);
@ -2605,17 +2606,11 @@ WRITE8_MEMBER(bfm_sc2_state::sc3_expansion_w)
} }
#endif #endif
static void bfmdm01_busy(running_machine &machine, int state) WRITE_LINE_MEMBER(bfm_sc2_state::bfmdm01_busy)
{ {
bfm_sc2_state *drvstate = machine.driver_data<bfm_sc2_state>(); Scorpion2_SetSwitchState(4,4, state?0:1);
drvstate->Scorpion2_SetSwitchState(4,4, state?0:1);
} }
static const bfmdm01_interface dm01_interface =
{
bfmdm01_busy
};
/* machine init (called only once) */ /* machine init (called only once) */
MACHINE_RESET_MEMBER(bfm_sc2_state,awp_init) MACHINE_RESET_MEMBER(bfm_sc2_state,awp_init)
{ {
@ -3772,7 +3767,8 @@ static MACHINE_CONFIG_START( scorpion2_dm01, bfm_sc2_state )
/* video hardware */ /* video hardware */
MCFG_DEFAULT_LAYOUT(layout_sc2_dmd) MCFG_DEFAULT_LAYOUT(layout_sc2_dmd)
MCFG_DM01_ADD("dm01", dm01_interface) MCFG_DEVICE_ADD("dm01", BF_DM01, 0)
MCFG_BF_DM01_BUSY_CB(WRITELINE(bfm_sc2_state, bfmdm01_busy))
MCFG_CPU_ADD("matrix", M6809, 2000000 ) /* matrix board 6809 CPU at 2 Mhz ?? I don't know the exact freq.*/ MCFG_CPU_ADD("matrix", M6809, 2000000 ) /* matrix board 6809 CPU at 2 Mhz ?? I don't know the exact freq.*/
MCFG_CPU_PROGRAM_MAP(bfm_dm01_memmap) MCFG_CPU_PROGRAM_MAP(bfm_dm01_memmap)
MCFG_CPU_PERIODIC_INT_DRIVER(bfm_sc2_state, nmi_line_assert, 1500 ) /* generate 1500 NMI's per second ?? what is the exact freq?? */ MCFG_CPU_PERIODIC_INT_DRIVER(bfm_sc2_state, nmi_line_assert, 1500 ) /* generate 1500 NMI's per second ?? what is the exact freq?? */

View File

@ -698,18 +698,11 @@ WRITE8_MEMBER(sc4_state::m68307_duart_output_w)
} }
/* default dmd */ /* default dmd */
static void bfmdm01_busy(running_machine &machine, int state) WRITE_LINE_MEMBER(sc4_state::bfmdm01_busy)
{ {
// Must tie back to inputs somehow! // Must tie back to inputs somehow!
} }
static const bfmdm01_interface dm01_interface =
{
bfmdm01_busy
};
MACHINE_CONFIG_START( sc4, sc4_state ) MACHINE_CONFIG_START( sc4, sc4_state )
MCFG_CPU_ADD("maincpu", M68307, 16000000) // 68307! (EC000 core) MCFG_CPU_ADD("maincpu", M68307, 16000000) // 68307! (EC000 core)
MCFG_CPU_PROGRAM_MAP(sc4_map) MCFG_CPU_PROGRAM_MAP(sc4_map)
@ -765,7 +758,8 @@ MACHINE_CONFIG_DERIVED_CLASS( sc4dmd, sc4, sc4_state )
/* video hardware */ /* video hardware */
MCFG_DEFAULT_LAYOUT(layout_sc4_dmd) MCFG_DEFAULT_LAYOUT(layout_sc4_dmd)
MCFG_DM01_ADD("dm01", dm01_interface) MCFG_DEVICE_ADD("dm01", BF_DM01, 0)
MCFG_BF_DM01_BUSY_CB(WRITELINE(sc4_state, bfmdm01_busy))
MCFG_CPU_ADD("matrix", M6809, 2000000 ) /* matrix board 6809 CPU at 2 Mhz ?? I don't know the exact freq.*/ MCFG_CPU_ADD("matrix", M6809, 2000000 ) /* matrix board 6809 CPU at 2 Mhz ?? I don't know the exact freq.*/
MCFG_CPU_PROGRAM_MAP(bfm_dm01_memmap) MCFG_CPU_PROGRAM_MAP(bfm_dm01_memmap)
MCFG_CPU_PERIODIC_INT_DRIVER(sc4_state, nmi_line_assert, 1500 ) /* generate 1500 NMI's per second ?? what is the exact freq?? */ MCFG_CPU_PERIODIC_INT_DRIVER(sc4_state, nmi_line_assert, 1500 ) /* generate 1500 NMI's per second ?? what is the exact freq?? */

View File

@ -101,6 +101,8 @@ public:
UINT8 read_input_matrix(running_machine &machine, int row); UINT8 read_input_matrix(running_machine &machine, int row);
DECLARE_WRITE_LINE_MEMBER(bfmdm01_busy);
DECLARE_READ16_MEMBER(sc4_mem_r); DECLARE_READ16_MEMBER(sc4_mem_r);
DECLARE_WRITE16_MEMBER(sc4_mem_w); DECLARE_WRITE16_MEMBER(sc4_mem_w);

View File

@ -59,7 +59,8 @@ bfmdm01_device::bfmdm01_device(const machine_config &mconfig, const char *tag, d
m_control(0), m_control(0),
m_xcounter(0), m_xcounter(0),
m_busy(0), m_busy(0),
m_comdata(0) m_comdata(0),
m_busy_cb(*this)
{ {
for (int i = 0; i < 65; i++) for (int i = 0; i < 65; i++)
m_segbuffer[i] = 0; m_segbuffer[i] = 0;
@ -68,31 +69,14 @@ bfmdm01_device::bfmdm01_device(const machine_config &mconfig, const char *tag, d
m_scanline[i] = 0; m_scanline[i] = 0;
} }
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void bfmdm01_device::device_config_complete()
{
// inherit a copy of the static data
const bfmdm01_interface *intf = reinterpret_cast<const bfmdm01_interface *>(static_config());
if (intf != NULL)
*static_cast<bfmdm01_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
}
}
//------------------------------------------------- //-------------------------------------------------
// device_start - device-specific startup // device_start - device-specific startup
//------------------------------------------------- //-------------------------------------------------
void bfmdm01_device::device_start() void bfmdm01_device::device_start()
{ {
m_busy_cb.resolve_safe();
save_item(NAME(m_data_avail)); save_item(NAME(m_data_avail));
save_item(NAME(m_control)); save_item(NAME(m_control));
save_item(NAME(m_xcounter)); save_item(NAME(m_xcounter));
@ -116,8 +100,8 @@ void bfmdm01_device::device_reset()
m_control = 0; m_control = 0;
m_xcounter = 0; m_xcounter = 0;
m_data_avail = 0; m_data_avail = 0;
m_busy_func(machine(), m_busy); m_busy_cb(m_busy);
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -161,7 +145,7 @@ WRITE8_MEMBER( bfmdm01_device::control_w )
if ( data & 8 ) m_busy = 0; if ( data & 8 ) m_busy = 0;
else m_busy = 1; else m_busy = 1;
m_busy_func(machine(), m_busy); m_busy_cb(m_busy);
} }
} }

View File

@ -8,17 +8,16 @@
#define DM_BYTESPERROW 9 #define DM_BYTESPERROW 9
struct bfmdm01_interface #define MCFG_BF_DM01_BUSY_CB(_devcb) \
{ devcb = &bfmdm01_device::set_busy_callback(*device, DEVCB2_##_devcb);
void (*m_busy_func)(running_machine &machine, int state);
};
class bfmdm01_device : public device_t, class bfmdm01_device : public device_t
public bfmdm01_interface
{ {
public: public:
bfmdm01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); bfmdm01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~bfmdm01_device() {} ~bfmdm01_device() {}
template<class _Object> static devcb2_base &set_busy_callback(device_t &device, _Object object) { return downcast<bfmdm01_device &>(device).m_busy_cb.set_callback(object); }
DECLARE_READ8_MEMBER( control_r ); DECLARE_READ8_MEMBER( control_r );
DECLARE_WRITE8_MEMBER( control_w ); DECLARE_WRITE8_MEMBER( control_w );
@ -32,10 +31,8 @@ public:
void writedata(UINT8 data); void writedata(UINT8 data);
int busy(void); int busy(void);
protected: protected:
// device-level overrides // device-level overrides
virtual void device_config_complete();
virtual void device_start(); virtual void device_start();
virtual void device_reset(); virtual void device_reset();
@ -49,18 +46,14 @@ private:
UINT8 m_scanline[DM_BYTESPERROW]; UINT8 m_scanline[DM_BYTESPERROW];
UINT8 m_comdata; UINT8 m_comdata;
devcb2_write_line m_busy_cb;
int read_data(void); int read_data(void);
}; };
extern const device_type BF_DM01; extern const device_type BF_DM01;
ADDRESS_MAP_EXTERN( bfm_dm01_memmap,8 ); ADDRESS_MAP_EXTERN( bfm_dm01_memmap,8 );
#define MCFG_DM01_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, BF_DM01, 0) \
MCFG_DEVICE_CONFIG(_interface)
#endif #endif