device_func to device callback change (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2012-09-26 14:23:31 +00:00
parent fa40275471
commit f26c931369
3 changed files with 31 additions and 19 deletions

View File

@ -269,6 +269,10 @@ struct tms0980_state
const tms0980_config *config;
address_space *program;
address_space *data;
devcb_resolved_read8 m_read_k;
devcb_resolved_write16 m_write_o;
devcb_resolved_write16 m_write_r;
};
@ -505,6 +509,11 @@ static void cpu_init_tms_common( legacy_cpu_device *device, const UINT32* decode
cpustate->program = &device->space( AS_PROGRAM );
cpustate->data = &device->space( AS_PROGRAM );
cpustate->m_read_k.resolve(cpustate->config->read_k, *device);
cpustate->m_write_o.resolve(cpustate->config->write_o, *device);
cpustate->m_write_r.resolve(cpustate->config->write_r, *device);
device->save_item( NAME(cpustate->prev_pc) );
device->save_item( NAME(cpustate->prev_pa) );
@ -764,9 +773,9 @@ static void tms0980_set_cki_bus( device_t *device )
switch( cpustate->opcode & 0x1F8 )
{
case 0x008:
if ( cpustate->config->read_k )
if ( !cpustate->m_read_k.isnull() )
{
cpustate->cki_bus = cpustate->config->read_k( device, *cpustate->program, 0, 0xff );
cpustate->cki_bus = cpustate->m_read_k( 0, 0xff );
}
else
{
@ -928,17 +937,17 @@ static CPU_EXECUTE( tms0980 )
if ( cpustate->decode & F_SETR )
{
cpustate->r = cpustate->r | ( 1 << cpustate->y );
if ( cpustate->config->write_r )
if ( !cpustate->m_write_r.isnull() )
{
cpustate->config->write_r( device, *cpustate->program, 0, cpustate->r & cpustate->r_mask, 0xffff );
cpustate->m_write_r( 0, cpustate->r & cpustate->r_mask, 0xffff );
}
}
if ( cpustate->decode & F_RSTR )
{
cpustate->r = cpustate->r & ( ~( 1 << cpustate->y ) );
if ( cpustate->config->write_r )
if ( !cpustate->m_write_r.isnull() )
{
cpustate->config->write_r( device, *cpustate->program, 0, cpustate->r & cpustate->r_mask, 0xffff );
cpustate->m_write_r( 0, cpustate->r & cpustate->r_mask, 0xffff );
}
}
if ( cpustate->decode & F_TDO )
@ -955,17 +964,17 @@ static CPU_EXECUTE( tms0980 )
}
}
if ( cpustate->config->write_o )
if ( !cpustate->m_write_o.isnull() )
{
cpustate->config->write_o( device, *cpustate->program, 0, cpustate->o & cpustate->o_mask, 0xffff );
cpustate->m_write_o( 0, cpustate->o & cpustate->o_mask, 0xffff );
}
}
if ( cpustate->decode & F_CLO )
{
cpustate->o = 0;
if ( cpustate->config->write_o )
if ( !cpustate->m_write_o.isnull() )
{
cpustate->config->write_o( device, *cpustate->program, 0, cpustate->o & cpustate->o_mask, 0xffff );
cpustate->m_write_o( 0, cpustate->o & cpustate->o_mask, 0xffff );
}
}
if ( cpustate->decode & F_LDX )

View File

@ -15,9 +15,9 @@ struct tms0980_config {
UINT8 value;
UINT16 output;
} o_pla[20];
read8_device_func read_k;
write16_device_func write_o; /* tms1270 has 10 O-outputs */
write16_device_func write_r;
devcb_read8 read_k;
devcb_write16 write_o; /* tms1270 has 10 O-outputs */
devcb_write16 write_r;
};

View File

@ -11,6 +11,9 @@ public:
stopthie_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) { }
DECLARE_READ8_MEMBER(stopthie_read_k);
DECLARE_WRITE16_MEMBER(stopthie_write_o);
DECLARE_WRITE16_MEMBER(stopthie_write_r);
};
@ -21,7 +24,7 @@ static INPUT_PORTS_START( stopthie )
INPUT_PORTS_END
static READ8_DEVICE_HANDLER( stopthie_read_k )
READ8_MEMBER(stopthie_state::stopthie_read_k)
{
UINT8 data = 0xFF;
@ -32,14 +35,14 @@ static READ8_DEVICE_HANDLER( stopthie_read_k )
}
static WRITE16_DEVICE_HANDLER( stopthie_write_o )
WRITE16_MEMBER(stopthie_state::stopthie_write_o)
{
if (LOG)
logerror( "stopthie_write_o: write %02x\n", data );
}
static WRITE16_DEVICE_HANDLER( stopthie_write_r )
WRITE16_MEMBER(stopthie_state::stopthie_write_r)
{
if (LOG)
logerror( "stopthie_write_r: write %04x\n", data );
@ -56,9 +59,9 @@ static const tms0980_config stopthie_tms0980_config =
{ 0x0d, 0x0d }, { 0x0e, 0x0e }, { 0x0f, 0x0f }, { 0x10, 0x10 },
{ 0x11, 0x11 }, { 0x12, 0x12 }, { 0x13, 0x13 }, { 0x14, 0x14 }
},
stopthie_read_k,
stopthie_write_o,
stopthie_write_r
DEVCB_DRIVER_MEMBER(stopthie_state, stopthie_read_k),
DEVCB_DRIVER_MEMBER16(stopthie_state, stopthie_write_o),
DEVCB_DRIVER_MEMBER16(stopthie_state, stopthie_write_r)
};