summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emu/cpu/cosmac/cosmac.c36
-rw-r--r--src/emu/cpu/i8085/i8085.c22
-rw-r--r--src/emu/cpu/i86/i86.c4
-rw-r--r--src/emu/cpu/m6502/m4510.c8
-rw-r--r--src/emu/cpu/m6502/m6502.c8
-rw-r--r--src/emu/cpu/m6800/m6800.c6
-rw-r--r--src/emu/cpu/scmp/scmp.c28
-rw-r--r--src/emu/cpu/superfx/superfx.c6
-rw-r--r--src/emu/cpu/tlcs900/tlcs900.c12
-rwxr-xr-xsrc/emu/cpu/upd7725/upd7725.c26
-rw-r--r--src/emu/devcb.c1038
-rw-r--r--src/emu/devcb.h601
-rw-r--r--src/emu/imagedev/flopdrv.c36
-rw-r--r--src/emu/machine/6522via.c100
-rw-r--r--src/emu/machine/6526cia.c32
-rw-r--r--src/emu/machine/6532riot.c22
-rw-r--r--src/emu/machine/6821pia.c76
-rw-r--r--src/emu/machine/6840ptm.c16
-rw-r--r--src/emu/machine/6850acia.c38
-rw-r--r--src/emu/machine/7474.c8
-rw-r--r--src/emu/machine/8237dma.c46
-rw-r--r--src/emu/machine/8255ppi.c28
-rw-r--r--src/emu/machine/8255ppi.h4
-rw-r--r--src/emu/machine/8257dma.c36
-rw-r--r--src/emu/machine/adc0808.c4
-rw-r--r--src/emu/machine/cdp1852.c20
-rw-r--r--src/emu/machine/cdp1871.c44
-rw-r--r--src/emu/machine/com8116.c12
-rw-r--r--src/emu/machine/i8155.c22
-rw-r--r--src/emu/machine/i8212.c16
-rw-r--r--src/emu/machine/i8214.c12
-rw-r--r--src/emu/machine/i8243.c20
-rw-r--r--src/emu/machine/i8255.c36
-rw-r--r--src/emu/machine/i8355.c12
-rw-r--r--src/emu/machine/ins8154.c30
-rw-r--r--src/emu/machine/mc6852.c14
-rw-r--r--src/emu/machine/mc68901.c42
-rw-r--r--src/emu/machine/mccs1850.c10
-rw-r--r--src/emu/machine/mm74c922.c18
-rw-r--r--src/emu/machine/mos6529.c8
-rw-r--r--src/emu/machine/msm58321.c4
-rw-r--r--src/emu/machine/pic8259.c14
-rw-r--r--src/emu/machine/pit8253.c16
-rw-r--r--src/emu/machine/rp5c01.c4
-rw-r--r--src/emu/machine/rp5c15.c8
-rw-r--r--src/emu/machine/upd1990a.c14
-rw-r--r--src/emu/machine/upd7201.c2
-rw-r--r--src/emu/machine/z80ctc.c10
-rw-r--r--src/emu/machine/z80dart.c24
-rw-r--r--src/emu/machine/z80dma.c34
-rw-r--r--src/emu/machine/z80pio.c30
-rw-r--r--src/emu/machine/z80sti.c32
-rw-r--r--src/emu/machine/z8536.c26
-rw-r--r--src/emu/sound/ay8910.c28
-rw-r--r--src/emu/sound/cdp1864.c48
-rw-r--r--src/emu/sound/cdp1869.c10
-rw-r--r--src/emu/sound/pokey.c24
-rw-r--r--src/emu/sound/sp0256.c16
-rw-r--r--src/emu/sound/tms5110.c38
-rw-r--r--src/emu/sound/tms5220.c12
-rw-r--r--src/emu/sound/ymf271.c10
-rw-r--r--src/emu/sound/ymz280b.c10
-rw-r--r--src/emu/video/cdp1861.c32
-rw-r--r--src/emu/video/cdp1862.c12
-rw-r--r--src/emu/video/crt9007.c58
-rw-r--r--src/emu/video/crt9021.c6
-rw-r--r--src/emu/video/crt9212.c20
-rw-r--r--src/emu/video/dm9368.c10
-rw-r--r--src/emu/video/hd61830.c4
-rw-r--r--src/emu/video/mc6845.c36
-rw-r--r--src/emu/video/upd3301.c16
-rw-r--r--src/mame/audio/namco52.c10
-rw-r--r--src/mame/machine/gaelco3d.c6
-rw-r--r--src/mame/machine/namco51.c16
-rw-r--r--src/mame/machine/namco53.c18
-rw-r--r--src/mame/machine/namco62.c12
-rw-r--r--src/mame/machine/namcoio.c16
-rw-r--r--src/mame/machine/taitoio.c60
78 files changed, 1811 insertions, 1492 deletions
diff --git a/src/emu/cpu/cosmac/cosmac.c b/src/emu/cpu/cosmac/cosmac.c
index cc20ab3e138..98cdba3f9f5 100644
--- a/src/emu/cpu/cosmac/cosmac.c
+++ b/src/emu/cpu/cosmac/cosmac.c
@@ -266,18 +266,18 @@ void cosmac_device::device_start()
state_add(COSMAC_Q, "Q", m_q).mask(0x1).noshow();
// resolve callbacks
- devcb_resolve_read_line(&m_in_wait_func, &m_in_wait_cb, this);
- devcb_resolve_read_line(&m_in_clear_func, &m_in_clear_cb, this);
- devcb_resolve_read_line(&m_in_ef_func[0], &m_in_ef1_cb, this);
- devcb_resolve_read_line(&m_in_ef_func[1], &m_in_ef2_cb, this);
- devcb_resolve_read_line(&m_in_ef_func[2], &m_in_ef3_cb, this);
- devcb_resolve_read_line(&m_in_ef_func[3], &m_in_ef4_cb, this);
- devcb_resolve_write_line(&m_out_q_func, &m_out_q_cb, this);
- devcb_resolve_read8(&m_in_dma_func, &m_in_dma_cb, this);
- devcb_resolve_write8(&m_out_dma_func, &m_out_dma_cb, this);
+ m_in_wait_func.resolve(m_in_wait_cb, *this);
+ m_in_clear_func.resolve(m_in_clear_cb, *this);
+ m_in_ef_func[0].resolve(m_in_ef1_cb, *this);
+ m_in_ef_func[1].resolve(m_in_ef2_cb, *this);
+ m_in_ef_func[2].resolve(m_in_ef3_cb, *this);
+ m_in_ef_func[3].resolve(m_in_ef4_cb, *this);
+ m_out_q_func.resolve(m_out_q_cb, *this);
+ m_in_dma_func.resolve(m_in_dma_cb, *this);
+ m_out_dma_func.resolve(m_out_dma_cb, *this);
m_out_sc_func = m_out_sc_cb;
- devcb_resolve_write_line(&m_out_tpa_func, &m_out_tpa_cb, this);
- devcb_resolve_write_line(&m_out_tpb_func, &m_out_tpb_cb, this);
+ m_out_tpa_func.resolve(m_out_tpa_cb, *this);
+ m_out_tpb_func.resolve(m_out_tpb_cb, *this);
// register our state for saving
save_item(NAME(m_op));
@@ -698,8 +698,8 @@ inline void cosmac_device::debug()
inline void cosmac_device::sample_wait_clear()
{
- int wait = devcb_call_read_line(&m_in_wait_func);
- int clear = devcb_call_read_line(&m_in_clear_func);
+ int wait = m_in_wait_func();
+ int clear = m_in_clear_func();
m_pmode = m_mode;
m_mode = (cosmac_mode) ((clear << 1) | wait);
@@ -714,9 +714,9 @@ inline void cosmac_device::sample_ef_lines()
{
for (int i = 0; i < 4; i++)
{
- if (m_in_ef_func[i].target != NULL)
+ if (!m_in_ef_func[i].isnull())
{
- EF[i] = devcb_call_read_line(&m_in_ef_func[i]);
+ EF[i] = m_in_ef_func[i]();
}
}
}
@@ -743,7 +743,7 @@ inline void cosmac_device::set_q_flag(int state)
{
Q = state;
- devcb_call_write_line(&m_out_q_func, Q);
+ m_out_q_func(Q);
}
@@ -846,7 +846,7 @@ inline void cosmac_device::execute_instruction()
inline void cosmac_device::dma_input()
{
- RAM_W(R[0], devcb_call_read8(&m_in_dma_func, R[0]));
+ RAM_W(R[0], m_in_dma_func(R[0]));
R[0]++;
@@ -881,7 +881,7 @@ inline void cosmac_device::dma_input()
inline void cosmac_device::dma_output()
{
- devcb_call_write8(&m_out_dma_func, R[0], RAM_R(R[0]));
+ m_out_dma_func(R[0], RAM_R(R[0]));
R[0]++;
diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c
index 9df34b216e0..45ea628527d 100644
--- a/src/emu/cpu/i8085/i8085.c
+++ b/src/emu/cpu/i8085/i8085.c
@@ -287,12 +287,12 @@ INLINE void set_sod(i8085_state *cpustate, int state)
if (state != 0 && cpustate->sod_state == 0)
{
cpustate->sod_state = 1;
- devcb_call_write_line(&cpustate->out_sod_func, cpustate->sod_state);
+ cpustate->out_sod_func(cpustate->sod_state);
}
else if (state == 0 && cpustate->sod_state != 0)
{
cpustate->sod_state = 0;
- devcb_call_write_line(&cpustate->out_sod_func, cpustate->sod_state);
+ cpustate->out_sod_func(cpustate->sod_state);
}
}
@@ -302,12 +302,12 @@ INLINE void set_inte(i8085_state *cpustate, int state)
if (state != 0 && (cpustate->IM & IM_IE) == 0)
{
cpustate->IM |= IM_IE;
- devcb_call_write_line(&cpustate->out_inte_func, 1);
+ cpustate->out_inte_func(1);
}
else if (state == 0 && (cpustate->IM & IM_IE) != 0)
{
cpustate->IM &= ~IM_IE;
- devcb_call_write_line(&cpustate->out_inte_func, 0);
+ cpustate->out_inte_func(0);
}
}
@@ -315,7 +315,7 @@ INLINE void set_inte(i8085_state *cpustate, int state)
INLINE void set_status(i8085_state *cpustate, UINT8 status)
{
if (status != cpustate->STATUS)
- devcb_call_write8(&cpustate->out_status_func, 0, status);
+ cpustate->out_status_func(0, status);
cpustate->STATUS = status;
}
@@ -324,7 +324,7 @@ INLINE void set_status(i8085_state *cpustate, UINT8 status)
INLINE UINT8 get_rim_value(i8085_state *cpustate)
{
UINT8 result = cpustate->IM;
- int sid = devcb_call_read_line(&cpustate->in_sid_func);
+ int sid = cpustate->in_sid_func();
/* copy live RST5.5 and RST6.5 states */
result &= ~(IM_I65 | IM_I55);
@@ -1012,10 +1012,10 @@ static void init_808x_common(legacy_cpu_device *device, device_irq_callback irqc
cpustate->io = device->space(AS_IO);
/* resolve callbacks */
- devcb_resolve_write8(&cpustate->out_status_func, &cpustate->config.out_status_func, device);
- devcb_resolve_write_line(&cpustate->out_inte_func, &cpustate->config.out_inte_func, device);
- devcb_resolve_read_line(&cpustate->in_sid_func, &cpustate->config.in_sid_func, device);
- devcb_resolve_write_line(&cpustate->out_sod_func, &cpustate->config.out_sod_func, device);
+ cpustate->out_status_func.resolve(cpustate->config.out_status_func, *device);
+ cpustate->out_inte_func.resolve(cpustate->config.out_inte_func, *device);
+ cpustate->in_sid_func.resolve(cpustate->config.in_sid_func, *device);
+ cpustate->out_sod_func.resolve(cpustate->config.out_sod_func, *device);
/* register for state saving */
device->save_item(NAME(cpustate->PC.w.l));
@@ -1107,7 +1107,7 @@ static CPU_EXPORT_STATE( i808x )
{
case I8085_SID:
{
- int sid = devcb_call_read_line(&cpustate->in_sid_func);
+ int sid = cpustate->in_sid_func();
cpustate->ietemp = ((cpustate->IM & IM_SID) != 0);
cpustate->ietemp = (sid != 0);
diff --git a/src/emu/cpu/i86/i86.c b/src/emu/cpu/i86/i86.c
index 39f28eaf0eb..e83b0d80675 100644
--- a/src/emu/cpu/i86/i86.c
+++ b/src/emu/cpu/i86/i86.c
@@ -224,8 +224,8 @@ static CPU_INIT( i80186 )
if (intf != NULL)
{
- devcb_resolve_write_line(&cpustate->out_tmrout0_func, &intf->out_tmrout0_func, device);
- devcb_resolve_write_line(&cpustate->out_tmrout1_func, &intf->out_tmrout1_func, device);
+ cpustate->out_tmrout0_func.resolve(intf->out_tmrout0_func, *device);
+ cpustate->out_tmrout1_func.resolve(intf->out_tmrout1_func, *device);
}
}
diff --git a/src/emu/cpu/m6502/m4510.c b/src/emu/cpu/m6502/m4510.c
index 907ecfe3ad9..c52789702a6 100644
--- a/src/emu/cpu/m6502/m4510.c
+++ b/src/emu/cpu/m6502/m4510.c
@@ -216,8 +216,8 @@ static CPU_INIT( m4510 )
if ( intf->write_indexed_func )
cpustate->wrmem_id = intf->write_indexed_func;
- devcb_resolve_read8(&cpustate->in_port_func, &intf->in_port_func, device);
- devcb_resolve_write8(&cpustate->out_port_func, &intf->out_port_func, device);
+ cpustate->in_port_func.resolve(intf->in_port_func, *device);
+ cpustate->out_port_func.resolve(intf->out_port_func, *device);
}
}
@@ -362,7 +362,7 @@ static READ8_HANDLER( m4510_read_0000 )
result = cpustate->ddr;
break;
case 0x0001: /* Data Port */
- result = devcb_call_read8(&cpustate->in_port_func, 0);
+ result = cpustate->in_port_func(0);
result = (cpustate->ddr & cpustate->port) | (~cpustate->ddr & result);
break;
}
@@ -383,7 +383,7 @@ static WRITE8_HANDLER( m4510_write_0000 )
break;
}
- devcb_call_write8(&cpustate->out_port_func, 0, m4510_get_port(downcast<legacy_cpu_device *>(&space->device())));
+ cpustate->out_port_func(0, m4510_get_port(downcast<legacy_cpu_device *>(&space->device())));
}
static ADDRESS_MAP_START(m4510_mem, AS_PROGRAM, 8)
diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c
index f52307c2c64..bba56d15c26 100644
--- a/src/emu/cpu/m6502/m6502.c
+++ b/src/emu/cpu/m6502/m6502.c
@@ -152,8 +152,8 @@ static void m6502_common_init(legacy_cpu_device *device, device_irq_callback irq
if ( intf->write_indexed_func )
cpustate->wrmem_id = intf->write_indexed_func;
- devcb_resolve_read8(&cpustate->in_port_func, &intf->in_port_func, device);
- devcb_resolve_write8(&cpustate->out_port_func, &intf->out_port_func, device);
+ cpustate->in_port_func.resolve(intf->in_port_func, *device);
+ cpustate->out_port_func.resolve(intf->out_port_func, *device);
}
device->save_item(NAME(cpustate->pc.w.l));
@@ -370,7 +370,7 @@ static READ8_HANDLER( m6510_read_0000 )
result = cpustate->ddr;
break;
case 0x0001: /* Data Port */
- result = devcb_call_read8(&cpustate->in_port_func, cpustate->ddr);
+ result = cpustate->in_port_func(cpustate->ddr);
result = (cpustate->ddr & cpustate->port) | (~cpustate->ddr & result);
break;
}
@@ -391,7 +391,7 @@ static WRITE8_HANDLER( m6510_write_0000 )
break;
}
- devcb_call_write8(&cpustate->out_port_func, cpustate->ddr, cpustate->port & cpustate->ddr);
+ cpustate->out_port_func(cpustate->ddr, cpustate->port & cpustate->ddr);
}
static ADDRESS_MAP_START(m6510_mem, AS_PROGRAM, 8)
diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c
index 8770fe73a0c..4c9478a90d4 100644
--- a/src/emu/cpu/m6800/m6800.c
+++ b/src/emu/cpu/m6800/m6800.c
@@ -1212,7 +1212,7 @@ static CPU_INIT( m6801 )
{
m6801_interface *intf = (m6801_interface *) device->static_config();
- devcb_resolve_write_line(&cpustate->out_sc2_func, &intf->out_sc2_func, device);
+ cpustate->out_sc2_func.resolve(intf->out_sc2_func, *device);
}
}
@@ -1262,7 +1262,7 @@ static CPU_INIT( m6803 )
{
m6801_interface *intf = (m6801_interface *) device->static_config();
- devcb_resolve_write_line(&cpustate->out_sc2_func, &intf->out_sc2_func, device);
+ cpustate->out_sc2_func.resolve(intf->out_sc2_func, *device);
}
}
@@ -1379,7 +1379,7 @@ INLINE void set_os3(m6800_state *cpustate, int state)
{
//logerror("M6801 '%s' OS3: %u\n", cpustate->device->tag(), state);
- devcb_call_write_line(&cpustate->out_sc2_func, state);
+ cpustate->out_sc2_func(state);
}
READ8_HANDLER( m6801_io_r )
diff --git a/src/emu/cpu/scmp/scmp.c b/src/emu/cpu/scmp/scmp.c
index bf67f516a51..b572c91a303 100644
--- a/src/emu/cpu/scmp/scmp.c
+++ b/src/emu/cpu/scmp/scmp.c
@@ -386,9 +386,9 @@ static void execute_one(scmp_state *cpustate, int opcode)
// Shift, Rotate, Serial I/O Instructions
case 0x19: // SIO
cpustate->icount -= 5;
- devcb_call_write_line(&cpustate->sout_func, cpustate->ER & 0x01);
+ cpustate->sout_func(cpustate->ER & 0x01);
cpustate->ER >>= 1;
- cpustate->ER |= devcb_call_read_line(&cpustate->sin_func) ? 0x80 : 0x00;
+ cpustate->ER |= cpustate->sin_func() ? 0x80 : 0x00;
break;
case 0x1c: // SR
cpustate->icount -= 5;
@@ -412,8 +412,8 @@ static void execute_one(scmp_state *cpustate, int opcode)
// Single Byte Miscellaneous Instructions
case 0x00: // HALT
cpustate->icount -= 8;
- devcb_call_write_line(&cpustate->halt_func, 1);
- devcb_call_write_line(&cpustate->halt_func, 0);
+ cpustate->halt_func(1);
+ cpustate->halt_func(0);
break;
case 0x02: // CCL
cpustate->icount -= 5;
@@ -434,14 +434,14 @@ static void execute_one(scmp_state *cpustate, int opcode)
case 0x06: // CSA
cpustate->icount -= 5;
cpustate->SR &= 0xcf; // clear SA and SB flags
- cpustate->SR |= devcb_call_read_line(&cpustate->sensea_func) ? 0x10 : 0x00;
- cpustate->SR |= devcb_call_read_line(&cpustate->senseb_func) ? 0x20 : 0x00;
+ cpustate->SR |= cpustate->sensea_func() ? 0x10 : 0x00;
+ cpustate->SR |= cpustate->senseb_func() ? 0x20 : 0x00;
cpustate->AC = cpustate->SR;
break;
case 0x07: // CAS
cpustate->icount -= 6;
cpustate->SR = cpustate->AC;
- devcb_call_write8(&cpustate->flag_out_func, 0, cpustate->SR & 0x07);
+ cpustate->flag_out_func(0, cpustate->SR & 0x07);
break;
case 0x08: // NOP
cpustate->icount -= 5;
@@ -477,7 +477,7 @@ static CPU_EXECUTE( scmp )
do
{
- if ((cpustate->SR & 0x08) && (devcb_call_read_line(&cpustate->sensea_func))) {
+ if ((cpustate->SR & 0x08) && (cpustate->sensea_func())) {
take_interrupt(cpustate);
}
debugger_instruction_hook(device, cpustate->PC.d);
@@ -518,12 +518,12 @@ static CPU_INIT( scmp )
cpustate->direct = &cpustate->program->direct();
/* resolve callbacks */
- devcb_resolve_write8(&cpustate->flag_out_func, &cpustate->config.flag_out_func, device);
- devcb_resolve_write_line(&cpustate->sout_func, &cpustate->config.sout_func, device);
- devcb_resolve_read_line(&cpustate->sin_func, &cpustate->config.sin_func, device);
- devcb_resolve_read_line(&cpustate->sensea_func, &cpustate->config.sensea_func, device);
- devcb_resolve_read_line(&cpustate->senseb_func, &cpustate->config.senseb_func, device);
- devcb_resolve_write_line(&cpustate->halt_func, &cpustate->config.halt_func, device);
+ cpustate->flag_out_func.resolve(cpustate->config.flag_out_func, *device);
+ cpustate->sout_func.resolve(cpustate->config.sout_func, *device);
+ cpustate->sin_func.resolve(cpustate->config.sin_func, *device);
+ cpustate->sensea_func.resolve(cpustate->config.sensea_func, *device);
+ cpustate->senseb_func.resolve(cpustate->config.senseb_func, *device);
+ cpustate->halt_func.resolve(cpustate->config.halt_func, *device);
device->save_item(NAME(cpustate->PC));
device->save_item(NAME(cpustate->P1));
diff --git a/src/emu/cpu/superfx/superfx.c b/src/emu/cpu/superfx/superfx.c
index fa7a4404d7e..7315c1d69c2 100644
--- a/src/emu/cpu/superfx/superfx.c
+++ b/src/emu/cpu/superfx/superfx.c
@@ -518,7 +518,7 @@ UINT8 superfx_mmio_read(device_t *cpu, UINT32 addr)
UINT8 r = cpustate->sfr >> 8;
cpustate->sfr &= ~SUPERFX_SFR_IRQ;
cpustate->irq = 0;
- devcb_call_write_line(&cpustate->out_irq_func, cpustate->irq);
+ cpustate->out_irq_func(cpustate->irq);
return r;
}
@@ -759,7 +759,7 @@ static CPU_INIT( superfx )
cpustate->config = *(superfx_config *)device->static_config();
}
- devcb_resolve_write_line(&cpustate->out_irq_func, &cpustate->config.out_irq_func, device);
+ cpustate->out_irq_func.resolve(cpustate->config.out_irq_func, *device);
superfx_register_save(device);
}
@@ -837,7 +837,7 @@ static CPU_EXECUTE( superfx )
{
cpustate->sfr |= SUPERFX_SFR_IRQ;
cpustate->irq = 1;
- devcb_call_write_line(&cpustate->out_irq_func, cpustate->irq ? ASSERT_LINE : CLEAR_LINE );
+ cpustate->out_irq_func(cpustate->irq ? ASSERT_LINE : CLEAR_LINE );
}
cpustate->sfr &= ~SUPERFX_SFR_G;
cpustate->pipeline = 0x01;
diff --git a/src/emu/cpu/tlcs900/tlcs900.c b/src/emu/cpu/tlcs900/tlcs900.c
index b505c74bb3b..f43955c40c1 100644
--- a/src/emu/cpu/tlcs900/tlcs900.c
+++ b/src/emu/cpu/tlcs900/tlcs900.c
@@ -222,8 +222,8 @@ static CPU_INIT( tlcs900 )
cpustate->device = device;
cpustate->program = device->space( AS_PROGRAM );
- devcb_resolve_write8( &cpustate->to1, &cpustate->intf->to1, device );
- devcb_resolve_write8( &cpustate->to3, &cpustate->intf->to3, device );
+ cpustate->to1.resolve(cpustate->intf->to1, *device );
+ cpustate->to3.resolve(cpustate->intf->to3, *device );
device->save_item( NAME(cpustate->xwa) );
device->save_item( NAME(cpustate->xbc) );
@@ -661,8 +661,8 @@ INLINE void tlcs900_change_tff( tlcs900_state *cpustate, int which, int change )
cpustate->tff1 ^= 1;
break;
}
- if ( cpustate->to1.write != NULL )
- devcb_call_write8( &cpustate->to1, 0, cpustate->tff1 );
+ if ( !cpustate->to1.isnull() )
+ cpustate->to1(0, cpustate->tff1 );
break;
case 3:
@@ -678,8 +678,8 @@ INLINE void tlcs900_change_tff( tlcs900_state *cpustate, int which, int change )
cpustate->tff3 ^= 1;
break;
}
- if ( cpustate->to3.write != NULL )
- devcb_call_write8( &cpustate->to3, 0, cpustate->tff3 );
+ if ( !cpustate->to3.isnull() )
+ cpustate->to3(0, cpustate->tff3 );
break;
}
}
diff --git a/src/emu/cpu/upd7725/upd7725.c b/src/emu/cpu/upd7725/upd7725.c
index 205e89bf712..c4a7326506e 100755
--- a/src/emu/cpu/upd7725/upd7725.c
+++ b/src/emu/cpu/upd7725/upd7725.c
@@ -105,17 +105,17 @@ void necdsp_device::device_start()
state_add(UPD7725_IDB, "IDB", regs.idb);
// resolve callbacks
- devcb_resolve_read_line(&m_in_int_func, &m_in_int_cb, this);
- //devcb_resolve_read8(&m_in_si_func, &m_in_si_cb, this);
- //devcb_resolve_read_line(&m_in_sck_func, &m_in_sck_cb, this);
- //devcb_resolve_read_line(&m_in_sien_func, &m_in_sien_cb, this);
- //devcb_resolve_read_line(&m_in_soen_func, &m_in_soen_cb, this);
- //devcb_resolve_read_line(&m_in_dack_func, &m_in_dack_cb, this);
- devcb_resolve_write_line(&m_out_p0_func, &m_out_p0_cb, this);
- devcb_resolve_write_line(&m_out_p1_func, &m_out_p1_cb, this);
- //devcb_resolve_write8(&m_out_so_func, &m_out_so_cb, this);
- //devcb_resolve_write_line(&m_out_sorq_func, &m_out_sorq_cb, this);
- //devcb_resolve_write_line(&m_out_drq_func, &m_out_drq_cb, this);
+ m_in_int_func.resolve(m_in_int_cb, *this);
+ //m_in_si_func.resolve(m_in_si_cb, *this);
+ //m_in_sck_func.resolve(m_in_sck_cb, *this);
+ //m_in_sien_func.resolve(m_in_sien_cb, *this);
+ //m_in_soen_func.resolve(m_in_soen_cb, *this);
+ //m_in_dack_func.resolve(m_in_dack_cb, *this);
+ m_out_p0_func.resolve(m_out_p0_cb, *this);
+ m_out_p1_func.resolve(m_out_p1_cb, *this);
+ //m_out_so_func.resolve(m_out_so_cb, *this);
+ //m_out_sorq_func.resolve(m_out_sorq_cb, *this);
+ //m_out_drq_func.resolve(m_out_drq_cb, *this);
// save state registrations
save_item(NAME(regs.pc));
@@ -563,8 +563,8 @@ void necdsp_device::exec_ld(UINT32 opcode) {
case 5: regs.rp = id; break;
case 6: regs.dr = id; regs.sr.rqm = 1; break;
case 7: regs.sr = (regs.sr & 0x907c) | (id & ~0x907c);
- devcb_call_write_line(&m_out_p0_func, regs.sr&0x1);
- devcb_call_write_line(&m_out_p1_func, (regs.sr&0x2)>>1);
+ m_out_p0_func(regs.sr&0x1);
+ m_out_p1_func((regs.sr&0x2)>>1);
break;
case 8: regs.so = id; break; //LSB
case 9: regs.so = id; break; //MSB
diff --git a/src/emu/devcb.c b/src/emu/devcb.c
index d603156dfff..2b437ca8a10 100644
--- a/src/emu/devcb.c
+++ b/src/emu/devcb.c
@@ -4,519 +4,751 @@
Device callback interface helpers.
- Copyright Nicola Salmoria and the MAME Team.
- Visit http://mamedev.org for licensing and usage restrictions.
+****************************************************************************
+
+ Copyright Aaron Giles
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name 'MAME' nor the names of its contributors may be
+ used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
#include "emu.h"
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
-/***************************************************************************
- STATIC-TO-LIVE CONVERSION
-***************************************************************************/
+// special identifiers used to discover NULL functions
+UINT8 devcb_resolved_read_line::s_null;
+UINT8 devcb_resolved_write_line::s_null;
+UINT8 devcb_resolved_read8::s_null;
+UINT8 devcb_resolved_write8::s_null;
+UINT8 devcb_resolved_read16::s_null;
+UINT8 devcb_resolved_write16::s_null;
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
-/*-------------------------------------------------
- devcb_resolve_read_line - convert a static
- read line definition to a live definition
--------------------------------------------------*/
+// ======================> devcb_resolver
-static READ_LINE_DEVICE_HANDLER( trampoline_read_port_to_read_line )
+class devcb_resolver
{
- return (input_port_read_direct((const input_port_config *)device) & 1) ? ASSERT_LINE : CLEAR_LINE;
+public:
+ static const input_port_config *resolve_port(const char *tag, device_t &current);
+ static device_t *resolve_device(int index, const char *tag, device_t &current);
+ static device_execute_interface *resolve_execute_interface(const char *tag, device_t &current);
+ static address_space *resolve_space(int index, const char *tag, device_t &current);
+};
+
+
+
+//**************************************************************************
+// DEVCB RESOLVER
+//**************************************************************************
+
+//-------------------------------------------------
+// resolve_port - resolve to an input port object
+// based on the provided tag
+//-------------------------------------------------
+
+const input_port_config *devcb_resolver::resolve_port(const char *tag, device_t &current)
+{
+ const input_port_config *result = current.machine().port(tag);
+ if (result == NULL)
+ throw emu_fatalerror("Unable to find input port '%s' (requested by %s '%s')", tag, current.name(), current.tag());
+ return result;
}
-static READ_LINE_DEVICE_HANDLER( trampoline_read8_to_read_line )
+
+//-------------------------------------------------
+// resolve_device - resolve to a device given
+// a tag and special index type
+//-------------------------------------------------
+
+device_t *devcb_resolver::resolve_device(int index, const char *tag, device_t &current)
{
- const devcb_resolved_read_line *resolved = (const devcb_resolved_read_line *)device;
- return ((*resolved->real.readdevice)((device_t *)resolved->realtarget, 0) & 1) ? ASSERT_LINE : CLEAR_LINE;
+ device_t *result = NULL;
+
+ if (index == DEVCB_DEVICE_SELF)
+ result = &current;
+ else if (index == DEVCB_DEVICE_DRIVER)
+ result = current.machine().driver_data();
+ else if (strcmp(tag, DEVICE_SELF_OWNER) == 0)
+ result = current.owner();
+ else
+ result = current.siblingdevice(tag);
+
+ if (result == NULL)
+ throw emu_fatalerror("Unable to resolve device '%s' (requested by callback to %s '%s')", tag, current.name(), current.tag());
+ return result;
}
-void devcb_resolve_read_line(devcb_resolved_read_line *resolved, const devcb_read_line *config, device_t *device)
+
+//-------------------------------------------------
+// resolve_execute_interface - resolve to an
+// execute interface on a device given a device
+// tag
+//-------------------------------------------------
+
+device_execute_interface *devcb_resolver::resolve_execute_interface(const char *tag, device_t &current)
{
- /* reset the resolved structure */
- memset(resolved, 0, sizeof(*resolved));
+ // find our target device
+ device_t *targetdev = current.siblingdevice(tag);
+ if (targetdev == NULL)
+ throw emu_fatalerror("Unable to resolve device '%s' (requested by %s '%s')", tag, current.name(), current.tag());
+
+ // make sure the target device has an execute interface
+ device_execute_interface *exec;
+ if (!targetdev->interface(exec))
+ throw emu_fatalerror("Device '%s' (requested by %s '%s') has no execute interface", tag, current.name(), current.tag());
+
+ return exec;
+}
- /* input port handlers */
- if (config->type == DEVCB_TYPE_INPUT)
- {
- resolved->target = device->machine().port(config->tag);
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_read_line: unable to find input port '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- resolved->read = trampoline_read_port_to_read_line;
- }
- /* address space handlers */
- else if (config->type >= DEVCB_TYPE_MEMORY(AS_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->readspace != NULL)
- {
- FPTR spacenum = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(AS_PROGRAM);
-
- device_t *targetdev = device->siblingdevice(config->tag);
- if (targetdev == NULL)
- fatalerror("devcb_resolve_read_line: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- device_memory_interface *memory;
- if (!targetdev->interface(memory))
- fatalerror("devcb_resolve_read_line: device '%s' (requested by %s '%s') has no memory", config->tag, device->name(), device->tag());
-
- resolved->target = resolved;
- resolved->read = trampoline_read8_to_read_line;
- resolved->realtarget = targetdev->memory().space(spacenum);
- if (resolved->realtarget == NULL)
- fatalerror("devcb_resolve_read_line: unable to find device '%s' space %d (requested by %s '%s')", config->tag, (int)spacenum, device->name(), device->tag());
- resolved->real.readspace = config->readspace;
- }
+//-------------------------------------------------
+// resolve_space - resolve to an address space
+// given a device tag and a space index
+//-------------------------------------------------
+
+address_space *devcb_resolver::resolve_space(int index, const char *tag, device_t &current)
+{
+ // find our target device
+ device_t *targetdev = current.siblingdevice(tag);
+ if (targetdev == NULL)
+ throw emu_fatalerror("Unable to resolve device '%s' (requested by %s '%s')", tag, current.name(), current.tag());
+
+ // make sure the target device has a memory interface
+ device_memory_interface *memory;
+ if (!targetdev->interface(memory))
+ throw emu_fatalerror("Device '%s' (requested by %s '%s') has no memory interface", tag, current.name(), current.tag());
+
+ // set the real target and function, then prime a delegate
+ address_space *result = memory->space(index);
+ if (result == NULL)
+ throw emu_fatalerror("Unable to find device '%s' space %d (requested by %s '%s')", tag, index, current.name(), current.tag());
+
+ return result;
+}
+
+
+
+//**************************************************************************
+// DEVCB RESOLVED READ LINE
+//**************************************************************************
+
+//-------------------------------------------------
+// devcb_resolved_read_line - empty constructor
+//-------------------------------------------------
+
+devcb_resolved_read_line::devcb_resolved_read_line()
+{
+ m_object.port = NULL;
+ m_helper.read_line = NULL;
+}
+
- /* device handlers */
- else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF || config->type == DEVCB_TYPE_DRIVER) && (config->readline != NULL || config->readdevice != NULL))
+//-------------------------------------------------
+// resolve - resolve to a delegate from a static
+// structure definition
+//-------------------------------------------------
+
+void devcb_resolved_read_line::resolve(const devcb_read_line &desc, device_t &device)
+{
+ switch (desc.type)
{
- /* locate the device */
- if (config->type == DEVCB_TYPE_SELF)
- resolved->target = device;
- else if (config->type == DEVCB_TYPE_DRIVER)
- resolved->target = device->machine().driver_data();
- else
- if (strcmp(config->tag, DEVICE_SELF_OWNER) == 0)
- resolved->target = device->owner();
+ default:
+ case DEVCB_TYPE_NULL:
+ m_object.constant = 0;
+ m_helper.null_indicator = &s_null;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read_line::from_constant, "(null)", this);
+ break;
+
+ case DEVCB_TYPE_IOPORT:
+ m_object.port = devcb_resolver::resolve_port(desc.tag, device);
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read_line::from_port, desc.tag, this);
+ break;
+
+ case DEVCB_TYPE_DEVICE:
+ m_object.device = devcb_resolver::resolve_device(desc.index, desc.tag, device);
+ if (desc.readline != NULL)
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(desc.readline, NULL, m_object.device);
else
- resolved->target = device->siblingdevice(config->tag);
-
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_read_line: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
-
- /* read_line to read_line is direct */
- if (config->readline != NULL)
- resolved->read = config->readline;
-
- /* read_line to handler goes through a trampoline */
- else
- {
- resolved->realtarget = resolved->target;
- resolved->real.readdevice = config->readdevice;
- resolved->target = resolved;
- resolved->read = trampoline_read8_to_read_line;
- }
+ {
+ m_helper.read8_device = desc.readdevice;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read_line::from_read8, NULL, this);
+ }
+ break;
+
+ case DEVCB_TYPE_LEGACY_SPACE:
+ m_object.space = devcb_resolver::resolve_space(desc.index, desc.tag, device);
+ m_helper.read8_space = desc.readspace;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read_line::from_read8, NULL, this);
+ break;
+
+ case DEVCB_TYPE_CONSTANT:
+ m_object.constant = desc.index;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(FUNC(devcb_resolved_read_line::from_constant), this);
+ break;
}
}
-/*-------------------------------------------------
- devcb_resolve_write_line - convert a static
- write line definition to a live definition
--------------------------------------------------*/
+//-------------------------------------------------
+// from_port - helper to convert from an I/O port
+// value to a line value
+//-------------------------------------------------
-static WRITE_LINE_DEVICE_HANDLER( trampoline_write_port_to_write_line )
+int devcb_resolved_read_line::from_port()
{
- input_port_write_direct((const input_port_config *)device, state, 0xffffffff);
+ return (input_port_read_direct(m_object.port) & 1) ? ASSERT_LINE : CLEAR_LINE;
}
-static WRITE_LINE_DEVICE_HANDLER( trampoline_write8_to_write_line )
+
+//-------------------------------------------------
+// from_read8 - helper to convert from an 8-bit
+// memory read value to a line value
+//-------------------------------------------------
+
+int devcb_resolved_read_line::from_read8()
{
- const devcb_resolved_write_line *resolved = (const devcb_resolved_write_line *)device;
- (*resolved->real.writedevice)((device_t *)resolved->realtarget, 0, state);
+ return ((*m_helper.read8_device)(m_object.device, 0) & 1) ? ASSERT_LINE : CLEAR_LINE;
}
-static WRITE_LINE_DEVICE_HANDLER( trampoline_writecpu_to_write_line )
+
+//-------------------------------------------------
+// from_constant - helper to convert from a
+// constant value to a line value
+//-------------------------------------------------
+
+int devcb_resolved_read_line::from_constant()
{
- const devcb_resolved_write_line *resolved = (const devcb_resolved_write_line *)device;
- device_t *targetdev = (device_t *)resolved->realtarget;
- device_set_input_line(targetdev, resolved->real.writeline, state ? ASSERT_LINE : CLEAR_LINE);
+ return (m_object.constant & 1) ? ASSERT_LINE : CLEAR_LINE;
}
-void devcb_resolve_write_line(devcb_resolved_write_line *resolved, const devcb_write_line *config, device_t *device)
-{
- /* reset the resolved structure */
- memset(resolved, 0, sizeof(*resolved));
- if (config->type == DEVCB_TYPE_INPUT)
- {
- resolved->target = device->machine().port(config->tag);
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_write_line: unable to find input port '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- resolved->write = trampoline_write_port_to_write_line;
- }
- /* address space handlers */
- else if (config->type >= DEVCB_TYPE_MEMORY(AS_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->writespace != NULL)
- {
- FPTR spacenum = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(AS_PROGRAM);
-
- device_t *targetdev = device->siblingdevice(config->tag);
- if (targetdev == NULL)
- fatalerror("devcb_resolve_write_line: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- device_memory_interface *memory;
- if (!targetdev->interface(memory))
- fatalerror("devcb_resolve_write_line: device '%s' (requested by %s '%s') has no memory", config->tag, device->name(), device->tag());
-
- resolved->target = resolved;
- resolved->write = trampoline_write8_to_write_line;
- resolved->realtarget = targetdev->memory().space(spacenum);
- if (resolved->realtarget == NULL)
- fatalerror("devcb_resolve_write_line: unable to find device '%s' space %d (requested by %s '%s')", config->tag, (int)spacenum, device->name(), device->tag());
- resolved->real.writespace = config->writespace;
- }
+//**************************************************************************
+// DEVCB RESOLVED WRITE LINE
+//**************************************************************************
- /* cpu line handlers */
- else if (config->type >= DEVCB_TYPE_CPU_LINE(0) && config->type < DEVCB_TYPE_CPU_LINE(MAX_INPUT_LINES))
- {
- FPTR line = (FPTR)config->type - (FPTR)DEVCB_TYPE_CPU_LINE(0);
+//-------------------------------------------------
+// devcb_resolved_write_line - empty constructor
+//-------------------------------------------------
- device_t *targetdev = device->siblingdevice(config->tag);
- if (targetdev == NULL)
- fatalerror("devcb_resolve_write_line: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
+devcb_resolved_write_line::devcb_resolved_write_line()
+{
+ m_object.port = NULL;
+ m_helper.write_line = NULL;
+}
- resolved->target = resolved;
- resolved->write = trampoline_writecpu_to_write_line;
- resolved->realtarget = targetdev;
- resolved->real.writeline = (int) line;
- }
- /* device handlers */
- else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF || config->type == DEVCB_TYPE_DRIVER) && (config->writeline != NULL || config->writedevice != NULL))
+//-------------------------------------------------
+// resolve - resolve to a delegate from a static
+// structure definition
+//-------------------------------------------------
+
+void devcb_resolved_write_line::resolve(const devcb_write_line &desc, device_t &device)
+{
+ switch (desc.type)
{
- /* locate the device */
- if (config->type == DEVCB_TYPE_SELF)
- resolved->target = device;
- else if (config->type == DEVCB_TYPE_DRIVER)
- resolved->target = device->machine().driver_data();
- else
- if (strcmp(config->tag, DEVICE_SELF_OWNER) == 0)
- resolved->target = device->owner();
+ default:
+ case DEVCB_TYPE_NULL:
+ m_helper.null_indicator = &s_null;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write_line::to_null, "(null)", this);
+ break;
+
+ case DEVCB_TYPE_IOPORT:
+ m_object.port = devcb_resolver::resolve_port(desc.tag, device);
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write_line::to_port, desc.tag, this);
+ break;
+
+ case DEVCB_TYPE_DEVICE:
+ m_object.device = devcb_resolver::resolve_device(desc.index, desc.tag, device);
+ if (desc.writeline != NULL)
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(desc.writeline, "", m_object.device);
else
- resolved->target = device->siblingdevice(config->tag);
-
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_write_line: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
-
- /* write_line to write_line is direct */
- if (config->writeline != NULL)
- resolved->write = config->writeline;
-
- /* write_line to handler goes through a trampoline */
- else
- {
- resolved->realtarget = resolved->target;
- resolved->real.writedevice = config->writedevice;
- resolved->target = resolved;
- resolved->write = trampoline_write8_to_write_line;
- }
+ {
+ m_helper.write8_device = desc.writedevice;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write_line::to_write8, desc.tag, this);
+ }
+ break;
+
+ case DEVCB_TYPE_LEGACY_SPACE:
+ m_object.space = devcb_resolver::resolve_space(desc.index, desc.tag, device);
+ m_helper.write8_space = desc.writespace;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write_line::to_write8, desc.tag, this);
+ break;
+
+ case DEVCB_TYPE_INPUT_LINE:
+ m_object.execute = devcb_resolver::resolve_execute_interface(desc.tag, device);
+ m_helper.input_line = desc.index;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write_line::to_input, desc.tag, this);
+ break;
}
}
-/*-------------------------------------------------
- devcb_resolve_read8 - convert a static
- 8-bit read definition to a live definition
--------------------------------------------------*/
+//-------------------------------------------------
+// to_null - helper to handle a NULL write
+//-------------------------------------------------
-static READ8_DEVICE_HANDLER( trampoline_read_port_to_read8 )
+void devcb_resolved_write_line::to_null(int state)
{
- return input_port_read_direct((const input_port_config *)device);
}
-static READ8_DEVICE_HANDLER( trampoline_read_line_to_read8 )
+
+//-------------------------------------------------
+// to_port - helper to convert to an I/O port
+// value from a line value
+//-------------------------------------------------
+
+void devcb_resolved_write_line::to_port(int state)
{
- const devcb_resolved_read8 *resolved = (const devcb_resolved_read8 *)device;
- return (*resolved->real.readline)((device_t *)resolved->realtarget);
+ input_port_write_direct(m_object.port, state, 0xffffffff);
}
-void devcb_resolve_read8(devcb_resolved_read8 *resolved, const devcb_read8 *config, device_t *device)
+
+//-------------------------------------------------
+// to_write8 - helper to convert to an 8-bit
+// memory read value from a line value
+//-------------------------------------------------
+
+void devcb_resolved_write_line::to_write8(int state)
{
- /* reset the resolved structure */
- memset(resolved, 0, sizeof(*resolved));
+ (*m_helper.write8_device)(m_object.device, 0, state);
+}
- /* input port handlers */
- if (config->type == DEVCB_TYPE_INPUT)
- {
- resolved->target = device->machine().port(config->tag);
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_read8: unable to find input port '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- resolved->read = trampoline_read_port_to_read8;
- }
- /* address space handlers */
- else if (config->type >= DEVCB_TYPE_MEMORY(AS_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->readspace != NULL)
- {
- FPTR spacenum = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(AS_PROGRAM);
-
- device_t *targetdev = device->siblingdevice(config->tag);
- if (targetdev == NULL)
- fatalerror("devcb_resolve_read8: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- device_memory_interface *memory;
- if (!targetdev->interface(memory))
- fatalerror("devcb_resolve_read8: device '%s' (requested by %s '%s') has no memory", config->tag, device->name(), device->tag());
-
- resolved->target = targetdev->memory().space(spacenum);
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_read8: unable to find device '%s' space %d (requested by %s '%s')", config->tag, (int)spacenum, device->name(), device->tag());
- resolved->read = (read8_device_func)config->readspace;
- }
+//-------------------------------------------------
+// to_input - helper to convert to a device input
+// value from a line value
+//-------------------------------------------------
+
+void devcb_resolved_write_line::to_input(int state)
+{
+ m_object.execute->set_input_line(m_helper.input_line, state);
+}
+
+
+
+//**************************************************************************
+// DEVCB RESOLVED READ8
+//**************************************************************************
+
+//-------------------------------------------------
+// devcb_resolved_read8 - empty constructor
+//-------------------------------------------------
- /* device handlers */
- else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF || config->type == DEVCB_TYPE_DRIVER) && (config->readline != NULL || config->readdevice != NULL))
+devcb_resolved_read8::devcb_resolved_read8()
+{
+ m_object.port = NULL;
+ m_helper.read_line = NULL;
+}
+
+
+//-------------------------------------------------
+// resolve - resolve to a delegate from a static
+// structure definition
+//-------------------------------------------------
+
+void devcb_resolved_read8::resolve(const devcb_read8 &desc, device_t &device)
+{
+ switch (desc.type)
{
- if (config->type == DEVCB_TYPE_SELF)
- resolved->target = device;
- else if (config->type == DEVCB_TYPE_DRIVER)
- resolved->target = device->machine().driver_data();
- else
- if (strcmp(config->tag, DEVICE_SELF_OWNER) == 0)
- resolved->target = device->owner();
+ default:
+ case DEVCB_TYPE_NULL:
+ m_object.constant = 0;
+ m_helper.null_indicator = &s_null;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read8::from_constant, "(null)", this);
+ break;
+
+ case DEVCB_TYPE_IOPORT:
+ m_object.port = devcb_resolver::resolve_port(desc.tag, device);
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read8::from_port, desc.tag, this);
+ break;
+
+ case DEVCB_TYPE_DEVICE:
+ m_object.device = devcb_resolver::resolve_device(desc.index, desc.tag, device);
+ if (desc.readdevice != NULL)
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(desc.readdevice, NULL, m_object.device);
else
- resolved->target = device->siblingdevice(config->tag);
-
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_read8: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
-
- /* read8 to read8 is direct */
- if (config->readdevice != NULL)
- resolved->read = config->readdevice;
-
- /* read8 to read_line goes through a trampoline */
- else
- {
- resolved->realtarget = resolved->target;
- resolved->real.readline = config->readline;
- resolved->target = resolved;
- resolved->read = trampoline_read_line_to_read8;
- }
+ {
+ m_helper.read_line = desc.readline;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read8::from_readline, NULL, this);
+ }
+ break;
+
+ case DEVCB_TYPE_LEGACY_SPACE:
+ m_object.space = devcb_resolver::resolve_space(desc.index, desc.tag, device);
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(desc.readspace, NULL, m_object.space);
+ break;
+
+ case DEVCB_TYPE_CONSTANT:
+ m_object.constant = desc.index;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read8::from_constant, NULL, this);
+ break;
}
}
-/*-------------------------------------------------
- devcb_resolve_write8 - convert a static
- 8-bit write definition to a live definition
--------------------------------------------------*/
+//-------------------------------------------------
+// from_port - helper to convert from an I/O port
+// value to an 8-bit value
+//-------------------------------------------------
+
+UINT8 devcb_resolved_read8::from_port(offs_t offset)
+{
+ return input_port_read_direct(m_object.port);
+}
+
+
+//-------------------------------------------------
+// from_read8 - helper to convert from a device
+// line read value to an 8-bit value
+//-------------------------------------------------
-static WRITE8_DEVICE_HANDLER( trampoline_write_port_to_write8 )
+UINT8 devcb_resolved_read8::from_readline(offs_t offset)
{
- input_port_write_direct((const input_port_config *)device, data, 0xff);
+ return (*m_helper.read_line)(m_object.device);
}
-static WRITE8_DEVICE_HANDLER( trampoline_write_line_to_write8 )
+
+//-------------------------------------------------
+// from_constant - helper to convert from a
+// constant value to an 8-bit value
+//-------------------------------------------------
+
+UINT8 devcb_resolved_read8::from_constant(offs_t offset)
{
- const devcb_resolved_write8 *resolved = (const devcb_resolved_write8 *)device;
- (*resolved->real.writeline)((device_t *)resolved->realtarget, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
+ return m_object.constant;
}
-void devcb_resolve_write8(devcb_resolved_write8 *resolved, const devcb_write8 *config, device_t *device)
+
+
+//**************************************************************************
+// DEVCB RESOLVED WRITE8
+//**************************************************************************
+
+//-------------------------------------------------
+// devcb_resolved_write8 - empty constructor
+//-------------------------------------------------
+
+devcb_resolved_write8::devcb_resolved_write8()
{
- /* reset the resolved structure */
- memset(resolved, 0, sizeof(*resolved));
+ m_object.port = NULL;
+ m_helper.write_line = NULL;
+}
- if (config->type == DEVCB_TYPE_INPUT)
- {
- resolved->target = device->machine().port(config->tag);
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_read_line: unable to find input port '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- resolved->write = trampoline_write_port_to_write8;
- }
- /* address space handlers */
- else if (config->type >= DEVCB_TYPE_MEMORY(AS_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->writespace != NULL)
- {
- FPTR spacenum = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(AS_PROGRAM);
-
- device_t *targetdev = device->siblingdevice(config->tag);
- if (targetdev == NULL)
- fatalerror("devcb_resolve_write8: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- device_memory_interface *memory;
- if (!targetdev->interface(memory))
- fatalerror("devcb_resolve_write8: device '%s' (requested by %s '%s') has no memory", config->tag, device->name(), device->tag());
-
- resolved->target = targetdev->memory().space(spacenum);
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_write8: unable to find device '%s' space %d (requested by %s '%s')", config->tag, (int)spacenum, device->name(), device->tag());
- resolved->write = (write8_device_func)config->writespace;
- }
+//-------------------------------------------------
+// resolve - resolve to a delegate from a static
+// structure definition
+//-------------------------------------------------
- /* device handlers */
- else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF || config->type == DEVCB_TYPE_DRIVER) && (config->writeline != NULL || config->writedevice != NULL))
+void devcb_resolved_write8::resolve(const devcb_write8 &desc, device_t &device)
+{
+ switch (desc.type)
{
- if (config->type == DEVCB_TYPE_SELF)
- resolved->target = device;
- else if (config->type == DEVCB_TYPE_DRIVER)
- resolved->target = device->machine().driver_data();
- else
- if (strcmp(config->tag, DEVICE_SELF_OWNER) == 0)
- resolved->target = device->owner();
+ default:
+ case DEVCB_TYPE_NULL:
+ m_helper.null_indicator = &s_null;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write8::to_null, "(null)", this);
+ break;
+
+ case DEVCB_TYPE_IOPORT:
+ m_object.port = devcb_resolver::resolve_port(desc.tag, device);
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write8::to_port, desc.tag, this);
+ break;
+
+ case DEVCB_TYPE_DEVICE:
+ m_object.device = devcb_resolver::resolve_device(desc.index, desc.tag, device);
+ if (desc.writedevice != NULL)
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(desc.writedevice, NULL, m_object.device);
else
- resolved->target = device->siblingdevice(config->tag);
-
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_write8: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
-
- /* write8 to write8 is direct */
- if (config->writedevice != NULL)
- resolved->write = config->writedevice;
-
- /* write8 to write_line goes through a trampoline */
- else
- {
- resolved->realtarget = resolved->target;
- resolved->real.writeline = config->writeline;
- resolved->target = resolved;
- resolved->write = trampoline_write_line_to_write8;
- }
+ {
+ m_helper.write_line = desc.writeline;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write8::to_writeline, desc.tag, this);
+ }
+ break;
+
+ case DEVCB_TYPE_LEGACY_SPACE:
+ m_object.space = devcb_resolver::resolve_space(desc.index, desc.tag, device);
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(desc.writespace, NULL, m_object.space);
+ break;
+
+ case DEVCB_TYPE_INPUT_LINE:
+ m_object.execute = devcb_resolver::resolve_execute_interface(desc.tag, device);
+ m_helper.input_line = desc.index;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write8::to_input, desc.tag, this);
+ break;
}
}
-/*-------------------------------------------------
- devcb_resolve_read16 - convert a static
- 16-bit read definition to a live definition
--------------------------------------------------*/
+//-------------------------------------------------
+// to_null - helper to handle a NULL write
+//-------------------------------------------------
-static READ16_DEVICE_HANDLER( trampoline_read_port_to_read16 )
+void devcb_resolved_write8::to_null(offs_t offset, UINT8 data)
{
- return input_port_read_direct((const input_port_config *)device);
}
-static READ16_DEVICE_HANDLER( trampoline_read_line_to_read16 )
+
+//-------------------------------------------------
+// to_port - helper to convert to an I/O port
+// value from a line value
+//-------------------------------------------------
+
+void devcb_resolved_write8::to_port(offs_t offset, UINT8 data)
{
- const devcb_resolved_read16 *resolved = (const devcb_resolved_read16 *)device;
- return (*resolved->real.readline)((device_t *)resolved->realtarget);
+ input_port_write_direct(m_object.port, data, 0xff);
}
-void devcb_resolve_read16(devcb_resolved_read16 *resolved, const devcb_read16 *config, device_t *device)
+
+//-------------------------------------------------
+// to_write8 - helper to convert to an 8-bit
+// memory read value from a line value
+//-------------------------------------------------
+
+void devcb_resolved_write8::to_writeline(offs_t offset, UINT8 data)
{
- /* reset the resolved structure */
- memset(resolved, 0, sizeof(*resolved));
+ (*m_helper.write_line)(m_object.device, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
+}
+
+
+//-------------------------------------------------
+// to_input - helper to convert to a device input
+// value from a line value
+//-------------------------------------------------
+
+void devcb_resolved_write8::to_input(offs_t offset, UINT8 data)
+{
+ m_object.execute->set_input_line(m_helper.input_line, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
+}
- /* input port handlers */
- if (config->type == DEVCB_TYPE_INPUT)
- {
- resolved->target = device->machine().port(config->tag);
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_read16: unable to find input port '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- resolved->read = trampoline_read_port_to_read16;
- }
- /* address space handlers */
- else if (config->type >= DEVCB_TYPE_MEMORY(AS_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->readspace != NULL)
- {
- FPTR spacenum = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(AS_PROGRAM);
-
- device_t *targetdev = device->siblingdevice(config->tag);
- if (targetdev == NULL)
- fatalerror("devcb_resolve_read16: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- device_memory_interface *memory;
- if (!targetdev->interface(memory))
- fatalerror("devcb_resolve_read16: device '%s' (requested by %s '%s') has no memory", config->tag, device->name(), device->tag());
-
- resolved->target = targetdev->memory().space(spacenum);
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_read16: unable to find device '%s' space %d (requested by %s '%s')", config->tag, (int)spacenum, device->name(), device->tag());
- resolved->read = (read16_device_func)config->readspace;
- }
- /* device handlers */
- else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF || config->type == DEVCB_TYPE_DRIVER) && (config->readline != NULL || config->readdevice != NULL))
+//**************************************************************************
+// DEVCB RESOLVED READ16
+//**************************************************************************
+
+//-------------------------------------------------
+// devcb_resolved_read16 - empty constructor
+//-------------------------------------------------
+
+devcb_resolved_read16::devcb_resolved_read16()
+{
+ m_object.port = NULL;
+ m_helper.read_line = NULL;
+}
+
+
+//-------------------------------------------------
+// resolve - resolve to a delegate from a static
+// structure definition
+//-------------------------------------------------
+
+void devcb_resolved_read16::resolve(const devcb_read16 &desc, device_t &device)
+{
+ switch (desc.type)
{
- if (config->type == DEVCB_TYPE_SELF)
- resolved->target = device;
- else if (config->type == DEVCB_TYPE_DRIVER)
- resolved->target = device->machine().driver_data();
- else
- if (strcmp(config->tag, DEVICE_SELF_OWNER) == 0)
- resolved->target = device->owner();
+ default:
+ case DEVCB_TYPE_NULL:
+ m_object.constant = 0;
+ m_helper.null_indicator = &s_null;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read16::from_constant, "(null)", this);
+ break;
+
+ case DEVCB_TYPE_IOPORT:
+ m_object.port = devcb_resolver::resolve_port(desc.tag, device);
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read16::from_port, desc.tag, this);
+ break;
+
+ case DEVCB_TYPE_DEVICE:
+ m_object.device = devcb_resolver::resolve_device(desc.index, desc.tag, device);
+ if (desc.readdevice != NULL)
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(desc.readdevice, NULL, m_object.device);
else
- resolved->target = device->siblingdevice(config->tag);
-
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_read16: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
-
- /* read16 to read16 is direct */
- if (config->readdevice != NULL)
- resolved->read = config->readdevice;
-
- /* read16 to read_line goes through a trampoline */
- else
- {
- resolved->realtarget = resolved->target;
- resolved->real.readline = config->readline;
- resolved->target = resolved;
- resolved->read = trampoline_read_line_to_read16;
- }
+ {
+ m_helper.read_line = desc.readline;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read16::from_readline, NULL, this);
+ }
+ break;
+
+ case DEVCB_TYPE_LEGACY_SPACE:
+ m_object.space = devcb_resolver::resolve_space(desc.index, desc.tag, device);
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(desc.readspace, NULL, m_object.space);
+ break;
+
+ case DEVCB_TYPE_CONSTANT:
+ m_object.constant = desc.index;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_read16::from_constant, NULL, this);
+ break;
}
}
-/*-------------------------------------------------
- devcb_resolve_write16 - convert a static
- 16-bit write definition to a live definition
--------------------------------------------------*/
+//-------------------------------------------------
+// from_port - helper to convert from an I/O port
+// value to a 16-bit value
+//-------------------------------------------------
-static WRITE16_DEVICE_HANDLER( trampoline_write_port_to_write16 )
+UINT16 devcb_resolved_read16::from_port(offs_t offset, UINT16 mask)
{
- input_port_write_direct((const input_port_config *)device, data, 0xff);
+ return input_port_read_direct(m_object.port);
}
-static WRITE16_DEVICE_HANDLER( trampoline_write_line_to_write16 )
+
+//-------------------------------------------------
+// from_read16 - helper to convert from a device
+// line read value to a 16-bit value
+//-------------------------------------------------
+
+UINT16 devcb_resolved_read16::from_readline(offs_t offset, UINT16 mask)
{
- const devcb_resolved_write16 *resolved = (const devcb_resolved_write16 *)device;
- (*resolved->real.writeline)((device_t *)resolved->realtarget, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
+ return (*m_helper.read_line)(m_object.device);
}
-void devcb_resolve_write16(devcb_resolved_write16 *resolved, const devcb_write16 *config, device_t *device)
+
+//-------------------------------------------------
+// from_constant - helper to convert from a
+// constant value to a 16-bit value
+//-------------------------------------------------
+
+UINT16 devcb_resolved_read16::from_constant(offs_t offset, UINT16 mask)
{
- /* reset the resolved structure */
- memset(resolved, 0, sizeof(*resolved));
+ return m_object.constant;
+}
- if (config->type == DEVCB_TYPE_INPUT)
- {
- resolved->target = device->machine().port(config->tag);
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_read_line: unable to find input port '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- resolved->write = trampoline_write_port_to_write16;
- }
- /* address space handlers */
- else if (config->type >= DEVCB_TYPE_MEMORY(AS_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->writespace != NULL)
- {
- FPTR spacenum = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(AS_PROGRAM);
-
- device_t *targetdev = device->siblingdevice(config->tag);
- if (targetdev == NULL)
- fatalerror("devcb_resolve_write16: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
- device_memory_interface *memory;
- if (!targetdev->interface(memory))
- fatalerror("devcb_resolve_write16: device '%s' (requested by %s '%s') has no memory", config->tag, device->name(), device->tag());
-
- resolved->target = targetdev->memory().space(spacenum);
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_write16: unable to find device '%s' space %d (requested by %s '%s')", config->tag, (int)spacenum, device->name(), device->tag());
- resolved->write = (write16_device_func)config->writespace;
- }
- /* device handlers */
- else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF || config->type == DEVCB_TYPE_DRIVER) && (config->writeline != NULL || config->writedevice != NULL))
+//**************************************************************************
+// DEVCB RESOLVED WRITE16
+//**************************************************************************
+
+//-------------------------------------------------
+// devcb_resolved_write16 - empty constructor
+//-------------------------------------------------
+
+devcb_resolved_write16::devcb_resolved_write16()
+{
+ m_object.port = NULL;
+ m_helper.write_line = NULL;
+}
+
+
+//-------------------------------------------------
+// resolve - resolve to a delegate from a static
+// structure definition
+//-------------------------------------------------
+
+void devcb_resolved_write16::resolve(const devcb_write16 &desc, device_t &device)
+{
+ switch (desc.type)
{
- if (config->type == DEVCB_TYPE_SELF)
- resolved->target = device;
- else if (config->type == DEVCB_TYPE_DRIVER)
- resolved->target = device->machine().driver_data();
- else
- if (strcmp(config->tag, DEVICE_SELF_OWNER) == 0)
- resolved->target = device->owner();
+ default:
+ case DEVCB_TYPE_NULL:
+ m_helper.null_indicator = &s_null;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write16::to_null, "(null)", this);
+ break;
+
+ case DEVCB_TYPE_IOPORT:
+ m_object.port = devcb_resolver::resolve_port(desc.tag, device);
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write16::to_port, desc.tag, this);
+ break;
+
+ case DEVCB_TYPE_DEVICE:
+ m_object.device = devcb_resolver::resolve_device(desc.index, desc.tag, device);
+ if (desc.writedevice != NULL)
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(desc.writedevice, NULL, m_object.device);
else
- resolved->target = device->siblingdevice(config->tag);
-
- if (resolved->target == NULL)
- fatalerror("devcb_resolve_write16: unable to find device '%s' (requested by %s '%s')", config->tag, device->name(), device->tag());
-
- /* write16 to write16 is direct */
- if (config->writedevice != NULL)
- resolved->write = config->writedevice;
-
- /* write16 to write_line goes through a trampoline */
- else
- {
- resolved->realtarget = resolved->target;
- resolved->real.writeline = config->writeline;
- resolved->target = resolved;
- resolved->write = trampoline_write_line_to_write16;
- }
+ {
+ m_helper.write_line = desc.writeline;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write16::to_writeline, desc.tag, this);
+ }
+ break;
+
+ case DEVCB_TYPE_LEGACY_SPACE:
+ m_object.space = devcb_resolver::resolve_space(desc.index, desc.tag, device);
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(desc.writespace, NULL, m_object.space);
+ break;
+
+ case DEVCB_TYPE_INPUT_LINE:
+ m_object.execute = devcb_resolver::resolve_execute_interface(desc.tag, device);
+ m_helper.input_line = desc.index;
+ *static_cast<base_delegate_t *>(this) = base_delegate_t(&devcb_resolved_write16::to_input, desc.tag, this);
+ break;
}
}
+
+
+//-------------------------------------------------
+// to_null - helper to handle a NULL write
+//-------------------------------------------------
+
+void devcb_resolved_write16::to_null(offs_t offset, UINT16 data, UINT16 mask)
+{
+}
+
+
+//-------------------------------------------------
+// to_port - helper to convert to an I/O port
+// value from a line value
+//-------------------------------------------------
+
+void devcb_resolved_write16::to_port(offs_t offset, UINT16 data, UINT16 mask)
+{
+ input_port_write_direct(m_object.port, data, mask);
+}
+
+
+//-------------------------------------------------
+// to_write16 - helper to convert to a 16-bit
+// memory read value from a line value
+//-------------------------------------------------
+
+void devcb_resolved_write16::to_writeline(offs_t offset, UINT16 data, UINT16 mask)
+{
+ (*m_helper.write_line)(m_object.device, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
+}
+
+
+//-------------------------------------------------
+// to_input - helper to convert to a device input
+// value from a line value
+//-------------------------------------------------
+
+void devcb_resolved_write16::to_input(offs_t offset, UINT16 data, UINT16 mask)
+{
+ m_object.execute->set_input_line(m_helper.input_line, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
+}
diff --git a/src/emu/devcb.h b/src/emu/devcb.h
index db591c4f873..894b6d3e8ee 100644
--- a/src/emu/devcb.h
+++ b/src/emu/devcb.h
@@ -4,8 +4,36 @@
Device callback interface helpers.
- Copyright Nicola Salmoria and the MAME Team.
- Visit http://mamedev.org for licensing and usage restrictions.
+****************************************************************************
+
+ Copyright Aaron Giles
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name 'MAME' nor the names of its contributors may be
+ used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
****************************************************************************
@@ -33,10 +61,10 @@
write8_device_func: (device, offset, data)
read8_space_func: (space, offset)
write8_space_func: (space, offset, data)
- read16_device_func: (device, offset)
- write16_device_func: (device, offset, data)
- read16_space_func: (space, offset)
- write16_space_func: (space, offset, data)
+ read16_device_func: (device, offset)
+ write16_device_func: (device, offset, data)
+ read16_space_func: (space, offset)
+ write16_space_func: (space, offset, data)
***************************************************************************/
@@ -50,23 +78,34 @@
#define __DEVCB_H__
-/***************************************************************************
- CONSTANTS
-***************************************************************************/
+//**************************************************************************
+// CONSTANTS
+//**************************************************************************
-#define DEVCB_TYPE_NULL (0)
-#define DEVCB_TYPE_SELF (1)
-#define DEVCB_TYPE_INPUT (2)
-#define DEVCB_TYPE_DEVICE (3)
-#define DEVCB_TYPE_DRIVER (4)
-#define DEVCB_TYPE_MEMORY(space) (5 + (space))
-#define DEVCB_TYPE_CPU_LINE(line) (5 + ADDRESS_SPACES + (line))
+// callback types
+enum
+{
+ DEVCB_TYPE_NULL = 0, // NULL callback
+ DEVCB_TYPE_IOPORT, // I/O port read/write
+ DEVCB_TYPE_DEVICE, // device read/write
+ DEVCB_TYPE_LEGACY_SPACE, // legacy address space read/write
+ DEVCB_TYPE_INPUT_LINE, // device input line write
+ DEVCB_TYPE_CONSTANT // constant value read
+};
+// for DEVCB_TYPE_DEVICE, some further differentiation
+enum
+{
+ DEVCB_DEVICE_SELF, // ignore 'tag', refers to the device itself
+ DEVCB_DEVICE_DRIVER, // ignore 'tag', refers to the driver device
+ DEVCB_DEVICE_OTHER // device specified by 'tag'
+};
-/***************************************************************************
- MACROS
-***************************************************************************/
+
+//**************************************************************************
+// MACROS
+//**************************************************************************
// static template for a read_line stub function that calls through a given READ_LINE_MEMBER
template<class _Class, int (_Class::*_Function)()>
@@ -116,37 +155,40 @@ void devcb_stub16(device_t *device, offs_t offset, UINT16 data)
(target->*_Function)(*memory_nonspecific_space(device->machine()), offset, data, 0xffff);
}
-#define DEVCB_NULL { DEVCB_TYPE_NULL }
+#define DEVCB_NULL { DEVCB_TYPE_NULL }
+
+// standard line or read/write handlers with the calling device passed
+#define DEVCB_LINE(func) { DEVCB_TYPE_DEVICE, DEVCB_DEVICE_SELF, NULL, (func), NULL, NULL }
+#define DEVCB_LINE_MEMBER(cls,memb) { DEVCB_TYPE_DEVICE, DEVCB_DEVICE_SELF, NULL, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
+#define DEVCB_HANDLER(func) { DEVCB_TYPE_DEVICE, DEVCB_DEVICE_SELF, NULL, NULL, (func), NULL }
+#define DEVCB_MEMBER(cls,memb) { DEVCB_TYPE_DEVICE, DEVCB_DEVICE_SELF, NULL, NULL, &devcb_stub<cls, &cls::memb>, NULL }
-/* standard line or read/write handlers with the calling device passed */
-#define DEVCB_LINE(func) { DEVCB_TYPE_SELF, NULL, (func), NULL, NULL }
-#define DEVCB_LINE_MEMBER(cls,memb) { DEVCB_TYPE_SELF, NULL, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
-#define DEVCB_LINE_GND { DEVCB_TYPE_SELF, NULL, devcb_line_gnd_r, NULL, NULL }
-#define DEVCB_LINE_VCC { DEVCB_TYPE_SELF, NULL, devcb_line_vcc_r, NULL, NULL }
-#define DEVCB_HANDLER(func) { DEVCB_TYPE_SELF, NULL, NULL, (func), NULL }
-#define DEVCB_MEMBER(cls,memb) { DEVCB_TYPE_SELF, NULL, NULL, &devcb_stub<cls, &cls::memb>, NULL }
+// line or read/write handlers for the driver device
+#define DEVCB_DRIVER_LINE_MEMBER(cls,memb) { DEVCB_TYPE_DEVICE, DEVCB_DEVICE_DRIVER, NULL, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
+#define DEVCB_DRIVER_MEMBER(cls,memb) { DEVCB_TYPE_DEVICE, DEVCB_DEVICE_DRIVER, NULL, NULL, &devcb_stub<cls, &cls::memb>, NULL }
-/* line or read/write handlers for the driver device */
-#define DEVCB_DRIVER_LINE_MEMBER(cls,memb) { DEVCB_TYPE_DRIVER, NULL, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
-#define DEVCB_DRIVER_MEMBER(cls,memb) { DEVCB_TYPE_DRIVER, NULL, NULL, &devcb_stub<cls, &cls::memb>, NULL }
+// line or read/write handlers for another device
+#define DEVCB_DEVICE_LINE(tag,func) { DEVCB_TYPE_DEVICE, DEVCB_DEVICE_OTHER, tag, (func), NULL, NULL }
+#define DEVCB_DEVICE_LINE_MEMBER(tag,cls,memb) { DEVCB_TYPE_DEVICE, DEVCB_DEVICE_OTHER, tag, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
+#define DEVCB_DEVICE_HANDLER(tag,func) { DEVCB_TYPE_DEVICE, DEVCB_DEVICE_OTHER, tag, NULL, (func), NULL }
+#define DEVCB_DEVICE_MEMBER(tag,cls,memb) { DEVCB_TYPE_DEVICE, DEVCB_DEVICE_OTHER, tag, NULL, &devcb_stub<cls, &cls::memb>, NULL }
-/* line or read/write handlers for another device */
-#define DEVCB_DEVICE_LINE(tag,func) { DEVCB_TYPE_DEVICE, tag, (func), NULL, NULL }
-#define DEVCB_DEVICE_LINE_MEMBER(tag,cls,memb) { DEVCB_TYPE_DEVICE, tag, &devcb_line_stub<cls, &cls::memb>, NULL, NULL }
-#define DEVCB_DEVICE_HANDLER(tag,func) { DEVCB_TYPE_DEVICE, tag, NULL, (func), NULL }
-#define DEVCB_DEVICE_MEMBER(tag,cls,memb) { DEVCB_TYPE_DEVICE, tag, NULL, &devcb_stub<cls, &cls::memb>, NULL }
+// constant values
+#define DEVCB_CONSTANT(value) { DEVCB_TYPE_CONSTANT, value, NULL, NULL, NULL, NULL }
+#define DEVCB_LINE_GND DEVCB_CONSTANT(0)
+#define DEVCB_LINE_VCC DEVCB_CONSTANT(1)
-/* read/write handlers for a given CPU's address space */
-#define DEVCB_MEMORY_HANDLER(cpu,space,func) { DEVCB_TYPE_MEMORY(AS_##space), (cpu), NULL, NULL, (func) }
+// read/write handlers for a given CPU's address space
+#define DEVCB_MEMORY_HANDLER(cpu,space,func) { DEVCB_TYPE_LEGACY_SPACE, AS_##space, (cpu), NULL, NULL, (func) }
-/* read handlers for an I/O port by tag */
-#define DEVCB_INPUT_PORT(tag) { DEVCB_TYPE_INPUT, (tag), NULL, NULL, NULL }
+// read handlers for an I/O port by tag
+#define DEVCB_INPUT_PORT(tag) { DEVCB_TYPE_IOPORT, 0, (tag), NULL, NULL, NULL }
-/* write handlers for a CPU input line */
-#define DEVCB_CPU_INPUT_LINE(tag,line) { DEVCB_TYPE_CPU_LINE(line), (tag), NULL, NULL, NULL }
+// write handlers for a CPU input line
+#define DEVCB_CPU_INPUT_LINE(tag,line) { DEVCB_TYPE_INPUT_LINE, (line), (tag), NULL, NULL, NULL }
-/* macros for defining read_line/write_line functions */
+// macros for defining read_line/write_line functions
#define READ_LINE_DEVICE_HANDLER(name) int name(ATTR_UNUSED device_t *device)
#define WRITE_LINE_DEVICE_HANDLER(name) void name(ATTR_UNUSED device_t *device, ATTR_UNUSED int state)
@@ -155,7 +197,7 @@ void devcb_stub16(device_t *device, offs_t offset, UINT16 data)
#define DECLARE_WRITE_LINE_MEMBER(name) void name(ATTR_UNUSED int state)
#define WRITE_LINE_MEMBER(name) void name(ATTR_UNUSED int state)
-/* macros for inline device handler initialization */
+// macros for inline device handler initialization
#define MCFG_DEVICE_CONFIG_DEVCB_GENERIC(_access, _struct, _entry, _tag, _type, _linefunc, _devfunc, _spacefunc) \
MCFG_DEVICE_CONFIG_DATA32(_struct, _entry .type, DEVCB_TYPE_DEVICE) \
@@ -172,282 +214,325 @@ void devcb_stub16(device_t *device, offs_t offset, UINT16 data)
-/***************************************************************************
- TYPE DEFINITIONS
-***************************************************************************/
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
-/* static structure used for device configuration when the desired callback type is a read_line_device_func */
-typedef struct _devcb_read_line devcb_read_line;
-struct _devcb_read_line
-{
- UINT32 type; /* one of the special DEVCB_TYPE values */
- const char * tag; /* tag of target, where appropriate */
- read_line_device_func readline; /* read line function */
- read8_device_func readdevice; /* read device function */
- read8_space_func readspace; /* read space function */
-};
+// ======================> devcb_resolved_objects
-typedef struct _devcb_resolved_read_line devcb_resolved_read_line;
-struct _devcb_resolved_read_line
+// resolving a devcb may produce one of the following object types
+union devcb_resolved_objects
{
- const void * target; /* target object */
- read_line_device_func read; /* read line function */
- const void * realtarget; /* real target object for stubs */
- union
- {
- read8_device_func readdevice;
- read8_space_func readspace;
- } real; /* real read function for stubs */
+ const input_port_config * port;
+ address_space * space;
+ device_t * device;
+ device_execute_interface * execute;
+ UINT32 constant;
};
-/* static structure used for device configuration when the desired callback type is a write_line_device_func */
-typedef struct _devcb_write_line devcb_write_line;
-struct _devcb_write_line
+// ======================> devcb_resolved_helpers
+
+// resolving a devcb may produce one of the following helper functions/additional info
+union devcb_resolved_read_helpers
{
- UINT32 type; /* one of the special DEVCB_TYPE values */
- const char * tag; /* tag of target, where appropriate */
- write_line_device_func writeline; /* write line function */
- write8_device_func writedevice; /* write device function */
- write8_space_func writespace; /* write space function */
+ UINT8 * null_indicator;
+ read_line_device_func read_line;
+ read8_device_func read8_device;
+ read8_space_func read8_space;
+ read16_device_func read16_device;
+ read16_space_func read16_space;
};
-typedef struct _devcb_resolved_write_line devcb_resolved_write_line;
-struct _devcb_resolved_write_line
+union devcb_resolved_write_helpers
{
- const void * target; /* target object */
- write_line_device_func write; /* write line function */
- const void * realtarget; /* real target object for stubs */
- union
- {
- write8_device_func writedevice;
- write8_space_func writespace;
- int writeline;
- } real; /* real write function for stubs */
+ UINT8 * null_indicator;
+ write_line_device_func write_line;
+ write8_device_func write8_device;
+ write8_space_func write8_space;
+ write16_device_func write16_device;
+ write16_space_func write16_space;
+ int input_line;
};
-/* static structure used for device configuration when the desired callback type is a read8_device_func */
-typedef struct _devcb_read8 devcb_read8;
-struct _devcb_read8
-{
- UINT32 type; /* one of the special DEVCB_TYPE values */
- const char * tag; /* tag of target, where appropriate */
- read_line_device_func readline; /* read line function */
- read8_device_func readdevice; /* read device function */
- read8_space_func readspace; /* read space function */
-};
+// ======================> devcb_read_line
-typedef struct _devcb_resolved_read8 devcb_resolved_read8;
-struct _devcb_resolved_read8
+// static structure used for device configuration when the desired callback type is a read_line_device_func
+struct devcb_read_line
{
- const void * target; /* target object */
- read8_device_func read; /* read function */
- const void * realtarget; /* real target object for stubs */
- union
- {
- read8_device_func readdevice;
- read8_space_func readspace;
- read_line_device_func readline;
- } real; /* real read function for stubs */
+ UINT16 type; // one of the special DEVCB_TYPE values
+ UINT16 index; // index related to the above types
+ const char * tag; // tag of target, where appropriate
+ read_line_device_func readline; // read line function
+ read8_device_func readdevice; // read device function
+ read8_space_func readspace; // read space function
};
-/* static structure used for device configuration when the desired callback type is a write8_device_func */
-typedef struct _devcb_write8 devcb_write8;
-struct _devcb_write8
-{
- UINT32 type; /* one of the special DEVCB_TYPE values */
- const char * tag; /* tag of target, where appropriate */
- write_line_device_func writeline; /* write line function */
- write8_device_func writedevice; /* write device function */
- write8_space_func writespace; /* write space function */
-};
+// ======================> devcb_resolved_read_line
-typedef struct _devcb_resolved_write8 devcb_resolved_write8;
-struct _devcb_resolved_write8
+// class which wraps resolving a devcb_read_line into a delegate
+class devcb_resolved_read_line : public delegate<int ()>
{
- const void * target; /* target object */
- write8_device_func write; /* write function */
- const void * realtarget; /* real target object for stubs */
- union
- {
- write8_device_func writedevice;
- write8_space_func writespace;
- write_line_device_func writeline;
- } real; /* real write function for stubs */
+ DISABLE_COPYING(devcb_resolved_read_line);
+ typedef delegate<int ()> base_delegate_t;
+
+public:
+ // construction/destruction
+ devcb_resolved_read_line();
+ devcb_resolved_read_line(const devcb_read_line &desc, device_t &device) { resolve(desc, device); }
+
+ // resolution
+ void resolve(const devcb_read_line &desc, device_t &device);
+
+ // override parent class' notion of NULL
+ bool isnull() const { return m_helper.null_indicator == &s_null; }
+
+private:
+ // internal helpers
+ int from_port();
+ int from_read8();
+ int from_constant();
+
+ // internal state
+ devcb_resolved_objects m_object;
+ devcb_resolved_read_helpers m_helper;
+ static UINT8 s_null;
};
-/* static structure used for device configuration when the desired callback type is a read16_device_func */
-typedef struct _devcb_read16 devcb_read16;
-struct _devcb_read16
-{
- UINT32 type; /* one of the special DEVCB_TYPE values */
- const char * tag; /* tag of target, where appropriate */
- read_line_device_func readline; /* read line function */
- read16_device_func readdevice; /* read device function */
- read16_space_func readspace; /* read space function */
-};
+// ======================> devcb_write_line
-typedef struct _devcb_resolved_read16 devcb_resolved_read16;
-struct _devcb_resolved_read16
+// static structure used for device configuration when the desired callback type is a write_line_device_func
+struct devcb_write_line
{
- const void * target; /* target object */
- read16_device_func read; /* read function */
- const void * realtarget; /* real target object for stubs */
- union
- {
- read16_device_func readdevice;
- read16_space_func readspace;
- read_line_device_func readline;
- } real; /* real read function for stubs */
+ UINT16 type; // one of the special DEVCB_TYPE values
+ UINT16 index; // index related to the above types
+ const char * tag; // tag of target, where appropriate
+ write_line_device_func writeline; // write line function
+ write8_device_func writedevice; // write device function
+ write8_space_func writespace; // write space function
};
-/* static structure used for device configuration when the desired callback type is a write16_device_func */
-typedef struct _devcb_write16 devcb_write16;
-struct _devcb_write16
-{
- UINT32 type; /* one of the special DEVCB_TYPE values */
- const char * tag; /* tag of target, where appropriate */
- write_line_device_func writeline; /* write line function */
- write16_device_func writedevice; /* write device function */
- write16_space_func writespace; /* write space function */
-};
+// ======================> devcb_resolved_write_line
-typedef struct _devcb_resolved_write16 devcb_resolved_write16;
-struct _devcb_resolved_write16
+// class which wraps resolving a devcb_write_line into a delegate
+class devcb_resolved_write_line : public delegate<void (int)>
{
- const void * target; /* target object */
- write16_device_func write; /* write function */
- const void * realtarget; /* real target object for stubs */
- union
- {
- write16_device_func writedevice;
- write16_space_func writespace;
- write_line_device_func writeline;
- } real; /* real write function for stubs */
+ DISABLE_COPYING(devcb_resolved_write_line);
+ typedef delegate<void (int)> base_delegate_t;
+
+public:
+ // construction/destruction
+ devcb_resolved_write_line();
+ devcb_resolved_write_line(const devcb_write_line &desc, device_t &device) { resolve(desc, device); }
+
+ // resolution
+ void resolve(const devcb_write_line &desc, device_t &device);
+
+ // override parent class' notion of NULL
+ bool isnull() const { return m_helper.null_indicator == &s_null; }
+
+private:
+ // internal helpers
+ void to_null(int state);
+ void to_port(int state);
+ void to_write8(int state);
+ void to_input(int state);
+
+ // internal state
+ devcb_resolved_objects m_object;
+ devcb_resolved_write_helpers m_helper;
+ static UINT8 s_null;
};
-/***************************************************************************
- FUNCTION PROTOTYPES
-***************************************************************************/
-
-
-/* ----- static-to-live conversion ----- */
-
-/* convert a static read line definition to a live definition */
-void devcb_resolve_read_line(devcb_resolved_read_line *resolved, const devcb_read_line *config, device_t *device);
-
-/* convert a static write line definition to a live definition */
-void devcb_resolve_write_line(devcb_resolved_write_line *resolved, const devcb_write_line *config, device_t *device);
-
-/* convert a static 8-bit read definition to a live definition */
-void devcb_resolve_read8(devcb_resolved_read8 *resolved, const devcb_read8 *config, device_t *device);
-
-/* convert a static 8-bit write definition to a live definition */
-void devcb_resolve_write8(devcb_resolved_write8 *resolved, const devcb_write8 *config, device_t *device);
-
-/* convert a static 16-bit read definition to a live definition */
-void devcb_resolve_read16(devcb_resolved_read16 *resolved, const devcb_read16 *config, device_t *device);
-
-/* convert a static 16-bit write definition to a live definition */
-void devcb_resolve_write16(devcb_resolved_write16 *resolved, const devcb_write16 *config, device_t *device);
-
+// ======================> devcb_read8
-
-/***************************************************************************
- INLINE FUNCTIONS
-***************************************************************************/
-
-/*-------------------------------------------------
- devcb_call_read_line - call through a
- resolved read_line handler
--------------------------------------------------*/
-
-INLINE int devcb_call_read_line(const devcb_resolved_read_line *resolved)
+// static structure used for device configuration when the desired callback type is a read8_device_func
+struct devcb_read8
{
- return (resolved->read != NULL) ? (*resolved->read)((device_t *)resolved->target) : 0;
-}
+ UINT16 type; // one of the special DEVCB_TYPE values
+ UINT16 index; // index related to the above types
+ const char * tag; // tag of target, where appropriate
+ read_line_device_func readline; // read line function
+ read8_device_func readdevice; // read device function
+ read8_space_func readspace; // read space function
+};
-/*-------------------------------------------------
- devcb_call_read8 - call through a
- resolved read8 handler
--------------------------------------------------*/
+// ======================> devcb_resolved_read8
-INLINE int devcb_call_read8(const devcb_resolved_read8 *resolved, offs_t offset)
+// class which wraps resolving a devcb_read8 into a delegate
+class devcb_resolved_read8 : public delegate<UINT8 (offs_t)>
{
- return (resolved->read != NULL) ? (*resolved->read)((device_t *)resolved->target, offset) : 0;
-}
+ DISABLE_COPYING(devcb_resolved_read8);
+ typedef delegate<UINT8 (offs_t)> base_delegate_t;
+
+public:
+ // construction/destruction
+ devcb_resolved_read8();
+ devcb_resolved_read8(const devcb_read8 &desc, device_t &device) { resolve(desc, device); }
+
+ // resolution
+ void resolve(const devcb_read8 &desc, device_t &device);
+
+ // override parent class' notion of NULL
+ bool isnull() const { return m_helper.null_indicator == &s_null; }
+
+private:
+ // internal helpers
+ UINT8 from_port(offs_t offset);
+ UINT8 from_readline(offs_t offset);
+ UINT8 from_constant(offs_t offset);
+
+ // internal state
+ devcb_resolved_objects m_object;
+ devcb_resolved_read_helpers m_helper;
+ static UINT8 s_null;
+};
-/*-------------------------------------------------
- devcb_call_read16 - call through a
- resolved read16 handler
--------------------------------------------------*/
+// ======================> devcb_write8
-INLINE int devcb_call_read16(const devcb_resolved_read16 *resolved, offs_t offset)
+// static structure used for device configuration when the desired callback type is a write8_device_func
+struct devcb_write8
{
- return (resolved->read != NULL) ? (*resolved->read)((device_t *)resolved->target, offset, 0xffff) : 0;
-}
+ UINT16 type; // one of the special DEVCB_TYPE values
+ UINT16 index; // index related to the above types
+ const char * tag; // tag of target, where appropriate
+ write_line_device_func writeline; // write line function
+ write8_device_func writedevice; // write device function
+ write8_space_func writespace; // write space function
+};
-/*-------------------------------------------------
- devcb_call_write_line - call through a
- resolved write_line handler
--------------------------------------------------*/
+// ======================> devcb_resolved_write8
-INLINE void devcb_call_write_line(const devcb_resolved_write_line *resolved, int state)
+// class which wraps resolving a devcb_write8 into a delegate
+class devcb_resolved_write8 : public delegate<void (offs_t, UINT8)>
{
- if (resolved->write != NULL)
- (*resolved->write)((device_t *)resolved->target, state);
-}
+ DISABLE_COPYING(devcb_resolved_write8);
+ typedef delegate<void (offs_t, UINT8)> base_delegate_t;
+
+public:
+ // construction/destruction
+ devcb_resolved_write8();
+ devcb_resolved_write8(const devcb_write8 &desc, device_t &device) { resolve(desc, device); }
+
+ // resolution
+ void resolve(const devcb_write8 &desc, device_t &device);
+
+ // override parent class' notion of NULL
+ bool isnull() const { return m_helper.null_indicator == &s_null; }
+
+private:
+ // internal helpers
+ void to_null(offs_t offset, UINT8 data);
+ void to_port(offs_t offset, UINT8 data);
+ void to_writeline(offs_t offset, UINT8 data);
+ void to_input(offs_t offset, UINT8 data);
+
+ // internal state
+ devcb_resolved_objects m_object;
+ devcb_resolved_write_helpers m_helper;
+ static UINT8 s_null;
+};
-/*-------------------------------------------------
- devcb_call_write8 - call through a
- resolved write8 handler
--------------------------------------------------*/
+// ======================> devcb_read16
-INLINE void devcb_call_write8(const devcb_resolved_write8 *resolved, offs_t offset, UINT8 data)
+// static structure used for device configuration when the desired callback type is a read16_device_func
+struct devcb_read16
{
- if (resolved->write != NULL)
- (*resolved->write)((device_t *)resolved->target, offset, data);
-}
+ UINT16 type; // one of the special DEVCB_TYPE values
+ UINT16 index; // index related to the above types
+ const char * tag; // tag of target, where appropriate
+ read_line_device_func readline; // read line function
+ read16_device_func readdevice; // read device function
+ read16_space_func readspace; // read space function
+};
-/*-------------------------------------------------
- devcb_call_write16 - call through a
- resolved write16 handler
--------------------------------------------------*/
+// ======================> devcb_resolved_read16
-INLINE void devcb_call_write16(const devcb_resolved_write16 *resolved, offs_t offset, UINT16 data)
+// class which wraps resolving a devcb_read16 into a delegate
+class devcb_resolved_read16 : public delegate<UINT16 (offs_t, UINT16)>
{
- if (resolved->write != NULL)
- (*resolved->write)((device_t *)resolved->target, offset, data, 0xffff);
-}
+ DISABLE_COPYING(devcb_resolved_read16);
+ typedef delegate<UINT16 (offs_t, UINT16)> base_delegate_t;
+
+public:
+ // construction/destruction
+ devcb_resolved_read16();
+ devcb_resolved_read16(const devcb_read16 &desc, device_t &device) { resolve(desc, device); }
+
+ // resolution
+ void resolve(const devcb_read16 &desc, device_t &device);
+
+ // override parent class' notion of NULL
+ bool isnull() const { return m_helper.null_indicator == &s_null; }
+
+private:
+ // internal helpers
+ UINT16 from_port(offs_t offset, UINT16 mask);
+ UINT16 from_readline(offs_t offset, UINT16 mask);
+ UINT16 from_constant(offs_t offset, UINT16 mask);
+
+ // internal state
+ devcb_resolved_objects m_object;
+ devcb_resolved_read_helpers m_helper;
+ static UINT8 s_null;
+};
-/*-------------------------------------------------
- devcb_line_gnd_r - input tied to GND
--------------------------------------------------*/
+// ======================> devcb_write16
-INLINE READ_LINE_DEVICE_HANDLER( devcb_line_gnd_r )
+// static structure used for device configuration when the desired callback type is a write16_device_func
+struct devcb_write16
{
- return 0;
-}
+ UINT16 type; // one of the special DEVCB_TYPE values
+ UINT16 index; // index related to the above types
+ const char * tag; // tag of target, where appropriate
+ write_line_device_func writeline; // write line function
+ write16_device_func writedevice; // write device function
+ write16_space_func writespace; // write space function
+};
-/*-------------------------------------------------
- devcb_line_vcc_r - input tied to Vcc
--------------------------------------------------*/
+// ======================> devcb_resolved_write16
-INLINE READ_LINE_DEVICE_HANDLER( devcb_line_vcc_r )
+// class which wraps resolving a devcb_write16 into a delegate
+class devcb_resolved_write16 : public delegate<void (offs_t, UINT16, UINT16)>
{
- return 1;
-}
+ DISABLE_COPYING(devcb_resolved_write16);
+ typedef delegate<void (offs_t, UINT16, UINT16)> base_delegate_t;
+
+public:
+ // construction/destruction
+ devcb_resolved_write16();
+ devcb_resolved_write16(const devcb_write16 &desc, device_t &device) { resolve(desc, device); }
+
+ // resolution
+ void resolve(const devcb_write16 &desc, device_t &device);
+
+ // override parent class' notion of NULL
+ bool isnull() const { return m_helper.null_indicator == &s_null; }
+
+private:
+ // internal helpers
+ void to_null(offs_t offset, UINT16 data, UINT16 mask);
+ void to_port(offs_t offset, UINT16 data, UINT16 mask);
+ void to_writeline(offs_t offset, UINT16 data, UINT16 mask);
+ void to_input(offs_t offset, UINT16 data, UINT16 mask);
+
+ // internal state
+ devcb_resolved_objects m_object;
+ devcb_resolved_write_helpers m_helper;
+ static UINT8 s_null;
+};
+
-#endif /* __DEVCB_H__ */
+#endif // __DEVCB_H__
diff --git a/src/emu/imagedev/flopdrv.c b/src/emu/imagedev/flopdrv.c
index 264255bddc6..6344a3f32ee 100644
--- a/src/emu/imagedev/flopdrv.c
+++ b/src/emu/imagedev/flopdrv.c
@@ -259,7 +259,7 @@ static void floppy_drive_index_func(device_t *img)
drive->index_timer->adjust(attotime::from_double(ms/20/1000.0));
}
- devcb_call_write_line(&drive->out_idx_func, drive->idx);
+ drive->out_idx_func(drive->idx);
if (drive->index_pulse_callback)
drive->index_pulse_callback(drive->controller, img, drive->idx);
@@ -298,7 +298,7 @@ void floppy_drive_set_flag_state(device_t *img, int flag, int state)
if (flag & FLOPPY_DRIVE_READY)
{
/* trigger state change callback */
- devcb_call_write_line(&drv->out_rdy_func, new_state ? ASSERT_LINE : CLEAR_LINE);
+ drv->out_rdy_func(new_state ? ASSERT_LINE : CLEAR_LINE);
if (drv->ready_state_change_callback)
drv->ready_state_change_callback(drv->controller, img, new_state);
@@ -382,11 +382,11 @@ void floppy_drive_seek(device_t *img, signed int signed_tracks)
/* set track 0 flag */
pDrive->tk00 = (pDrive->current_track == 0) ? CLEAR_LINE : ASSERT_LINE;
- devcb_call_write_line(&pDrive->out_tk00_func, pDrive->tk00);
+ pDrive->out_tk00_func(pDrive->tk00);
/* clear disk changed flag */
pDrive->dskchg = ASSERT_LINE;
- //devcb_call_write_line(&flopimg->out_dskchg_func, flopimg->dskchg);
+ //flopimg->out_dskchg_func(flopimg->dskchg);
/* inform disk image of step operation so it can cache information */
if (image->exists())
@@ -579,27 +579,27 @@ DEVICE_START( floppy )
floppy->active = FALSE;
/* resolve callbacks */
- devcb_resolve_write_line(&floppy->out_idx_func, &floppy->config->out_idx_func, device);
- devcb_resolve_read_line(&floppy->in_mon_func, &floppy->config->in_mon_func, device);
- devcb_resolve_write_line(&floppy->out_tk00_func, &floppy->config->out_tk00_func, device);
- devcb_resolve_write_line(&floppy->out_wpt_func, &floppy->config->out_wpt_func, device);
- devcb_resolve_write_line(&floppy->out_rdy_func, &floppy->config->out_rdy_func, device);
-// devcb_resolve_write_line(&floppy->out_dskchg_func, &floppy->config->out_dskchg_func, device);
+ floppy->out_idx_func.resolve(floppy->config->out_idx_func, *device);
+ floppy->in_mon_func.resolve(floppy->config->in_mon_func, *device);
+ floppy->out_tk00_func.resolve(floppy->config->out_tk00_func, *device);
+ floppy->out_wpt_func.resolve(floppy->config->out_wpt_func, *device);
+ floppy->out_rdy_func.resolve(floppy->config->out_rdy_func, *device);
+// floppy->out_dskchg_func.resolve(floppy->config->out_dskchg_func, *device);
/* by default we are not write-protected */
floppy->wpt = ASSERT_LINE;
- devcb_call_write_line(&floppy->out_wpt_func, floppy->wpt);
+ floppy->out_wpt_func(floppy->wpt);
/* not at track 0 */
floppy->tk00 = ASSERT_LINE;
- devcb_call_write_line(&floppy->out_tk00_func, floppy->tk00);
+ floppy->out_tk00_func(floppy->tk00);
/* motor off */
floppy->mon = ASSERT_LINE;
/* disk changed */
floppy->dskchg = CLEAR_LINE;
-// devcb_call_write_line(&floppy->out_dskchg_func, floppy->dskchg);
+// floppy->out_dskchg_func(floppy->dskchg);
}
static int internal_floppy_device_load(device_image_interface *image, int create_format, option_resolution *create_args)
@@ -655,7 +655,7 @@ static TIMER_CALLBACK( set_wpt )
floppy_drive *flopimg = (floppy_drive *)ptr;
flopimg->wpt = param;
- devcb_call_write_line(&flopimg->out_wpt_func, param);
+ flopimg->out_wpt_func(param);
}
DEVICE_IMAGE_LOAD( floppy )
@@ -671,7 +671,7 @@ DEVICE_IMAGE_LOAD( floppy )
/* push disk halfway into drive */
flopimg->wpt = CLEAR_LINE;
- devcb_call_write_line(&flopimg->out_wpt_func, flopimg->wpt);
+ flopimg->out_wpt_func(flopimg->wpt);
/* set timer for disk load */
int next_wpt;
@@ -702,11 +702,11 @@ DEVICE_IMAGE_UNLOAD( floppy )
/* disk changed */
flopimg->dskchg = CLEAR_LINE;
- //devcb_call_write_line(&flopimg->out_dskchg_func, flopimg->dskchg);
+ //flopimg->out_dskchg_func(flopimg->dskchg);
/* pull disk halfway out of drive */
flopimg->wpt = CLEAR_LINE;
- devcb_call_write_line(&flopimg->out_wpt_func, flopimg->wpt);
+ flopimg->out_wpt_func(flopimg->wpt);
/* set timer for disk eject */
image.device().machine().scheduler().timer_set(attotime::from_msec(250), FUNC(set_wpt), ASSERT_LINE, flopimg);
@@ -897,7 +897,7 @@ WRITE_LINE_DEVICE_HANDLER( floppy_stp_w )
}
/* update track 0 line with new status */
- devcb_call_write_line(&drive->out_tk00_func, drive->tk00);
+ drive->out_tk00_func(drive->tk00);
}
drive->stp = state;
diff --git a/src/emu/machine/6522via.c b/src/emu/machine/6522via.c
index c753fb1e551..1b3f89f0d3b 100644
--- a/src/emu/machine/6522via.c
+++ b/src/emu/machine/6522via.c
@@ -193,19 +193,19 @@ void via6522_device::device_config_complete()
void via6522_device::device_start()
{
- devcb_resolve_read8(&m_in_a_func, &m_in_a_cb, this);
- devcb_resolve_read8(&m_in_b_func, &m_in_b_cb, this);
- devcb_resolve_read_line(&m_in_ca1_func, &m_in_ca1_cb, this);
- devcb_resolve_read_line(&m_in_cb1_func, &m_in_cb1_cb, this);
- devcb_resolve_read_line(&m_in_ca2_func, &m_in_ca2_cb, this);
- devcb_resolve_read_line(&m_in_cb2_func, &m_in_cb2_cb, this);
- devcb_resolve_write8(&m_out_a_func, &m_out_a_cb, this);
- devcb_resolve_write8(&m_out_b_func, &m_out_b_cb, this);
- devcb_resolve_write_line(&m_out_ca1_func, &m_out_ca1_cb, this);
- devcb_resolve_write_line(&m_out_cb1_func, &m_out_cb1_cb, this);
- devcb_resolve_write_line(&m_out_ca2_func, &m_out_ca2_cb, this);
- devcb_resolve_write_line(&m_out_cb2_func, &m_out_cb2_cb, this);
- devcb_resolve_write_line(&m_irq_func, &m_irq_cb, this);
+ m_in_a_func.resolve(m_in_a_cb, *this);
+ m_in_b_func.resolve(m_in_b_cb, *this);
+ m_in_ca1_func.resolve(m_in_ca1_cb, *this);
+ m_in_cb1_func.resolve(m_in_cb1_cb, *this);
+ m_in_ca2_func.resolve(m_in_ca2_cb, *this);
+ m_in_cb2_func.resolve(m_in_cb2_cb, *this);
+ m_out_a_func.resolve(m_out_a_cb, *this);
+ m_out_b_func.resolve(m_out_b_cb, *this);
+ m_out_ca1_func.resolve(m_out_ca1_cb, *this);
+ m_out_cb1_func.resolve(m_out_cb1_cb, *this);
+ m_out_ca2_func.resolve(m_out_ca2_cb, *this);
+ m_out_cb2_func.resolve(m_out_cb2_cb, *this);
+ m_irq_func.resolve(m_irq_cb, *this);
m_t1ll = 0xf3; /* via at 0x9110 in vic20 show these values */
m_t1lh = 0xb5; /* ports are not written by kernel! */
@@ -304,7 +304,7 @@ void via6522_device::set_int(int data)
if (m_ier & m_ifr)
{
m_ifr |= INT_ANY;
- devcb_call_write_line(&m_irq_func, ASSERT_LINE);
+ m_irq_func(ASSERT_LINE);
}
}
@@ -328,7 +328,7 @@ void via6522_device::clear_int(int data)
}
else
{
- devcb_call_write_line(&m_irq_func, CLEAR_LINE);
+ m_irq_func(CLEAR_LINE);
}
}
@@ -344,13 +344,13 @@ void via6522_device::shift()
m_out_cb2 = (m_sr >> 7) & 1;
m_sr = (m_sr << 1) | m_out_cb2;
- devcb_call_write_line(&m_out_cb2_func, m_out_cb2);
+ m_out_cb2_func(m_out_cb2);
m_in_cb1=1;
/* this should be one cycle wide */
- devcb_call_write_line(&m_out_cb1_func, 0);
- devcb_call_write_line(&m_out_cb1_func, 1);
+ m_out_cb1_func(0);
+ m_out_cb1_func(1);
m_shift_counter = (m_shift_counter + 1) % 8;
@@ -375,7 +375,7 @@ void via6522_device::shift()
m_out_cb2 = (m_sr >> 7) & 1;
m_sr = (m_sr << 1) | m_out_cb2;
- devcb_call_write_line(&m_out_cb2_func, m_out_cb2);
+ m_out_cb2_func(m_out_cb2);
m_shift_counter = (m_shift_counter + 1) % 8;
@@ -389,9 +389,9 @@ void via6522_device::shift()
}
if (SI_EXT_CONTROL(m_acr))
{
- if (m_in_cb2_func.read != NULL)
+ if (!m_in_cb2_func.isnull())
{
- m_in_cb2 = devcb_call_read_line(&m_in_cb2_func);
+ m_in_cb2 = m_in_cb2_func();
}
m_sr = (m_sr << 1) | (m_in_cb2 & 1);
@@ -440,7 +440,7 @@ void via6522_device::device_timer(emu_timer &timer, device_timer_id id, int para
if (m_ddr_b)
{
UINT8 write_data = (m_out_b & m_ddr_b) | (m_ddr_b ^ 0xff);
- devcb_call_write8(&m_out_b_func, 0, write_data);
+ m_out_b_func(0, write_data);
}
if (!(m_ifr & INT_T1))
@@ -480,9 +480,9 @@ READ8_MEMBER( via6522_device::read )
{
if (m_ddr_b != 0xff)
{
- if (m_in_b_func.read != NULL)
+ if (!m_in_b_func.isnull())
{
- m_in_b = devcb_call_read8(&m_in_b_func, 0);
+ m_in_b = m_in_b_func(0);
}
else
{
@@ -510,9 +510,9 @@ READ8_MEMBER( via6522_device::read )
{
if (m_ddr_a != 0xff)
{
- if (m_in_a_func.read != NULL)
+ if (!m_in_a_func.isnull())
{
- m_in_a = devcb_call_read8(&m_in_a_func, 0);
+ m_in_a = m_in_a_func(0);
}
else
{
@@ -536,7 +536,7 @@ READ8_MEMBER( via6522_device::read )
m_out_ca2 = 0;
/* call the CA2 output function */
- devcb_call_write_line(&m_out_ca2_func, 0);
+ m_out_ca2_func(0);
}
}
@@ -546,9 +546,9 @@ READ8_MEMBER( via6522_device::read )
/* update the input */
if (PA_LATCH_ENABLE(m_acr) == 0)
{
- if (m_in_a_func.read != NULL)
+ if (!m_in_a_func.isnull())
{
- m_in_a = devcb_call_read8(&m_in_a_func, 0);
+ m_in_a = m_in_a_func(0);
}
else
{
@@ -675,7 +675,7 @@ WRITE8_MEMBER( via6522_device::write )
if (m_ddr_b)
{
UINT8 write_data = (m_out_b & m_ddr_b) | (m_ddr_b ^ 0xff);
- devcb_call_write8(&m_out_b_func, 0, write_data);
+ m_out_b_func(0, write_data);
}
CLR_PB_INT();
@@ -690,7 +690,7 @@ WRITE8_MEMBER( via6522_device::write )
m_out_cb2 = 0;
/* call the CB2 output function */
- devcb_call_write_line(&m_out_cb2_func, 0);
+ m_out_cb2_func(0);
}
}
break;
@@ -701,7 +701,7 @@ WRITE8_MEMBER( via6522_device::write )
if (m_ddr_a)
{
UINT8 write_data = (m_out_a & m_ddr_a) | (m_ddr_a ^ 0xff);
- devcb_call_write8(&m_out_a_func, 0, write_data);
+ m_out_a_func(0, write_data);
}
CLR_PA_INT();
@@ -711,8 +711,8 @@ WRITE8_MEMBER( via6522_device::write )
if (CA2_PULSE_OUTPUT(m_pcr))
{
/* call the CA2 output function */
- devcb_call_write_line(&m_out_ca2_func, 0);
- devcb_call_write_line(&m_out_ca2_func, 1);
+ m_out_ca2_func(0);
+ m_out_ca2_func(1);
/* set CA2 (shouldn't be needed) */
m_out_ca2 = 1;
@@ -725,7 +725,7 @@ WRITE8_MEMBER( via6522_device::write )
m_out_ca2 = 0;
/* call the CA2 output function */
- devcb_call_write_line(&m_out_ca2_func, 0);
+ m_out_ca2_func(0);
}
}
@@ -737,7 +737,7 @@ WRITE8_MEMBER( via6522_device::write )
if (m_ddr_a)
{
UINT8 write_data = (m_out_a & m_ddr_a) | (m_ddr_a ^ 0xff);
- devcb_call_write8(&m_out_a_func, 0, write_data);
+ m_out_a_func(0, write_data);
}
break;
@@ -751,7 +751,7 @@ WRITE8_MEMBER( via6522_device::write )
//if (m_ddr_b)
{
UINT8 write_data = (m_out_b & m_ddr_b) | (m_ddr_b ^ 0xff);
- devcb_call_write8(&m_out_b_func, 0, write_data);
+ m_out_b_func(0, write_data);
}
}
break;
@@ -765,7 +765,7 @@ WRITE8_MEMBER( via6522_device::write )
//if (m_ddr_a)
{
UINT8 write_data = (m_out_a & m_ddr_a) | (m_ddr_a ^ 0xff);
- devcb_call_write8(&m_out_a_func, 0, write_data);
+ m_out_a_func(0, write_data);
}
}
break;
@@ -793,7 +793,7 @@ WRITE8_MEMBER( via6522_device::write )
//if (m_ddr_b)
{
UINT8 write_data = (m_out_b & m_ddr_b) | (m_ddr_b ^ 0xff);
- devcb_call_write8(&m_out_b_func, 0, write_data);
+ m_out_b_func(0, write_data);
}
}
m_t1->adjust(cycles_to_time(TIMER1_VALUE + IFR_DELAY));
@@ -848,13 +848,13 @@ WRITE8_MEMBER( via6522_device::write )
if (CA2_FIX_OUTPUT(data) && CA2_OUTPUT_LEVEL(data) ^ m_out_ca2)
{
m_out_ca2 = CA2_OUTPUT_LEVEL(data);
- devcb_call_write_line(&m_out_ca2_func, m_out_ca2);
+ m_out_ca2_func(m_out_ca2);
}
if (CB2_FIX_OUTPUT(data) && CB2_OUTPUT_LEVEL(data) ^ m_out_cb2)
{
m_out_cb2 = CB2_OUTPUT_LEVEL(data);
- devcb_call_write_line(&m_out_cb2_func, m_out_cb2);
+ m_out_cb2_func(m_out_cb2);
}
break;
@@ -876,7 +876,7 @@ WRITE8_MEMBER( via6522_device::write )
//if (m_ddr_b)
{
UINT8 write_data = (m_out_b & m_ddr_b) | (m_ddr_b ^ 0xff);
- devcb_call_write8(&m_out_b_func, 0, write_data);
+ m_out_b_func(0, write_data);
}
}
if (T1_CONTINUOUS(data))
@@ -902,7 +902,7 @@ WRITE8_MEMBER( via6522_device::write )
if (((m_ifr & m_ier) & 0x7f) == 0)
{
m_ifr &= ~INT_ANY;
- devcb_call_write_line(&m_irq_func, CLEAR_LINE);
+ m_irq_func(CLEAR_LINE);
}
}
else
@@ -910,7 +910,7 @@ WRITE8_MEMBER( via6522_device::write )
if ((m_ier & m_ifr) & 0x7f)
{
m_ifr |= INT_ANY;
- devcb_call_write_line(&m_irq_func, ASSERT_LINE);
+ m_irq_func(ASSERT_LINE);
}
}
break;
@@ -942,9 +942,9 @@ WRITE_LINE_MEMBER( via6522_device::write_ca1 )
{
if (PA_LATCH_ENABLE(m_acr))
{
- if (m_in_a_func.read != NULL)
+ if (!m_in_a_func.isnull())
{
- m_in_a = devcb_call_read8(&m_in_a_func, 0);
+ m_in_a = m_in_a_func(0);
}
else
{
@@ -964,7 +964,7 @@ WRITE_LINE_MEMBER( via6522_device::write_ca1 )
m_out_ca2 = 1;
/* call the CA2 output function */
- devcb_call_write_line(&m_out_ca2_func, 1);
+ m_out_ca2_func(1);
}
}
}
@@ -1012,9 +1012,9 @@ WRITE_LINE_MEMBER( via6522_device::write_cb1 )
{
if (PB_LATCH_ENABLE(m_acr))
{
- if (m_in_b_func.read != NULL)
+ if (!m_in_b_func.isnull())
{
- m_in_b = devcb_call_read8(&m_in_b_func, 0);
+ m_in_b = m_in_b_func(0);
}
else
{
@@ -1038,7 +1038,7 @@ WRITE_LINE_MEMBER( via6522_device::write_cb1 )
m_out_cb2 = 1;
/* call the CB2 output function */
- devcb_call_write_line(&m_out_cb2_func, 1);
+ m_out_cb2_func(1);
}
}
}
diff --git a/src/emu/machine/6526cia.c b/src/emu/machine/6526cia.c
index 3b0066d5f53..e1bf6c5477f 100644
--- a/src/emu/machine/6526cia.c
+++ b/src/emu/machine/6526cia.c
@@ -156,17 +156,17 @@ void mos6526_device::device_config_complete()
void mos6526_device::device_start()
{
/* clear out CIA structure, and copy the interface */
- devcb_resolve_write_line(&m_out_irq_func, &m_out_irq_cb, this);
- devcb_resolve_write_line(&m_out_pc_func, &m_out_pc_cb, this);
- devcb_resolve_write_line(&m_out_cnt_func, &m_out_cnt_cb, this);
- devcb_resolve_write_line(&m_out_sp_func, &m_out_sp_cb, this);
+ m_out_irq_func.resolve(m_out_irq_cb, *this);
+ m_out_pc_func.resolve(m_out_pc_cb, *this);
+ m_out_cnt_func.resolve(m_out_cnt_cb, *this);
+ m_out_sp_func.resolve(m_out_sp_cb, *this);
m_flag = 1;
/* setup ports */
- devcb_resolve_read8(&m_port[0].m_read, &m_in_pa_cb, this);
- devcb_resolve_write8(&m_port[0].m_write, &m_out_pa_cb, this);
- devcb_resolve_read8(&m_port[1].m_read, &m_in_pb_cb, this);
- devcb_resolve_write8(&m_port[1].m_write, &m_out_pb_cb, this);
+ m_port[0].m_read.resolve(m_in_pa_cb, *this);
+ m_port[0].m_write.resolve(m_out_pa_cb, *this);
+ m_port[1].m_read.resolve(m_in_pb_cb, *this);
+ m_port[1].m_write.resolve(m_out_pb_cb, *this);
for (int p = 0; p < (sizeof(m_port) / sizeof(m_port[0])); p++)
{
@@ -241,8 +241,8 @@ void mos6526_device::set_port_mask_value(int port, int data)
void mos6526_device::update_pc()
{
/* this should really be one cycle long */
- devcb_call_write_line(&m_out_pc_func, 0);
- devcb_call_write_line(&m_out_pc_func, 1);
+ m_out_pc_func(0);
+ m_out_pc_func(1);
}
/*-------------------------------------------------
@@ -268,7 +268,7 @@ void mos6526_device::update_interrupts()
if (m_irq != new_irq)
{
m_irq = new_irq;
- devcb_call_write_line(&m_out_irq_func, m_irq);
+ m_out_irq_func(m_irq);
}
}
@@ -341,11 +341,11 @@ void mos6526_device::timer_underflow(int timer)
/* transmit MSB */
m_sp = BIT(m_serial, 7);
- devcb_call_write_line(&m_out_sp_func, m_sp);
+ m_out_sp_func(m_sp);
/* toggle CNT */
m_cnt = !m_cnt;
- devcb_call_write_line(&m_out_cnt_func, m_cnt);
+ m_out_cnt_func(m_cnt);
/* shift data */
m_serial <<= 1;
@@ -362,7 +362,7 @@ void mos6526_device::timer_underflow(int timer)
{
/* toggle CNT */
m_cnt = !m_cnt;
- devcb_call_write_line(&m_out_cnt_func, m_cnt);
+ m_out_cnt_func(m_cnt);
if (m_shift == 8)
{
@@ -562,7 +562,7 @@ UINT8 mos6526_device::reg_r(UINT8 offset)
case CIA_PRA:
case CIA_PRB:
port = &m_port[offset & 1];
- data = devcb_call_read8(&port->m_read, 0);
+ data = port->m_read(0);
data = ((data & ~port->m_ddr) | (port->m_latch & port->m_ddr)) & port->m_mask_value;
port->m_in = data;
@@ -702,7 +702,7 @@ void mos6526_device::reg_w(UINT8 offset, UINT8 data)
port = &m_port[offset & 1];
port->m_latch = data;
port->m_out = (data & port->m_ddr) | (port->m_in & ~port->m_ddr);
- devcb_call_write8(&port->m_write, 0, port->m_out);
+ port->m_write(0, port->m_out);
/* pulse /PC following the write */
if (offset == CIA_PRB)
diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c
index a5e239599cd..1e0b0897455 100644
--- a/src/emu/machine/6532riot.c
+++ b/src/emu/machine/6532riot.c
@@ -48,9 +48,9 @@ void riot6532_device::update_irqstate()
{
int state = (m_irqstate & m_irqenable);
- if (m_irq_func.write != NULL)
+ if (!m_irq_func.isnull())
{
- devcb_call_write_line(&m_irq_func, (state != 0) ? ASSERT_LINE : CLEAR_LINE);
+ m_irq_func((state != 0) ? ASSERT_LINE : CLEAR_LINE);
}
else
{
@@ -229,9 +229,9 @@ void riot6532_device::reg_w(UINT8 offset, UINT8 data)
else
{
port->m_out = data;
- if (port->m_out_func.write != NULL)
+ if (!port->m_out_func.isnull())
{
- devcb_call_write8(&port->m_out_func, 0, data);
+ port->m_out_func(0, data);
}
else
{
@@ -311,9 +311,9 @@ UINT8 riot6532_device::reg_r(UINT8 offset)
else
{
/* call the input callback if it exists */
- if (port->m_in_func.read != NULL)
+ if (!port->m_in_func.isnull())
{
- port->m_in = devcb_call_read8(&port->m_in_func, 0);
+ port->m_in = port->m_in_func(0);
/* changes to port A need to update the PA7 state */
if (port == &m_port[0])
@@ -485,13 +485,13 @@ void riot6532_device::device_start()
m_index = machine().devicelist().indexof(RIOT6532, tag());
/* configure the ports */
- devcb_resolve_read8(&m_port[0].m_in_func, &m_in_a_cb, this);
- devcb_resolve_write8(&m_port[0].m_out_func, &m_out_a_cb, this);
- devcb_resolve_read8(&m_port[1].m_in_func, &m_in_b_cb, this);
- devcb_resolve_write8(&m_port[1].m_out_func, &m_out_b_cb, this);
+ m_port[0].m_in_func.resolve(m_in_a_cb, *this);
+ m_port[0].m_out_func.resolve(m_out_a_cb, *this);
+ m_port[1].m_in_func.resolve(m_in_b_cb, *this);
+ m_port[1].m_out_func.resolve(m_out_b_cb, *this);
/* resolve irq func */
- devcb_resolve_write_line(&m_irq_func, &m_irq_cb, this);
+ m_irq_func.resolve(m_irq_cb, *this);
/* allocate timers */
m_timer = machine().scheduler().timer_alloc(FUNC(timer_end_callback), (void *)this);
diff --git a/src/emu/machine/6821pia.c b/src/emu/machine/6821pia.c
index b03b28ddddc..a45bc27d077 100644
--- a/src/emu/machine/6821pia.c
+++ b/src/emu/machine/6821pia.c
@@ -95,18 +95,18 @@ void pia6821_device::device_config_complete()
void pia6821_device::device_start()
{
/* resolve callbacks */
- devcb_resolve_read8(&m_in_a_func, &m_in_a_cb, this);
- devcb_resolve_read8(&m_in_b_func, &m_in_b_cb, this);
- devcb_resolve_read_line(&m_in_ca1_func, &m_in_ca1_cb, this);
- devcb_resolve_read_line(&m_in_cb1_func, &m_in_cb1_cb, this);
- devcb_resolve_read_line(&m_in_ca2_func, &m_in_ca2_cb, this);
- devcb_resolve_read_line(&m_in_cb2_func, &m_in_cb2_cb, this);
- devcb_resolve_write8(&m_out_a_func, &m_out_a_cb, this);
- devcb_resolve_write8(&m_out_b_func, &m_out_b_cb, this);
- devcb_resolve_write_line(&m_out_ca2_func, &m_out_ca2_cb, this);
- devcb_resolve_write_line(&m_out_cb2_func, &m_out_cb2_cb, this);
- devcb_resolve_write_line(&m_irq_a_func, &m_irq_a_cb, this);
- devcb_resolve_write_line(&m_irq_b_func, &m_irq_b_cb, this);
+ m_in_a_func.resolve(m_in_a_cb, *this);
+ m_in_b_func.resolve(m_in_b_cb, *this);
+ m_in_ca1_func.resolve(m_in_ca1_cb, *this);
+ m_in_cb1_func.resolve(m_in_cb1_cb, *this);
+ m_in_ca2_func.resolve(m_in_ca2_cb, *this);
+ m_in_cb2_func.resolve(m_in_cb2_cb, *this);
+ m_out_a_func.resolve(m_out_a_cb, *this);
+ m_out_b_func.resolve(m_out_b_cb, *this);
+ m_out_ca2_func.resolve(m_out_ca2_cb, *this);
+ m_out_cb2_func.resolve(m_out_cb2_cb, *this);
+ m_irq_a_func.resolve(m_irq_a_cb, *this);
+ m_irq_b_func.resolve(m_irq_b_cb, *this);
save_item(NAME(m_in_a));
save_item(NAME(m_in_ca1));
@@ -196,8 +196,8 @@ void pia6821_device::device_reset()
/* clear the IRQs */
- devcb_call_write_line(&m_irq_a_func, FALSE);
- devcb_call_write_line(&m_irq_b_func, FALSE);
+ m_irq_a_func(FALSE);
+ m_irq_b_func(FALSE);
}
@@ -213,7 +213,7 @@ void pia6821_device::update_interrupts()
if (new_state != m_irq_a_state)
{
m_irq_a_state = new_state;
- devcb_call_write_line(&m_irq_a_func, m_irq_a_state);
+ m_irq_a_func(m_irq_a_state);
}
/* then do IRQ B */
@@ -222,7 +222,7 @@ void pia6821_device::update_interrupts()
if (new_state != m_irq_b_state)
{
m_irq_b_state = new_state;
- devcb_call_write_line(&m_irq_b_func, m_irq_b_state);
+ m_irq_b_func(m_irq_b_state);
}
}
@@ -237,9 +237,9 @@ UINT8 pia6821_device::get_in_a_value()
UINT8 ret;
/* update the input */
- if (m_in_a_func.read != NULL)
+ if (!m_in_a_func.isnull())
{
- port_a_data = devcb_call_read8(&m_in_a_func, 0);
+ port_a_data = m_in_a_func(0);
}
else
{
@@ -289,9 +289,9 @@ UINT8 pia6821_device::get_in_b_value()
UINT8 port_b_data;
/* update the input */
- if (m_in_b_func.read != NULL)
+ if (!m_in_b_func.isnull())
{
- port_b_data = devcb_call_read8(&m_in_b_func, 0);
+ port_b_data = m_in_b_func(0);
}
else
{
@@ -365,9 +365,9 @@ void pia6821_device::set_out_ca2(int data)
m_out_ca2 = data;
/* send to output function */
- if (m_out_ca2_func.write)
+ if (!m_out_ca2_func.isnull())
{
- devcb_call_write_line(&m_out_ca2_func, m_out_ca2);
+ m_out_ca2_func(m_out_ca2);
}
else
{
@@ -396,9 +396,9 @@ void pia6821_device::set_out_cb2(int data)
m_last_out_cb2_z = z;
/* send to output function */
- if (m_out_cb2_func.write)
+ if (!m_out_cb2_func.isnull())
{
- devcb_call_write_line(&m_out_cb2_func, m_out_cb2);
+ m_out_cb2_func(m_out_cb2);
}
else
{
@@ -510,9 +510,9 @@ UINT8 pia6821_device::control_a_r()
UINT8 ret;
/* update CA1 & CA2 if callback exists, these in turn may update IRQ's */
- if (m_in_ca1_func.read != NULL)
+ if (!m_in_ca1_func.isnull())
{
- ca1_w(devcb_call_read_line(&m_in_ca1_func));
+ ca1_w(m_in_ca1_func());
}
else if(!m_logged_ca1_not_connected && (!m_in_ca1_pushed))
{
@@ -520,9 +520,9 @@ UINT8 pia6821_device::control_a_r()
m_logged_ca1_not_connected = TRUE;
}
- if (m_in_ca2_func.read != NULL)
+ if (!m_in_ca2_func.isnull())
{
- ca2_w(devcb_call_read_line(&m_in_ca2_func));
+ ca2_w(m_in_ca2_func());
}
else if ( !m_logged_ca2_not_connected && C2_INPUT(m_ctl_a) && !m_in_ca2_pushed)
{
@@ -559,9 +559,9 @@ UINT8 pia6821_device::control_b_r()
UINT8 ret;
/* update CB1 & CB2 if callback exists, these in turn may update IRQ's */
- if(m_in_cb1_func.read != NULL)
+ if(!m_in_cb1_func.isnull())
{
- cb1_w(devcb_call_read_line(&m_in_cb1_func));
+ cb1_w(m_in_cb1_func());
}
else if(!m_logged_cb1_not_connected && !m_in_cb1_pushed)
{
@@ -569,9 +569,9 @@ UINT8 pia6821_device::control_b_r()
m_logged_cb1_not_connected = TRUE;
}
- if(m_in_cb2_func.read != NULL)
+ if(!m_in_cb2_func.isnull())
{
- cb2_w(devcb_call_read_line(&m_in_cb2_func));
+ cb2_w(m_in_cb2_func());
}
else if(!m_logged_cb2_not_connected && C2_INPUT(m_ctl_b) && !m_in_cb2_pushed)
{
@@ -687,9 +687,9 @@ void pia6821_device::send_to_out_a_func(const char* message)
LOG(("PIA #%s: %s = %02X\n", tag(), message, data));
- if(m_out_a_func.write != NULL)
+ if(!m_out_a_func.isnull())
{
- devcb_call_write8(&m_out_a_func, 0, data);
+ m_out_a_func(0, data);
}
else
{
@@ -714,9 +714,9 @@ void pia6821_device::send_to_out_b_func(const char* message)
LOG(("PIA #%s: %s = %02X\n", tag(), message, data));
- if(m_out_b_func.write != NULL)
+ if(!m_out_b_func.isnull())
{
- devcb_call_write8(&m_out_b_func, 0, data);
+ m_out_b_func(0, data);
}
else
{
@@ -997,7 +997,7 @@ void pia6821_set_input_a(device_t *device, UINT8 data, UINT8 z_mask)
void pia6821_device::set_input_a(UINT8 data, UINT8 z_mask)
{
- assert_always(m_in_a_func.read == NULL, "pia6821_porta_w() called when in_a_func implemented");
+ assert_always(m_in_a_func.isnull(), "pia6821_porta_w() called when in_a_func implemented");
LOG(("PIA #%s: set input port A = %02X\n", tag(), data));
@@ -1201,7 +1201,7 @@ WRITE8_DEVICE_HANDLER( pia6821_portb_w )
void pia6821_device::portb_w(UINT8 data)
{
- assert_always(m_in_b_func.read == NULL, "pia_set_input_b() called when in_b_func implemented");
+ assert_always(m_in_b_func.isnull(), "pia_set_input_b() called when in_b_func implemented");
LOG(("PIA #%s: set input port B = %02X\n", tag(), data));
diff --git a/src/emu/machine/6840ptm.c b/src/emu/machine/6840ptm.c
index 41547ca1e13..dcc32e99f22 100644
--- a/src/emu/machine/6840ptm.c
+++ b/src/emu/machine/6840ptm.c
@@ -114,7 +114,7 @@ void ptm6840_device::device_start()
/* resolve callbacks */
for (int i = 0; i < 3; i++)
{
- devcb_resolve_write8(&m_out_func[i], &m_out_cb[i], this);
+ m_out_func[i].resolve(m_out_cb[i], *this);
}
for (int i = 0; i < 3; i++)
@@ -139,7 +139,7 @@ void ptm6840_device::device_start()
m_timer[i]->enable(false);
}
- devcb_resolve_write_line(&m_irq_func, &m_irq_cb, this);
+ m_irq_func.resolve(m_irq_cb, *this);
/* register for state saving */
save_item(NAME(m_lsb_buffer));
@@ -355,7 +355,7 @@ void ptm6840_device::update_interrupts()
m_status_reg &= ~0x80;
}
- devcb_call_write_line(&m_irq_func, m_IRQ);
+ m_irq_func(m_IRQ);
}
}
@@ -443,9 +443,9 @@ void ptm6840_device::reload_count(int idx)
if ((m_mode[idx] == 4) || (m_mode[idx] == 6))
{
m_output[idx] = 1;
- if (m_out_func[idx].write != NULL)
+ if (!m_out_func[idx].isnull())
{
- devcb_call_write8(&m_out_func[idx], 0, m_output[idx]);
+ m_out_func[idx](0, m_output[idx]);
}
}
@@ -569,7 +569,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ptm6840, ptm6840_write)
if (!(m_control_reg[idx] & 0x80 ))
{
/* Output cleared */
- devcb_call_write8(&m_out_func[idx], 0, 0);
+ m_out_func[idx](0, 0);
}
/* Reset? */
if (idx == 0 && (diffs & 0x01))
@@ -658,7 +658,7 @@ void ptm6840_device::ptm6840_timeout(int idx)
m_output[idx] = m_output[idx] ? 0 : 1;
PLOG(("**ptm6840 %s t%d output %d **\n", tag(), idx + 1, m_output[idx]));
- devcb_call_write8(&m_out_func[idx], 0, m_output[idx]);
+ m_out_func[idx](0, m_output[idx]);
}
if ((m_mode[idx] == 4)||(m_mode[idx] == 6))
{
@@ -667,7 +667,7 @@ void ptm6840_device::ptm6840_timeout(int idx)
m_output[idx] = 1;
PLOG(("**ptm6840 %s t%d output %d **\n", tag(), idx + 1, m_output[idx]));
- devcb_call_write8(&m_out_func[idx], 0, m_output[idx]);
+ m_out_func[idx](0, m_output[idx]);
/* No changes in output until reinit */
m_fired[idx] = 1;
diff --git a/src/emu/machine/6850acia.c b/src/emu/machine/6850acia.c
index 7b51907a3a6..f3288221a30 100644
--- a/src/emu/machine/6850acia.c
+++ b/src/emu/machine/6850acia.c
@@ -23,10 +23,10 @@
#define CR7 0x80
#define TXD(_data) \
- devcb_call_write_line(&m_out_tx_func, _data)
+ m_out_tx_func(_data)
#define RTS(_data) \
- devcb_call_write_line(&m_out_rts_func, _data)
+ m_out_rts_func(_data)
/***************************************************************************
LOCAL VARIABLES
@@ -103,12 +103,12 @@ void acia6850_device::device_config_complete()
void acia6850_device::device_start()
{
/* resolve callbacks */
- devcb_resolve_read_line(&m_in_rx_func, &m_in_rx_cb, this);
- devcb_resolve_write_line(&m_out_tx_func, &m_out_tx_cb, this);
- devcb_resolve_read_line(&m_in_cts_func, &m_in_cts_cb, this);
- devcb_resolve_write_line(&m_out_rts_func, &m_out_rts_cb, this);
- devcb_resolve_read_line(&m_in_dcd_func, &m_in_dcd_cb, this);
- devcb_resolve_write_line(&m_out_irq_func, &m_out_irq_cb, this);
+ m_in_rx_func.resolve(m_in_rx_cb, *this);
+ m_out_tx_func.resolve(m_out_tx_cb, *this);
+ m_in_cts_func.resolve(m_in_cts_cb, *this);
+ m_out_rts_func.resolve(m_out_rts_cb, *this);
+ m_in_dcd_func.resolve(m_in_dcd_cb, *this);
+ m_out_irq_func.resolve(m_out_irq_cb, *this);
m_tx_counter = 0;
m_rx_counter = 0;
@@ -153,8 +153,8 @@ void acia6850_device::device_start()
void acia6850_device::device_reset()
{
- int cts = devcb_call_read_line(&m_in_cts_func);
- int dcd = devcb_call_read_line(&m_in_dcd_func);
+ int cts = m_in_cts_func();
+ int dcd = m_in_dcd_func();
m_status = (cts << 3) | (dcd << 2) | ACIA6850_STATUS_TDRE;
m_tdr = 0;
@@ -173,7 +173,7 @@ void acia6850_device::device_reset()
m_tx_state = START;
m_irq = 0;
- devcb_call_write_line(&m_out_irq_func, 1);
+ m_out_irq_func(1);
if (m_first_reset)
{
@@ -318,12 +318,12 @@ void acia6850_device::check_interrupts()
if (irq)
{
m_status |= ACIA6850_STATUS_IRQ;
- devcb_call_write_line(&m_out_irq_func, 0);
+ m_out_irq_func(0);
}
else
{
m_status &= ~ACIA6850_STATUS_IRQ;
- devcb_call_write_line(&m_out_irq_func, 1);
+ m_out_irq_func(1);
}
}
}
@@ -360,7 +360,7 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(acia6850, acia6850_data_r)
if (m_status_read)
{
- int dcd = devcb_call_read_line(&m_in_dcd_func);
+ int dcd = m_in_dcd_func();
m_status_read = 0;
m_status &= ~(ACIA6850_STATUS_OVRN | ACIA6850_STATUS_DCD);
@@ -401,7 +401,7 @@ void acia6850_device::tx_tick()
}
else
{
- int _cts = devcb_call_read_line(&m_in_cts_func);
+ int _cts = m_in_cts_func();
if (_cts)
{
@@ -520,7 +520,7 @@ void acia6850_tx_clock_in(device_t *device) { downcast<acia6850_device*>(device)
void acia6850_device::tx_clock_in()
{
- int _cts = devcb_call_read_line(&m_in_cts_func);
+ int _cts = m_in_cts_func();
if (_cts)
{
@@ -548,7 +548,7 @@ void acia6850_device::tx_clock_in()
void acia6850_device::rx_tick()
{
- int dcd = devcb_call_read_line(&m_in_dcd_func);
+ int dcd = m_in_dcd_func();
if (dcd)
{
@@ -566,7 +566,7 @@ void acia6850_device::rx_tick()
}
else
{
- int rxd = devcb_call_read_line(&m_in_rx_func);
+ int rxd = m_in_rx_func();
switch (m_rx_state)
{
@@ -709,7 +709,7 @@ void acia6850_rx_clock_in(device_t *device) { downcast<acia6850_device*>(device)
void acia6850_device::rx_clock_in()
{
- int dcd = devcb_call_read_line(&m_in_dcd_func);
+ int dcd = m_in_dcd_func();
if (dcd)
{
diff --git a/src/emu/machine/7474.c b/src/emu/machine/7474.c
index 2bcacf7bce5..e66a7f726f5 100644
--- a/src/emu/machine/7474.c
+++ b/src/emu/machine/7474.c
@@ -124,8 +124,8 @@ void ttl7474_device::device_start()
save_item(NAME(m_last_output));
save_item(NAME(m_last_output_comp));
- devcb_resolve_write_line(&m_output_func, &m_output_cb, this);
- devcb_resolve_write_line(&m_comp_output_func, &m_comp_output_cb, this);
+ m_output_func.resolve(m_output_cb, *this);
+ m_comp_output_func.resolve(m_comp_output_cb, *this);
}
//-------------------------------------------------
@@ -172,13 +172,13 @@ void ttl7474_device::update()
if (m_output != m_last_output)
{
m_last_output = m_output;
- devcb_call_write_line(&m_output_func, m_output);
+ m_output_func(m_output);
}
/* call callback if any of the outputs changed */
if (m_output_comp != m_last_output_comp)
{
m_last_output_comp = m_output_comp;
- devcb_call_write_line(&m_comp_output_func, m_output_comp);
+ m_comp_output_func(m_output_comp);
}
}
diff --git a/src/emu/machine/8237dma.c b/src/emu/machine/8237dma.c
index 3537fd832ec..c49650987e7 100644
--- a/src/emu/machine/8237dma.c
+++ b/src/emu/machine/8237dma.c
@@ -105,16 +105,16 @@ void i8237_device::device_config_complete()
void i8237_device::device_start()
{
/* resolve callbacks */
- devcb_resolve_write_line(&m_out_hrq_func, &m_out_hrq_cb, this);
- devcb_resolve_write_line(&m_out_eop_func, &m_out_eop_cb, this);
- devcb_resolve_read8(&m_in_memr_func, &m_in_memr_cb, this);
- devcb_resolve_write8(&m_out_memw_func, &m_out_memw_cb, this);
+ m_out_hrq_func.resolve(m_out_hrq_cb, *this);
+ m_out_eop_func.resolve(m_out_eop_cb, *this);
+ m_in_memr_func.resolve(m_in_memr_cb, *this);
+ m_out_memw_func.resolve(m_out_memw_cb, *this);
for (int i = 0; i < 4; i++)
{
- devcb_resolve_read8(&m_chan[i].m_in_ior_func, &m_in_ior_cb[i], this);
- devcb_resolve_write8(&m_chan[i].m_out_iow_func, &m_out_iow_cb[i], this);
- devcb_resolve_write_line(&m_chan[i].m_out_dack_func, &m_out_dack_cb[i], this);
+ m_chan[i].m_in_ior_func.resolve(m_in_ior_cb[i], *this);
+ m_chan[i].m_out_iow_func.resolve(m_out_iow_cb[i], *this);
+ m_chan[i].m_out_dack_func.resolve(m_out_dack_cb[i], *this);
}
m_timer = machine().scheduler().timer_alloc(FUNC(i8237_timerproc_callback), (void *)this);
@@ -154,10 +154,10 @@ void i8237_device::i8237_do_read()
switch( DMA_MODE_OPERATION( m_chan[ channel ].m_mode ) )
{
case DMA8237_WRITE_TRANSFER:
- m_temporary_data = devcb_call_read8(&m_chan[channel].m_in_ior_func, 0);
+ m_temporary_data = m_chan[channel].m_in_ior_func(0);
break;
case DMA8237_READ_TRANSFER:
- m_temporary_data = devcb_call_read8(&m_in_memr_func, m_chan[ channel ].m_address);
+ m_temporary_data = m_in_memr_func(m_chan[ channel ].m_address);
break;
case DMA8237_VERIFY_TRANSFER:
case DMA8237_ILLEGAL_TRANSFER:
@@ -173,10 +173,10 @@ void i8237_device::i8237_do_write()
switch( DMA_MODE_OPERATION( m_chan[ channel ].m_mode ) )
{
case DMA8237_WRITE_TRANSFER:
- devcb_call_write8(&m_out_memw_func, m_chan[ channel ].m_address, m_temporary_data);
+ m_out_memw_func(m_chan[ channel ].m_address, m_temporary_data);
break;
case DMA8237_READ_TRANSFER:
- devcb_call_write8(&m_chan[channel].m_out_iow_func, 0, m_temporary_data);
+ m_chan[channel].m_out_iow_func(0, m_temporary_data);
break;
case DMA8237_VERIFY_TRANSFER:
case DMA8237_ILLEGAL_TRANSFER:
@@ -245,7 +245,7 @@ void i8237_device::i8327_set_dack(int channel)
{
int state = (i == channel) ^ !BIT(m_command, 7);
- devcb_call_write_line(&m_chan[i].m_out_dack_func, state);
+ m_chan[i].m_out_dack_func(state);
}
}
@@ -273,7 +273,7 @@ void i8237_device::i8237_timerproc()
if ( !m_eop )
{
m_eop = 1;
- devcb_call_write_line(&m_out_eop_func, m_eop ? ASSERT_LINE : CLEAR_LINE);
+ m_out_eop_func(m_eop ? ASSERT_LINE : CLEAR_LINE);
}
/* Check if a new DMA request has been received. */
@@ -301,7 +301,7 @@ void i8237_device::i8237_timerproc()
m_last_service_channel = prio_channel;
m_hrq = 1;
- devcb_call_write_line(&m_out_hrq_func, m_hrq);
+ m_out_hrq_func(m_hrq);
m_state = DMA8237_S0;
m_timer->enable( true );
@@ -353,7 +353,7 @@ void i8237_device::i8237_timerproc()
{
m_hrq = 0;
m_hlda = 0;
- devcb_call_write_line(&m_out_hrq_func, m_hrq);
+ m_out_hrq_func(m_hrq);
m_state = DMA8237_SI;
/* Clear DACK */
@@ -365,7 +365,7 @@ void i8237_device::i8237_timerproc()
if ( m_status & ( 0x01 << m_service_channel ) )
{
m_eop = 0;
- devcb_call_write_line(&m_out_eop_func, m_eop ? ASSERT_LINE : CLEAR_LINE);
+ m_out_eop_func(m_eop ? ASSERT_LINE : CLEAR_LINE);
}
break;
@@ -418,7 +418,7 @@ void i8237_device::i8237_timerproc()
{
m_hrq = 0;
m_hlda = 0;
- devcb_call_write_line(&m_out_hrq_func, m_hrq);
+ m_out_hrq_func(m_hrq);
m_state = DMA8237_SI;
}
else
@@ -430,7 +430,7 @@ void i8237_device::i8237_timerproc()
case DMA8237_SINGLE_MODE:
m_hrq = 0;
m_hlda = 0;
- devcb_call_write_line(&m_out_hrq_func, m_hrq);
+ m_out_hrq_func(m_hrq);
m_state = DMA8237_SI;
break;
@@ -440,7 +440,7 @@ void i8237_device::i8237_timerproc()
{
m_hrq = 0;
m_hlda = 0;
- devcb_call_write_line(&m_out_hrq_func, m_hrq);
+ m_out_hrq_func(m_hrq);
m_state = DMA8237_SI;
}
else
@@ -454,7 +454,7 @@ void i8237_device::i8237_timerproc()
if ( m_status & ( 0x01 << channel ) )
{
m_eop = 0;
- devcb_call_write_line(&m_out_eop_func, m_eop ? ASSERT_LINE : CLEAR_LINE);
+ m_out_eop_func(m_eop ? ASSERT_LINE : CLEAR_LINE);
}
}
@@ -472,8 +472,8 @@ void i8237_device::i8237_timerproc()
// m_chan[1].m_address, m_chan[1].m_count);
// FIXME: this will copy bytes correct, but not 16 bit words
- m_temporary_data = devcb_call_read8(&m_in_memr_func, m_chan[0].m_address);
- devcb_call_write8(&m_out_memw_func, m_chan[1].m_address, m_temporary_data);
+ m_temporary_data = m_in_memr_func(m_chan[0].m_address);
+ m_out_memw_func(m_chan[1].m_address, m_temporary_data);
m_service_channel = 0;
@@ -487,7 +487,7 @@ void i8237_device::i8237_timerproc()
if (m_chan[0].m_count == 0xFFFF || m_chan[1].m_count == 0xFFFF) {
m_hrq = 0;
m_hlda = 0;
- devcb_call_write_line(&m_out_hrq_func, m_hrq);
+ m_out_hrq_func(m_hrq);
m_state = DMA8237_SI;
m_status |= 3; // set TC for channel 0 and 1
m_drq &= ~3; // clear drq for channel 0 and 1
diff --git a/src/emu/machine/8255ppi.c b/src/emu/machine/8255ppi.c
index 9b98b24a5b2..8498427116c 100644
--- a/src/emu/machine/8255ppi.c
+++ b/src/emu/machine/8255ppi.c
@@ -147,13 +147,13 @@ void ppi8255_device::device_config_complete()
void ppi8255_device::device_start()
{
- devcb_resolve_read8(&m_port_read[0], &m_port_a_read, this);
- devcb_resolve_read8(&m_port_read[1], &m_port_b_read, this);
- devcb_resolve_read8(&m_port_read[2], &m_port_c_read, this);
+ m_port_read[0].resolve(m_port_a_read, *this);
+ m_port_read[1].resolve(m_port_b_read, *this);
+ m_port_read[2].resolve(m_port_c_read, *this);
- devcb_resolve_write8(&m_port_write[0], &m_port_a_write, this);
- devcb_resolve_write8(&m_port_write[1], &m_port_b_write, this);
- devcb_resolve_write8(&m_port_write[2], &m_port_c_write, this);
+ m_port_write[0].resolve(m_port_a_write, *this);
+ m_port_write[1].resolve(m_port_b_write, *this);
+ m_port_write[2].resolve(m_port_c_write, *this);
/* register for state saving */
save_item(NAME(m_group_a_mode));
@@ -318,7 +318,7 @@ UINT8 ppi8255_device::ppi8255_read_port(int port)
if (m_in_mask[port])
{
- ppi8255_input(port, devcb_call_read8(&m_port_read[port], 0));
+ ppi8255_input(port, m_port_read[port](0));
result |= m_read[port] & m_in_mask[port];
}
result |= m_latch[port] & m_out_mask[port];
@@ -382,7 +382,7 @@ void ppi8255_device::ppi8255_write_port(int port)
}
m_output[port] = write_data;
- devcb_call_write8(&m_port_write[port], 0, write_data);
+ m_port_write[port](0, write_data);
}
@@ -603,33 +603,33 @@ void ppi8255_device::set_mode(int data, int call_handlers)
void ppi8255_set_port_a_read(device_t *device, const devcb_read8 *config)
{
- downcast<ppi8255_device*>(device)->ppi8255_set_port_read(0, config);
+ downcast<ppi8255_device*>(device)->ppi8255_set_port_read(0, *config);
}
void ppi8255_set_port_b_read(device_t *device, const devcb_read8 *config)
{
- downcast<ppi8255_device*>(device)->ppi8255_set_port_read(1, config);
+ downcast<ppi8255_device*>(device)->ppi8255_set_port_read(1, *config);
}
void ppi8255_set_port_c_read(device_t *device, const devcb_read8 *config)
{
- downcast<ppi8255_device*>(device)->ppi8255_set_port_read(2, config);
+ downcast<ppi8255_device*>(device)->ppi8255_set_port_read(2, *config);
}
void ppi8255_set_port_a_write(device_t *device, const devcb_write8 *config)
{
- downcast<ppi8255_device*>(device)->ppi8255_set_port_write(0, config);
+ downcast<ppi8255_device*>(device)->ppi8255_set_port_write(0, *config);
}
void ppi8255_set_port_b_write(device_t *device, const devcb_write8 *config)
{
- downcast<ppi8255_device*>(device)->ppi8255_set_port_write(1, config);
+ downcast<ppi8255_device*>(device)->ppi8255_set_port_write(1, *config);
}
void ppi8255_set_port_c_write(device_t *device, const devcb_write8 *config)
{
- downcast<ppi8255_device*>(device)->ppi8255_set_port_write(2, config);
+ downcast<ppi8255_device*>(device)->ppi8255_set_port_write(2, *config);
}
diff --git a/src/emu/machine/8255ppi.h b/src/emu/machine/8255ppi.h
index 229dc8265cf..d85c56439da 100644
--- a/src/emu/machine/8255ppi.h
+++ b/src/emu/machine/8255ppi.h
@@ -58,8 +58,8 @@ public:
UINT8 ppi8255_r(UINT32 offset);
void ppi8255_w(UINT32 offset, UINT8 data);
- void ppi8255_set_port_read(int which, const devcb_read8 *config) { devcb_resolve_read8(&m_port_read[which], config, this); }
- void ppi8255_set_port_write(int which, const devcb_write8 *config) { devcb_resolve_write8(&m_port_write[which], config, this); }
+ void ppi8255_set_port_read(int which, const devcb_read8 &config) { m_port_read[which].resolve(config, *this); }
+ void ppi8255_set_port_write(int which, const devcb_write8 &config) { m_port_write[which].resolve(config, *this); }
void ppi8255_set_port(int which, UINT8 data) { ppi8255_input(which, data); }
UINT8 ppi8255_get_port(int which) { return m_output[which]; }
diff --git a/src/emu/machine/8257dma.c b/src/emu/machine/8257dma.c
index ba9ff0bfd5a..c6673d087f9 100644
--- a/src/emu/machine/8257dma.c
+++ b/src/emu/machine/8257dma.c
@@ -118,16 +118,16 @@ void i8257_device::device_start()
assert(this != NULL);
/* resolve callbacks */
- devcb_resolve_write_line(&m_out_hrq_func, &m_out_hrq_cb, this);
- devcb_resolve_write_line(&m_out_tc_func, &m_out_tc_cb, this);
- devcb_resolve_write_line(&m_out_mark_func, &m_out_mark_cb, this);
- devcb_resolve_read8(&m_in_memr_func, &m_in_memr_cb, this);
- devcb_resolve_write8(&m_out_memw_func, &m_out_memw_cb, this);
+ m_out_hrq_func.resolve(m_out_hrq_cb, *this);
+ m_out_tc_func.resolve(m_out_tc_cb, *this);
+ m_out_mark_func.resolve(m_out_mark_cb, *this);
+ m_in_memr_func.resolve(m_in_memr_cb, *this);
+ m_out_memw_func.resolve(m_out_memw_cb, *this);
for (int i = 0; i < I8257_NUM_CHANNELS; i++)
{
- devcb_resolve_read8(&m_in_ior_func[i], &m_in_ior_cb[i], this);
- devcb_resolve_write8(&m_out_iow_func[i], &m_out_iow_cb[i], this);
+ m_in_ior_func[i].resolve(m_in_ior_cb[i], *this);
+ m_out_iow_func[i].resolve(m_out_iow_cb[i], *this);
}
/* set initial values */
@@ -169,22 +169,22 @@ int i8257_device::i8257_do_operation(int channel)
{
m_status |= (0x01 << channel);
- devcb_call_write_line(&m_out_tc_func, ASSERT_LINE);
+ m_out_tc_func(ASSERT_LINE);
}
switch(mode) {
case 1:
- if (&m_in_memr_func.target != NULL)
+ if (!m_in_memr_func.isnull())
{
- data = devcb_call_read8(&m_in_memr_func, m_address[channel]);
+ data = m_in_memr_func(m_address[channel]);
}
else
{
data = 0;
logerror("8257: No memory read function defined.\n");
}
- if (&m_out_iow_func[channel].target != NULL)
+ if (!m_out_iow_func[channel].isnull())
{
- devcb_call_write8(&m_out_iow_func[channel], m_address[channel], data);
+ m_out_iow_func[channel](m_address[channel], data);
}
else
{
@@ -197,9 +197,9 @@ int i8257_device::i8257_do_operation(int channel)
break;
case 2:
- if (&m_in_ior_func[channel].target != NULL)
+ if (!m_in_ior_func[channel].isnull())
{
- data = devcb_call_read8(&m_in_ior_func[channel], m_address[channel]);
+ data = m_in_ior_func[channel](m_address[channel]);
}
else
{
@@ -207,9 +207,9 @@ int i8257_device::i8257_do_operation(int channel)
logerror("8257: No channel read function for channel %d defined.\n",channel);
}
- if (&m_out_memw_func.target != NULL)
+ if (!m_out_memw_func.isnull())
{
- devcb_call_write8(&m_out_memw_func, m_address[channel], data);
+ m_out_memw_func(m_address[channel], data);
}
else
{
@@ -238,7 +238,7 @@ int i8257_device::i8257_do_operation(int channel)
m_registers[5] = m_registers[7];
}
- devcb_call_write_line(&m_out_tc_func, CLEAR_LINE);
+ m_out_tc_func(CLEAR_LINE);
}
return done;
}
@@ -337,7 +337,7 @@ void i8257_device::i8257_update_status()
}
/* set the halt line */
- devcb_call_write_line(&m_out_hrq_func, pending_transfer ? ASSERT_LINE : CLEAR_LINE);
+ m_out_hrq_func(pending_transfer ? ASSERT_LINE : CLEAR_LINE);
}
diff --git a/src/emu/machine/adc0808.c b/src/emu/machine/adc0808.c
index 2dd30a21092..1c7f125e026 100644
--- a/src/emu/machine/adc0808.c
+++ b/src/emu/machine/adc0808.c
@@ -63,7 +63,7 @@ void adc0808_device::device_config_complete()
void adc0808_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_eoc_func, &m_out_eoc_cb, this);
+ m_out_eoc_func.resolve(m_out_eoc_cb, *this);
// allocate timers
m_cycle_timer = timer_alloc();
@@ -113,7 +113,7 @@ void adc0808_device::device_timer(emu_timer &timer, device_timer_id id, int para
/* set end of conversion pin */
if (m_next_eoc != m_eoc)
{
- devcb_call_write_line(&m_out_eoc_func, m_next_eoc);
+ m_out_eoc_func(m_next_eoc);
m_eoc = m_next_eoc;
}
}
diff --git a/src/emu/machine/cdp1852.c b/src/emu/machine/cdp1852.c
index a57253c8e24..ea11fdb15e6 100644
--- a/src/emu/machine/cdp1852.c
+++ b/src/emu/machine/cdp1852.c
@@ -37,7 +37,7 @@ enum
int cdp1852_device::get_mode()
{
- return devcb_call_read_line(&m_in_mode_func);
+ return m_in_mode_func();
}
@@ -51,7 +51,7 @@ void cdp1852_device::set_sr_line(int state)
{
m_sr = state;
- devcb_call_write_line(&m_out_sr_func, m_sr);
+ m_out_sr_func(m_sr);
}
}
@@ -102,10 +102,10 @@ void cdp1852_device::device_config_complete()
void cdp1852_device::device_start()
{
// resolve callbacks
- devcb_resolve_read_line(&m_in_mode_func, &m_in_mode_cb, this);
- devcb_resolve_write_line(&m_out_sr_func, &m_out_sr_cb, this);
- devcb_resolve_read8(&m_in_data_func, &m_in_data_cb, this);
- devcb_resolve_write8(&m_out_data_func, &m_out_data_cb, this);
+ m_in_mode_func.resolve(m_in_mode_cb, *this);
+ m_out_sr_func.resolve(m_out_sr_cb, *this);
+ m_in_data_func.resolve(m_in_data_cb, *this);
+ m_out_data_func.resolve(m_out_data_cb, *this);
// allocate timers
if (clock() > 0)
@@ -140,7 +140,7 @@ void cdp1852_device::device_reset()
else
{
// output data
- devcb_call_write8(&m_out_data_func, 0, m_data);
+ m_out_data_func(0, m_data);
// reset service request flip-flop
set_sr_line(0);
@@ -158,7 +158,7 @@ void cdp1852_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
case MODE_INPUT:
// input data into register
- m_data = devcb_call_read8(&m_in_data_func, 0);
+ m_data = m_in_data_func(0);
// signal processor
set_sr_line(0);
@@ -173,7 +173,7 @@ void cdp1852_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_data = m_next_data;
// output data
- devcb_call_write8(&m_out_data_func, 0, m_data);
+ m_out_data_func(0, m_data);
// signal peripheral device
set_sr_line(1);
@@ -198,7 +198,7 @@ READ8_MEMBER( cdp1852_device::read )
if ((get_mode() == MODE_INPUT) && (clock() == 0))
{
// input data into register
- m_data = devcb_call_read8(&m_in_data_func, 0);
+ m_data = m_in_data_func(0);
}
set_sr_line(1);
diff --git a/src/emu/machine/cdp1871.c b/src/emu/machine/cdp1871.c
index e7e55b537e4..c87ceb54ab8 100644
--- a/src/emu/machine/cdp1871.c
+++ b/src/emu/machine/cdp1871.c
@@ -139,22 +139,22 @@ void cdp1871_device::device_config_complete()
void cdp1871_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_da_func, &out_da_cb, this);
- devcb_resolve_write_line(&m_out_rpt_func, &out_rpt_cb, this);
- devcb_resolve_read8(&m_in_d_func[0], &in_d1_cb, this);
- devcb_resolve_read8(&m_in_d_func[1], &in_d2_cb, this);
- devcb_resolve_read8(&m_in_d_func[2], &in_d3_cb, this);
- devcb_resolve_read8(&m_in_d_func[3], &in_d4_cb, this);
- devcb_resolve_read8(&m_in_d_func[4], &in_d5_cb, this);
- devcb_resolve_read8(&m_in_d_func[5], &in_d6_cb, this);
- devcb_resolve_read8(&m_in_d_func[6], &in_d7_cb, this);
- devcb_resolve_read8(&m_in_d_func[7], &in_d8_cb, this);
- devcb_resolve_read8(&m_in_d_func[8], &in_d9_cb, this);
- devcb_resolve_read8(&m_in_d_func[9], &in_d10_cb, this);
- devcb_resolve_read8(&m_in_d_func[10], &in_d11_cb, this);
- devcb_resolve_read_line(&m_in_shift_func, &in_shift_cb, this);
- devcb_resolve_read_line(&m_in_control_func, &in_control_cb, this);
- devcb_resolve_read_line(&m_in_alpha_func, &in_alpha_cb, this);
+ m_out_da_func.resolve(out_da_cb, *this);
+ m_out_rpt_func.resolve(out_rpt_cb, *this);
+ m_in_d_func[0].resolve(in_d1_cb, *this);
+ m_in_d_func[1].resolve(in_d2_cb, *this);
+ m_in_d_func[2].resolve(in_d3_cb, *this);
+ m_in_d_func[3].resolve(in_d4_cb, *this);
+ m_in_d_func[4].resolve(in_d5_cb, *this);
+ m_in_d_func[5].resolve(in_d6_cb, *this);
+ m_in_d_func[6].resolve(in_d7_cb, *this);
+ m_in_d_func[7].resolve(in_d8_cb, *this);
+ m_in_d_func[8].resolve(in_d9_cb, *this);
+ m_in_d_func[9].resolve(in_d10_cb, *this);
+ m_in_d_func[10].resolve(in_d11_cb, *this);
+ m_in_shift_func.resolve(in_shift_cb, *this);
+ m_in_control_func.resolve(in_control_cb, *this);
+ m_in_alpha_func.resolve(in_alpha_cb, *this);
// set initial values
change_output_lines();
@@ -198,14 +198,14 @@ void cdp1871_device::change_output_lines()
{
m_da = m_next_da;
- devcb_call_write_line(&m_out_da_func, m_da);
+ m_out_da_func(m_da);
}
if (m_next_rpt != m_rpt)
{
m_rpt = m_next_rpt;
- devcb_call_write_line(&m_out_rpt_func, m_rpt);
+ m_out_rpt_func(m_rpt);
}
}
@@ -243,14 +243,14 @@ void cdp1871_device::detect_keypress()
{
UINT8 data = 0;
- data = devcb_call_read8(&m_in_d_func[m_drive], 0);
+ data = m_in_d_func[m_drive](0);
if (data == (1 << m_sense))
{
if (!m_inhibit)
{
- m_shift = devcb_call_read_line(&m_in_shift_func);
- m_control = devcb_call_read_line(&m_in_control_func);
+ m_shift = m_in_shift_func();
+ m_control = m_in_control_func();
m_inhibit = true;
m_next_da = ASSERT_LINE;
}
@@ -274,7 +274,7 @@ void cdp1871_device::detect_keypress()
READ8_MEMBER( cdp1871_device::data_r )
{
int table = 0;
- int alpha = devcb_call_read_line(&m_in_alpha_func);
+ int alpha = m_in_alpha_func();
if (m_control) table = 3; else if (m_shift) table = 2; else if (alpha) table = 1;
diff --git a/src/emu/machine/com8116.c b/src/emu/machine/com8116.c
index b4ab56e8ee7..74623916653 100644
--- a/src/emu/machine/com8116.c
+++ b/src/emu/machine/com8116.c
@@ -68,9 +68,9 @@ void com8116_device::device_config_complete()
void com8116_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_fx4_func, &m_out_fx4_cb, this);
- devcb_resolve_write_line(&m_out_fr_func, &m_out_fr_cb, this);
- devcb_resolve_write_line(&m_out_ft_func, &m_out_ft_cb, this);
+ m_out_fx4_func.resolve(m_out_fx4_cb, *this);
+ m_out_fr_func.resolve(m_out_fr_cb, *this);
+ m_out_ft_func.resolve(m_out_ft_cb, *this);
// allocate timers
m_fx4_timer = timer_alloc(TIMER_FX4);
@@ -93,15 +93,15 @@ void com8116_device::device_timer(emu_timer &timer, device_timer_id id, int para
switch (id)
{
case TIMER_FX4:
- devcb_call_write_line(&m_out_fx4_func, 1);
+ m_out_fx4_func(1);
break;
case TIMER_FR:
- devcb_call_write_line(&m_out_fr_func, 1);
+ m_out_fr_func(1);
break;
case TIMER_FT:
- devcb_call_write_line(&m_out_ft_func, 1);
+ m_out_ft_func(1);
break;
}
}
diff --git a/src/emu/machine/i8155.c b/src/emu/machine/i8155.c
index f103a70561d..cc69c83b4ab 100644
--- a/src/emu/machine/i8155.c
+++ b/src/emu/machine/i8155.c
@@ -115,7 +115,7 @@ inline UINT8 i8155_device::get_timer_mode()
inline void i8155_device::timer_output()
{
- devcb_call_write_line(&m_out_to_func, m_to);
+ m_out_to_func(m_to);
if (LOG) logerror("8155 '%s' Timer Output: %u\n", tag(), m_to);
}
@@ -165,7 +165,7 @@ inline UINT8 i8155_device::read_port(int port)
switch (get_port_mode(port))
{
case PORT_MODE_INPUT:
- data = devcb_call_read8(&m_in_port_func[port], 0);
+ data = m_in_port_func[port](0);
break;
case PORT_MODE_OUTPUT:
@@ -178,7 +178,7 @@ inline UINT8 i8155_device::read_port(int port)
switch (get_port_mode(PORT_C))
{
case PORT_MODE_INPUT:
- data = devcb_call_read8(&m_in_port_func[port], 0) & 0x3f;
+ data = m_in_port_func[port](0) & 0x3f;
break;
case PORT_MODE_OUTPUT:
@@ -200,7 +200,7 @@ inline void i8155_device::write_port(int port, UINT8 data)
{
case PORT_MODE_OUTPUT:
m_output[port] = data;
- devcb_call_write8(&m_out_port_func[port], 0, m_output[port]);
+ m_out_port_func[port](0, m_output[port]);
break;
}
}
@@ -257,13 +257,13 @@ void i8155_device::device_config_complete()
void i8155_device::device_start()
{
// resolve callbacks
- devcb_resolve_read8(&m_in_port_func[0], &in_pa_cb, this);
- devcb_resolve_read8(&m_in_port_func[1], &in_pb_cb, this);
- devcb_resolve_read8(&m_in_port_func[2], &in_pc_cb, this);
- devcb_resolve_write8(&m_out_port_func[0], &out_pa_cb, this);
- devcb_resolve_write8(&m_out_port_func[1], &out_pb_cb, this);
- devcb_resolve_write8(&m_out_port_func[2], &out_pc_cb, this);
- devcb_resolve_write_line(&m_out_to_func, &out_to_cb, this);
+ m_in_port_func[0].resolve(in_pa_cb, *this);
+ m_in_port_func[1].resolve(in_pb_cb, *this);
+ m_in_port_func[2].resolve(in_pc_cb, *this);
+ m_out_port_func[0].resolve(out_pa_cb, *this);
+ m_out_port_func[1].resolve(out_pb_cb, *this);
+ m_out_port_func[2].resolve(out_pc_cb, *this);
+ m_out_to_func.resolve(out_to_cb, *this);
// allocate timers
m_timer = timer_alloc();
diff --git a/src/emu/machine/i8212.c b/src/emu/machine/i8212.c
index dbe6fe1e1a0..aff8d4bca8b 100644
--- a/src/emu/machine/i8212.c
+++ b/src/emu/machine/i8212.c
@@ -71,9 +71,9 @@ void i8212_device::device_config_complete()
void i8212_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
- devcb_resolve_read8(&m_in_di_func, &m_in_di_cb, this);
- devcb_resolve_write8(&m_out_do_func, &m_out_do_cb, this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
+ m_in_di_func.resolve(m_in_di_cb, *this);
+ m_out_do_func.resolve(m_out_do_cb, *this);
// register for state saving
save_item(NAME(m_md));
@@ -93,7 +93,7 @@ void i8212_device::device_reset()
if (m_md == I8212_MODE_OUTPUT)
{
// output data
- devcb_call_write8(&m_out_do_func, 0, m_data);
+ m_out_do_func(0, m_data);
}
}
@@ -105,7 +105,7 @@ void i8212_device::device_reset()
READ8_MEMBER( i8212_device::data_r )
{
// clear interrupt line
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
+ m_out_int_func(CLEAR_LINE);
if (LOG) logerror("I8212 '%s' INT: %u\n", tag(), CLEAR_LINE);
@@ -123,7 +123,7 @@ WRITE8_MEMBER( i8212_device::data_w )
m_data = data;
// output data
- devcb_call_write8(&m_out_do_func, 0, m_data);
+ m_out_do_func(0, m_data);
}
@@ -152,10 +152,10 @@ WRITE_LINE_MEMBER( i8212_device::stb_w )
if (m_stb && !state)
{
// input data
- m_data = devcb_call_read8(&m_in_di_func, 0);
+ m_data = m_in_di_func(0);
// assert interrupt line
- devcb_call_write_line(&m_out_int_func, ASSERT_LINE);
+ m_out_int_func(ASSERT_LINE);
if (LOG) logerror("I8212 '%s' INT: %u\n", tag(), ASSERT_LINE);
}
diff --git a/src/emu/machine/i8214.c b/src/emu/machine/i8214.c
index 521cccd7007..75ce421f94f 100644
--- a/src/emu/machine/i8214.c
+++ b/src/emu/machine/i8214.c
@@ -43,11 +43,11 @@ inline void i8214_device::trigger_interrupt(int level)
m_int_dis = 1;
// disable next level group
- devcb_call_write_line(&m_out_enlg_func, 0);
+ m_out_enlg_func(0);
// toggle interrupt line
- devcb_call_write_line(&m_out_int_func, ASSERT_LINE);
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
+ m_out_int_func(ASSERT_LINE);
+ m_out_int_func(CLEAR_LINE);
}
@@ -125,8 +125,8 @@ void i8214_device::device_config_complete()
void i8214_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
- devcb_resolve_write_line(&m_out_enlg_func, &m_out_enlg_cb, this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
+ m_out_enlg_func.resolve(m_out_enlg_cb, *this);
// register for state saving
save_item(NAME(m_inte));
@@ -167,7 +167,7 @@ void i8214_device::b_w(UINT8 data)
m_int_dis = 0;
// enable next level group
- devcb_call_write_line(&m_out_enlg_func, 1);
+ m_out_enlg_func(1);
check_interrupt();
}
diff --git a/src/emu/machine/i8243.c b/src/emu/machine/i8243.c
index 9a15afc1dcf..cf1355585eb 100644
--- a/src/emu/machine/i8243.c
+++ b/src/emu/machine/i8243.c
@@ -40,7 +40,8 @@ void i8243_device::static_set_read_handler(device_t &device, read8_device_func c
i8243_device &i8243 = downcast<i8243_device &>(device);
if(callback != NULL)
{
- i8243.m_readhandler_cb.type = DEVCB_TYPE_SELF;
+ i8243.m_readhandler_cb.type = DEVCB_TYPE_DEVICE;
+ i8243.m_readhandler_cb.index = DEVCB_DEVICE_SELF;
i8243.m_readhandler_cb.readdevice = callback;
}
else
@@ -60,7 +61,8 @@ void i8243_device::static_set_write_handler(device_t &device, write8_device_func
i8243_device &i8243 = downcast<i8243_device &>(device);
if(callback != NULL)
{
- i8243.m_writehandler_cb.type = DEVCB_TYPE_SELF;
+ i8243.m_writehandler_cb.type = DEVCB_TYPE_DEVICE;
+ i8243.m_writehandler_cb.index = DEVCB_DEVICE_SELF;
i8243.m_writehandler_cb.writedevice = callback;
}
else
@@ -76,8 +78,8 @@ void i8243_device::static_set_write_handler(device_t &device, write8_device_func
void i8243_device::device_start()
{
- devcb_resolve_read8(&m_readhandler, &m_readhandler_cb, this);
- devcb_resolve_write8(&m_writehandler, &m_writehandler_cb, this);
+ m_readhandler.resolve(m_readhandler_cb, *this);
+ m_writehandler.resolve(m_writehandler_cb, *this);
}
@@ -131,9 +133,9 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(i8243, i8243_prog_w)
/* if this is a read opcode, copy result to p2out */
if((m_opcode >> 2) == MCS48_EXPANDER_OP_READ)
{
- if (m_readhandler.read != NULL)
+ if (m_readhandler.isnull())
{
- m_p[m_opcode & 3] = devcb_call_read8(&m_readhandler, m_opcode & 3);
+ m_p[m_opcode & 3] = m_readhandler(m_opcode & 3);
}
m_p2out = m_p[m_opcode & 3] & 0x0f;
}
@@ -146,17 +148,17 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(i8243, i8243_prog_w)
{
case MCS48_EXPANDER_OP_WRITE:
m_p[m_opcode & 3] = m_p2 & 0x0f;
- devcb_call_write8(&m_writehandler, m_opcode & 3, m_p[m_opcode & 3]);
+ m_writehandler(m_opcode & 3, m_p[m_opcode & 3]);
break;
case MCS48_EXPANDER_OP_OR:
m_p[m_opcode & 3] |= m_p2 & 0x0f;
- devcb_call_write8(&m_writehandler, m_opcode & 3, m_p[m_opcode & 3]);
+ m_writehandler(m_opcode & 3, m_p[m_opcode & 3]);
break;
case MCS48_EXPANDER_OP_AND:
m_p[m_opcode & 3] &= m_p2 & 0x0f;
- devcb_call_write8(&m_writehandler, m_opcode & 3, m_p[m_opcode & 3]);
+ m_writehandler(m_opcode & 3, m_p[m_opcode & 3]);
break;
}
}
diff --git a/src/emu/machine/i8255.c b/src/emu/machine/i8255.c
index 175ea6754a9..b2543a5a231 100644
--- a/src/emu/machine/i8255.c
+++ b/src/emu/machine/i8255.c
@@ -300,12 +300,12 @@ void i8255_device::device_config_complete()
void i8255_device::device_start()
{
// resolve callbacks
- devcb_resolve_read8(&m_in_port_func[PORT_A], &m_in_pa_cb, this);
- devcb_resolve_write8(&m_out_port_func[PORT_A], &m_out_pa_cb, this);
- devcb_resolve_read8(&m_in_port_func[PORT_B], &m_in_pb_cb, this);
- devcb_resolve_write8(&m_out_port_func[PORT_B], &m_out_pb_cb, this);
- devcb_resolve_read8(&m_in_port_func[PORT_C], &m_in_pc_cb, this);
- devcb_resolve_write8(&m_out_port_func[PORT_C], &m_out_pc_cb, this);
+ m_in_port_func[PORT_A].resolve(m_in_pa_cb, *this);
+ m_out_port_func[PORT_A].resolve(m_out_pa_cb, *this);
+ m_in_port_func[PORT_B].resolve(m_in_pb_cb, *this);
+ m_out_port_func[PORT_B].resolve(m_out_pb_cb, *this);
+ m_in_port_func[PORT_C].resolve(m_in_pc_cb, *this);
+ m_out_port_func[PORT_C].resolve(m_out_pc_cb, *this);
// register for state saving
save_item(NAME(m_control));
@@ -346,7 +346,7 @@ UINT8 i8255_device::read_mode0(int port)
else
{
// read data from port
- data = devcb_call_read8(&m_in_port_func[port], 0);
+ data = m_in_port_func[port](0);
}
return data;
@@ -493,7 +493,7 @@ UINT8 i8255_device::read_pc()
if (mask)
{
// read data from port
- data |= devcb_call_read8(&m_in_port_func[PORT_C], 0) & mask;
+ data |= m_in_port_func[PORT_C](0) & mask;
}
return data;
@@ -512,7 +512,7 @@ void i8255_device::write_mode0(int port, UINT8 data)
m_output[port] = data;
// write data to port
- devcb_call_write8(&m_out_port_func[port], 0, data);
+ m_out_port_func[port](0, data);
}
}
@@ -529,7 +529,7 @@ void i8255_device::write_mode1(int port, UINT8 data)
m_output[port] = data;
// write data to port
- devcb_call_write8(&m_out_port_func[port], 0, data);
+ m_out_port_func[port](0, data);
// set output buffer full flag
set_obf(port, 0);
@@ -550,7 +550,7 @@ void i8255_device::write_mode2(UINT8 data)
m_output[PORT_A] = data;
// write data to port
- devcb_call_write8(&m_out_port_func[PORT_A], 0, data);
+ m_out_port_func[PORT_A](0, data);
// set output buffer full flag
set_obf(PORT_A, 0);
@@ -668,7 +668,7 @@ void i8255_device::output_pc()
data |= m_output[PORT_C] & mask;
- devcb_call_write8(&m_out_port_func[PORT_C], 0, data);
+ m_out_port_func[PORT_C](0, data);
}
@@ -691,12 +691,12 @@ void i8255_device::set_mode(UINT8 data)
if (port_mode(PORT_A) == MODE_OUTPUT)
{
- devcb_call_write8(&m_out_port_func[PORT_A], 0, m_output[PORT_A]);
+ m_out_port_func[PORT_A](0, m_output[PORT_A]);
}
else
{
// TTL inputs float high
- devcb_call_write8(&m_out_port_func[PORT_A], 0, 0xff);
+ m_out_port_func[PORT_A](0, 0xff);
}
if (LOG)
@@ -718,12 +718,12 @@ void i8255_device::set_mode(UINT8 data)
if (port_mode(PORT_B) == MODE_OUTPUT)
{
- devcb_call_write8(&m_out_port_func[PORT_B], 0, m_output[PORT_B]);
+ m_out_port_func[PORT_B](0, m_output[PORT_B]);
}
else
{
// TTL inputs float high
- devcb_call_write8(&m_out_port_func[PORT_B], 0, 0xff);
+ m_out_port_func[PORT_B](0, 0xff);
}
m_output[PORT_C] = 0;
@@ -978,7 +978,7 @@ WRITE_LINE_MEMBER( i8255_device::pc2_w )
if (LOG) logerror("I8255 '%s' Port B Strobe\n", tag());
// read port into latch
- m_input[PORT_B] = devcb_call_read8(&m_in_port_func[PORT_B], 0);
+ m_input[PORT_B] = m_in_port_func[PORT_B](0);
// set input buffer flag
set_ibf(PORT_B, 1);
@@ -1002,7 +1002,7 @@ WRITE_LINE_MEMBER( i8255_device::pc4_w )
if (LOG) logerror("I8255 '%s' Port A Strobe\n", tag());
// read port into latch
- m_input[PORT_A] = devcb_call_read8(&m_in_port_func[PORT_A], 0);
+ m_input[PORT_A] = m_in_port_func[PORT_A](0);
// set input buffer flag
set_ibf(PORT_A, 1);
diff --git a/src/emu/machine/i8355.c b/src/emu/machine/i8355.c
index 52ef3393343..a3a03c90de1 100644
--- a/src/emu/machine/i8355.c
+++ b/src/emu/machine/i8355.c
@@ -63,7 +63,7 @@ inline UINT8 i8355_device::read_port(int port)
if (m_ddr[port] != 0xff)
{
- data |= devcb_call_read8(&m_in_port_func[port], 0) & ~m_ddr[port];
+ data |= m_in_port_func[port](0) & ~m_ddr[port];
}
return data;
@@ -78,7 +78,7 @@ inline void i8355_device::write_port(int port, UINT8 data)
{
m_output[port] = data;
- devcb_call_write8(&m_out_port_func[port], 0, m_output[port] & m_ddr[port]);
+ m_out_port_func[port](0, m_output[port] & m_ddr[port]);
}
@@ -131,10 +131,10 @@ void i8355_device::device_config_complete()
void i8355_device::device_start()
{
// resolve callbacks
- devcb_resolve_read8(&m_in_port_func[0], &m_in_pa_cb, this);
- devcb_resolve_read8(&m_in_port_func[1], &m_in_pb_cb, this);
- devcb_resolve_write8(&m_out_port_func[0], &m_out_pa_cb, this);
- devcb_resolve_write8(&m_out_port_func[1], &m_out_pb_cb, this);
+ m_in_port_func[0].resolve(m_in_pa_cb, *this);
+ m_in_port_func[1].resolve(m_in_pb_cb, *this);
+ m_out_port_func[0].resolve(m_out_pa_cb, *this);
+ m_out_port_func[1].resolve(m_out_pb_cb, *this);
// register for state saving
save_item(NAME(m_output));
diff --git a/src/emu/machine/ins8154.c b/src/emu/machine/ins8154.c
index 29baae92eaf..57e37387cf9 100644
--- a/src/emu/machine/ins8154.c
+++ b/src/emu/machine/ins8154.c
@@ -83,11 +83,11 @@ void ins8154_device::device_config_complete()
void ins8154_device::device_start()
{
/* resolve callbacks */
- devcb_resolve_read8(&m_in_a_func, &m_in_a_cb, this);
- devcb_resolve_write8(&m_out_a_func, &m_out_a_cb, this);
- devcb_resolve_read8(&m_in_b_func, &m_in_b_cb, this);
- devcb_resolve_write8(&m_out_b_func, &m_out_b_cb, this);
- devcb_resolve_write_line(&m_out_irq_func, &m_out_irq_cb, this);
+ m_in_a_func.resolve(m_in_a_cb, *this);
+ m_out_a_func.resolve(m_out_a_cb, *this);
+ m_in_b_func.resolve(m_in_b_cb, *this);
+ m_out_b_func.resolve(m_out_b_cb, *this);
+ m_out_irq_func.resolve(m_out_irq_cb, *this);
/* register for state saving */
save_item(NAME(m_in_a));
@@ -132,17 +132,17 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_r)
switch (offset)
{
case 0x20:
- if(m_in_a_func.read != NULL)
+ if(!m_in_a_func.isnull())
{
- val = devcb_call_read8(&m_in_a_func, 0);
+ val = m_in_a_func(0);
}
m_in_a = val;
break;
case 0x21:
- if(m_in_b_func.read != NULL)
+ if(!m_in_b_func.isnull())
{
- val = devcb_call_read8(&m_in_b_func, 0);
+ val = m_in_b_func(0);
}
m_in_b = val;
break;
@@ -150,17 +150,17 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_r)
default:
if (offset < 0x08)
{
- if(m_in_a_func.read != NULL)
+ if(!m_in_a_func.isnull())
{
- val = (devcb_call_read8(&m_in_a_func, 0) << (8 - offset)) & 0x80;
+ val = (m_in_a_func(0) << (8 - offset)) & 0x80;
}
m_in_a = val;
}
else
{
- if(m_in_b_func.read != NULL)
+ if(!m_in_b_func.isnull())
{
- val = (devcb_call_read8(&m_in_b_func, 0) << (8 - (offset >> 4))) & 0x80;
+ val = (m_in_b_func(0) << (8 - (offset >> 4))) & 0x80;
}
m_in_b = val;
}
@@ -177,7 +177,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_porta_w)
/* Test if any pins are set as outputs */
if (m_odra)
{
- devcb_call_write8(&m_out_a_func, 0, (data & m_odra) | (m_odra ^ 0xff));
+ m_out_a_func(0, (data & m_odra) | (m_odra ^ 0xff));
}
}
@@ -188,7 +188,7 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(ins8154, ins8154_portb_w)
/* Test if any pins are set as outputs */
if (m_odrb)
{
- devcb_call_write8(&m_out_b_func, 0, (data & m_odrb) | (m_odrb ^ 0xff));
+ m_out_b_func(0, (data & m_odrb) | (m_odrb ^ 0xff));
}
}
diff --git a/src/emu/machine/mc6852.c b/src/emu/machine/mc6852.c
index 735865630f9..47c02acaa2a 100644
--- a/src/emu/machine/mc6852.c
+++ b/src/emu/machine/mc6852.c
@@ -145,13 +145,13 @@ void mc6852_device::device_config_complete()
void mc6852_device::device_start()
{
// resolve callbacks
- devcb_resolve_read_line(&m_in_rx_data_func, &m_in_rx_data_cb, this);
- devcb_resolve_write_line(&m_out_tx_data_func, &m_out_tx_data_cb, this);
- devcb_resolve_write_line(&m_out_irq_func, &m_out_irq_cb, this);
- devcb_resolve_read_line(&m_in_cts_func, &m_in_cts_cb, this);
- devcb_resolve_read_line(&m_in_dcd_func, &m_in_dcd_cb, this);
- devcb_resolve_write_line(&m_out_sm_dtr_func, &m_out_sm_dtr_cb, this);
- devcb_resolve_write_line(&m_out_tuf_func, &m_out_tuf_cb, this);
+ m_in_rx_data_func.resolve(m_in_rx_data_cb, *this);
+ m_out_tx_data_func.resolve(m_out_tx_data_cb, *this);
+ m_out_irq_func.resolve(m_out_irq_cb, *this);
+ m_in_cts_func.resolve(m_in_cts_cb, *this);
+ m_in_dcd_func.resolve(m_in_dcd_cb, *this);
+ m_out_sm_dtr_func.resolve(m_out_sm_dtr_cb, *this);
+ m_out_tuf_func.resolve(m_out_tuf_cb, *this);
if (m_rx_clock > 0)
{
diff --git a/src/emu/machine/mc68901.c b/src/emu/machine/mc68901.c
index 65553a18185..a374d81c58d 100644
--- a/src/emu/machine/mc68901.c
+++ b/src/emu/machine/mc68901.c
@@ -260,7 +260,7 @@ static const int GPIO_TIMER[] =
static const int PRESCALER[] = { 0, 4, 10, 16, 50, 64, 100, 200 };
-#define TXD(_data) devcb_call_write_line(&m_out_so_func, _data);
+#define TXD(_data) m_out_so_func(_data);
//**************************************************************************
@@ -271,11 +271,11 @@ inline void mc68901_device::check_interrupts()
{
if (m_ipr & m_imr)
{
- devcb_call_write_line(&m_out_irq_func, ASSERT_LINE);
+ m_out_irq_func(ASSERT_LINE);
}
else
{
- devcb_call_write_line(&m_out_irq_func, CLEAR_LINE);
+ m_out_irq_func(CLEAR_LINE);
}
}
@@ -340,7 +340,7 @@ inline void mc68901_device::serial_receive()
if (!(m_rsr & RSR_RCV_ENABLE)) return;
- rxd = devcb_call_read_line(&m_in_si_func);
+ rxd = m_in_si_func();
switch (m_rx_state)
{
@@ -645,10 +645,10 @@ inline void mc68901_device::timer_count(int index)
switch (index)
{
- case TIMER_A: devcb_call_write_line(&m_out_tao_func, m_to[index]); break;
- case TIMER_B: devcb_call_write_line(&m_out_tbo_func, m_to[index]); break;
- case TIMER_C: devcb_call_write_line(&m_out_tco_func, m_to[index]); break;
- case TIMER_D: devcb_call_write_line(&m_out_tdo_func, m_to[index]); break;
+ case TIMER_A: m_out_tao_func(m_to[index]); break;
+ case TIMER_B: m_out_tbo_func(m_to[index]); break;
+ case TIMER_C: m_out_tco_func(m_to[index]); break;
+ case TIMER_D: m_out_tdo_func(m_to[index]); break;
}
if (m_ier & INT_MASK_TIMER[index])
@@ -772,15 +772,15 @@ void mc68901_device::device_config_complete()
void mc68901_device::device_start()
{
/* resolve callbacks */
- devcb_resolve_read8(&m_in_gpio_func, &m_in_gpio_cb, this);
- devcb_resolve_write8(&m_out_gpio_func, &m_out_gpio_cb, this);
- devcb_resolve_read_line(&m_in_si_func, &m_in_si_cb, this);
- devcb_resolve_write_line(&m_out_so_func, &m_out_so_cb, this);
- devcb_resolve_write_line(&m_out_tao_func, &m_out_tao_cb, this);
- devcb_resolve_write_line(&m_out_tbo_func, &m_out_tbo_cb, this);
- devcb_resolve_write_line(&m_out_tco_func, &m_out_tco_cb, this);
- devcb_resolve_write_line(&m_out_tdo_func, &m_out_tdo_cb, this);
- devcb_resolve_write_line(&m_out_irq_func, &m_out_irq_cb, this);
+ m_in_gpio_func.resolve(m_in_gpio_cb, *this);
+ m_out_gpio_func.resolve(m_out_gpio_cb, *this);
+ m_in_si_func.resolve(m_in_si_cb, *this);
+ m_out_so_func.resolve(m_out_so_cb, *this);
+ m_out_tao_func.resolve(m_out_tao_cb, *this);
+ m_out_tbo_func.resolve(m_out_tbo_cb, *this);
+ m_out_tco_func.resolve(m_out_tco_cb, *this);
+ m_out_tdo_func.resolve(m_out_tdo_cb, *this);
+ m_out_irq_func.resolve(m_out_irq_cb, *this);
/* create the timers */
m_timer[TIMER_A] = timer_alloc(TIMER_A);
@@ -894,7 +894,7 @@ READ8_MEMBER( mc68901_device::read )
switch (offset)
{
case REGISTER_GPIP:
- m_gpip = devcb_call_read8(&m_in_gpio_func, 0);
+ m_gpip = m_in_gpio_func(0);
return m_gpip;
case REGISTER_AER: return m_aer;
@@ -961,7 +961,7 @@ void mc68901_device::register_w(offs_t offset, UINT8 data)
if (LOG) logerror("MC68901 '%s' General Purpose I/O : %x\n", tag(), data);
m_gpip = data & m_ddr;
- devcb_call_write8(&m_out_gpio_func, 0, m_gpip);
+ m_out_gpio_func(0, m_gpip);
break;
case REGISTER_AER:
@@ -1092,7 +1092,7 @@ void mc68901_device::register_w(offs_t offset, UINT8 data)
m_to[TIMER_A] = 0;
- devcb_call_write_line(&m_out_tao_func, m_to[TIMER_A]);
+ m_out_tao_func(m_to[TIMER_A]);
}
break;
@@ -1147,7 +1147,7 @@ void mc68901_device::register_w(offs_t offset, UINT8 data)
m_to[TIMER_B] = 0;
- devcb_call_write_line(&m_out_tbo_func, m_to[TIMER_B]);
+ m_out_tbo_func(m_to[TIMER_B]);
}
break;
diff --git a/src/emu/machine/mccs1850.c b/src/emu/machine/mccs1850.c
index b2848654c68..4749dac213d 100644
--- a/src/emu/machine/mccs1850.c
+++ b/src/emu/machine/mccs1850.c
@@ -131,7 +131,7 @@ inline void mccs1850_device::check_interrupt()
m_ram[REGISTER_STATUS] &= ~STATUS_IT;
}
- devcb_call_write_line(&m_out_int_func, interrupt ? ASSERT_LINE : CLEAR_LINE);
+ m_out_int_func(interrupt ? ASSERT_LINE : CLEAR_LINE);
}
@@ -143,7 +143,7 @@ inline void mccs1850_device::set_pse_line(int state)
{
m_pse = state;
- devcb_call_write_line(&m_out_pse_func, m_pse);
+ m_out_pse_func(m_pse);
}
@@ -322,9 +322,9 @@ void mccs1850_device::device_config_complete()
void mccs1850_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
- devcb_resolve_write_line(&m_out_pse_func, &m_out_pse_cb, this);
- devcb_resolve_write_line(&m_out_nuc_func, &m_out_nuc_cb, this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
+ m_out_pse_func.resolve(m_out_pse_cb, *this);
+ m_out_nuc_func.resolve(m_out_nuc_cb, *this);
// allocate timers
m_clock_timer = timer_alloc(TIMER_CLOCK);
diff --git a/src/emu/machine/mm74c922.c b/src/emu/machine/mm74c922.c
index 1aab9cc43ce..a2f0bc1b455 100644
--- a/src/emu/machine/mm74c922.c
+++ b/src/emu/machine/mm74c922.c
@@ -45,7 +45,7 @@ inline void mm74c922_device::change_output_lines()
if (LOG) logerror("MM74C922 '%s' Data Available: %u\n", tag(), m_da);
- devcb_call_write_line(&m_out_da_func, m_da);
+ m_out_da_func(m_da);
}
}
@@ -72,7 +72,7 @@ inline void mm74c922_device::detect_keypress()
{
if (m_inhibit)
{
- UINT8 data = devcb_call_read8(&m_in_x_func[m_x], 0);
+ UINT8 data = m_in_x_func[m_x](0);
if (BIT(data, m_y))
{
@@ -86,7 +86,7 @@ inline void mm74c922_device::detect_keypress()
}
else
{
- UINT8 data = devcb_call_read8(&m_in_x_func[m_x], 0);
+ UINT8 data = m_in_x_func[m_x](0);
for (int y = 0; y < m_max_y; y++)
{
@@ -169,12 +169,12 @@ void mm74c922_device::device_config_complete()
void mm74c922_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_da_func, &m_out_da_cb, this);
- devcb_resolve_read8(&m_in_x_func[0], &m_in_x1_cb, this);
- devcb_resolve_read8(&m_in_x_func[1], &m_in_x2_cb, this);
- devcb_resolve_read8(&m_in_x_func[2], &m_in_x3_cb, this);
- devcb_resolve_read8(&m_in_x_func[3], &m_in_x4_cb, this);
- devcb_resolve_read8(&m_in_x_func[4], &m_in_x5_cb, this);
+ m_out_da_func.resolve(m_out_da_cb, *this);
+ m_in_x_func[0].resolve(m_in_x1_cb, *this);
+ m_in_x_func[1].resolve(m_in_x2_cb, *this);
+ m_in_x_func[2].resolve(m_in_x3_cb, *this);
+ m_in_x_func[3].resolve(m_in_x4_cb, *this);
+ m_in_x_func[4].resolve(m_in_x5_cb, *this);
// set initial values
change_output_lines();
diff --git a/src/emu/machine/mos6529.c b/src/emu/machine/mos6529.c
index 874495bcf6f..5faadccb4f1 100644
--- a/src/emu/machine/mos6529.c
+++ b/src/emu/machine/mos6529.c
@@ -66,8 +66,8 @@ void mos6529_device::device_config_complete()
void mos6529_device::device_start()
{
// resolve callbacks
- devcb_resolve_read8(&m_in_p_func, &m_in_p_cb, this);
- devcb_resolve_write8(&m_out_p_func, &m_out_p_cb, this);
+ m_in_p_func.resolve(m_in_p_cb, *this);
+ m_out_p_func.resolve(m_out_p_cb, *this);
}
@@ -77,7 +77,7 @@ void mos6529_device::device_start()
READ8_MEMBER( mos6529_device::read )
{
- return devcb_call_read8(&m_in_p_func, 0);
+ return m_in_p_func(0);
}
@@ -87,5 +87,5 @@ READ8_MEMBER( mos6529_device::read )
WRITE8_MEMBER( mos6529_device::write )
{
- devcb_call_write8(&m_out_p_func, 0, data);
+ m_out_p_func(0, data);
}
diff --git a/src/emu/machine/msm58321.c b/src/emu/machine/msm58321.c
index 22866d345d5..9fdeb8c9e66 100644
--- a/src/emu/machine/msm58321.c
+++ b/src/emu/machine/msm58321.c
@@ -212,7 +212,7 @@ void msm58321_device::device_config_complete()
void msm58321_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_busy_func, &m_out_busy_cb, this);
+ m_out_busy_func.resolve(m_out_busy_cb, *this);
// allocate timers
m_clock_timer = timer_alloc(TIMER_CLOCK);
@@ -247,7 +247,7 @@ void msm58321_device::device_timer(emu_timer &timer, device_timer_id id, int par
break;
case TIMER_BUSY:
- devcb_call_write_line(&m_out_busy_func, m_busy);
+ m_out_busy_func(m_busy);
m_busy = !m_busy;
break;
}
diff --git a/src/emu/machine/pic8259.c b/src/emu/machine/pic8259.c
index 8e9af6ed2dc..daf0b0d7e76 100644
--- a/src/emu/machine/pic8259.c
+++ b/src/emu/machine/pic8259.c
@@ -108,12 +108,12 @@ static TIMER_CALLBACK( pic8259_timerproc )
if (LOG_GENERAL)
logerror("pic8259_timerproc(): PIC triggering IRQ #%d\n", irq);
if (!BIT(pic8259->ocw3, 2))
- devcb_call_write_line(&pic8259->out_int_func, 1);
+ pic8259->out_int_func(1);
return;
}
}
if (!BIT(pic8259->ocw3, 2))
- devcb_call_write_line(&pic8259->out_int_func, 0);
+ pic8259->out_int_func(0);
}
@@ -186,7 +186,7 @@ int pic8259_acknowledge(device_t *device)
if ((pic8259->cascade!=0) && (pic8259->master!=0) && (mask & pic8259->slave)) {
// it's from slave device
- return devcb_call_read8(&pic8259->read_slave_ack_func,irq);
+ return pic8259->read_slave_ack_func(irq);
} else {
if (pic8259->is_x86) {
/* For x86 mode*/
@@ -420,9 +420,9 @@ static DEVICE_START( pic8259 )
pic8259->timer = device->machine().scheduler().timer_alloc( FUNC(pic8259_timerproc), (void *)device );
/* resolve callbacks */
- devcb_resolve_write_line(&pic8259->out_int_func, &intf->out_int_func, device);
- devcb_resolve_read_line(&pic8259->sp_en_func, &intf->sp_en_func, device);
- devcb_resolve_read8(&pic8259->read_slave_ack_func, &intf->read_slave_ack_func, device);
+ pic8259->out_int_func.resolve(intf->out_int_func, *device);
+ pic8259->sp_en_func.resolve(intf->sp_en_func, *device);
+ pic8259->read_slave_ack_func.resolve(intf->read_slave_ack_func, *device);
}
@@ -451,7 +451,7 @@ static DEVICE_RESET( pic8259 ) {
pic8259->vector_addr_low = 0;
pic8259->vector_addr_high = 0;
- pic8259->master = devcb_call_read_line(&pic8259->sp_en_func);
+ pic8259->master = pic8259->sp_en_func();
}
diff --git a/src/emu/machine/pit8253.c b/src/emu/machine/pit8253.c
index bd760971d17..e37db95ddd4 100644
--- a/src/emu/machine/pit8253.c
+++ b/src/emu/machine/pit8253.c
@@ -122,8 +122,8 @@ static struct pit8253_timer *get_timer(struct _pit8253_t *pit,int which)
static int pit8253_gate(struct pit8253_timer *timer)
{
- if (timer->in_gate_func.read != NULL)
- return devcb_call_read_line(&timer->in_gate_func);
+ if (!timer->in_gate_func.isnull())
+ return timer->in_gate_func();
else
return timer->gate;
}
@@ -229,7 +229,7 @@ static void set_output(device_t *device, struct pit8253_timer *timer,int output)
if (output != timer->output)
{
timer->output = output;
- devcb_call_write_line(&timer->out_out_func, timer->output);
+ timer->out_out_func(timer->output);
}
}
@@ -991,7 +991,7 @@ static void pit8253_gate_w(device_t *device, int gate, int state)
if (timer == NULL)
return;
- if (timer->in_gate_func.read != NULL)
+ if (!timer->in_gate_func.isnull())
{
logerror("pit8253_gate_w: write has no effect because a read handler is already defined!\n");
}
@@ -1085,8 +1085,8 @@ static void common_start( device_t *device, int device_type ) {
timer->updatetimer->adjust(attotime::never, timerno);
/* resolve callbacks */
- devcb_resolve_read_line(&timer->in_gate_func, &pit8253->config->timer[timerno].in_gate_func, device);
- devcb_resolve_write_line(&timer->out_out_func, &pit8253->config->timer[timerno].out_out_func, device);
+ timer->in_gate_func.resolve(pit8253->config->timer[timerno].in_gate_func, *device);
+ timer->out_out_func.resolve(pit8253->config->timer[timerno].out_out_func, *device);
/* set up state save values */
device->save_item(NAME(timer->clockin), timerno);
@@ -1137,8 +1137,8 @@ static DEVICE_RESET( pit8253 ) {
timer->count = timer->value = timer->latch = 0;
timer->lowcount = 0;
- if (timer->in_gate_func.read != NULL)
- timer->gate = devcb_call_read_line(&timer->in_gate_func);
+ if (!timer->in_gate_func.isnull())
+ timer->gate = timer->in_gate_func();
else
timer->gate = 1;
diff --git a/src/emu/machine/rp5c01.c b/src/emu/machine/rp5c01.c
index 5206bc3c1f6..3473e0d398f 100644
--- a/src/emu/machine/rp5c01.c
+++ b/src/emu/machine/rp5c01.c
@@ -117,7 +117,7 @@ inline void rp5c01_device::set_alarm_line()
{
if (LOG) logerror("RP5C01 '%s' Alarm %u\n", tag(), alarm);
- devcb_call_write_line(&m_out_alarm_func, alarm);
+ m_out_alarm_func(alarm);
m_alarm = alarm;
}
}
@@ -317,7 +317,7 @@ void rp5c01_device::device_config_complete()
void rp5c01_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_alarm_func, &m_out_alarm_cb, this);
+ m_out_alarm_func.resolve(m_out_alarm_cb, *this);
// allocate timers
m_clock_timer = timer_alloc(TIMER_CLOCK);
diff --git a/src/emu/machine/rp5c15.c b/src/emu/machine/rp5c15.c
index 331b9c43f2a..43b1accb5b8 100644
--- a/src/emu/machine/rp5c15.c
+++ b/src/emu/machine/rp5c15.c
@@ -132,7 +132,7 @@ inline void rp5c15_device::set_alarm_line()
{
if (LOG) logerror("RP5C15 '%s' Alarm %u\n", tag(), alarm);
- devcb_call_write_line(&m_out_alarm_func, alarm);
+ m_out_alarm_func(alarm);
m_alarm = alarm;
}
}
@@ -333,8 +333,8 @@ void rp5c15_device::device_config_complete()
void rp5c15_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_alarm_func, &m_out_alarm_cb, this);
- devcb_resolve_write_line(&m_out_clkout_func, &m_out_clkout_cb, this);
+ m_out_alarm_func.resolve(m_out_alarm_cb, *this);
+ m_out_clkout_func.resolve(m_out_clkout_cb, *this);
// allocate timers
m_clock_timer = timer_alloc(TIMER_CLOCK);
@@ -383,7 +383,7 @@ void rp5c15_device::device_timer(emu_timer &timer, device_timer_id id, int param
case TIMER_CLKOUT:
m_clkout = !m_clkout;
- devcb_call_write_line(&m_out_clkout_func, m_clkout);
+ m_out_clkout_func(m_clkout);
break;
}
}
diff --git a/src/emu/machine/upd1990a.c b/src/emu/machine/upd1990a.c
index 3ab896a4821..51b60011107 100644
--- a/src/emu/machine/upd1990a.c
+++ b/src/emu/machine/upd1990a.c
@@ -173,8 +173,8 @@ void upd1990a_device::device_config_complete()
void upd1990a_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_data_func, &m_out_data_cb, this);
- devcb_resolve_write_line(&m_out_tp_func, &m_out_tp_cb, this);
+ m_out_data_func.resolve(m_out_data_cb, *this);
+ m_out_tp_func.resolve(m_out_tp_cb, *this);
// allocate timers
m_timer_clock = timer_alloc(TIMER_CLOCK);
@@ -233,7 +233,7 @@ void upd1990a_device::device_timer(emu_timer &timer, device_timer_id id, int par
if (LOG) logerror("uPD1990A '%s' TP %u\n", tag(), m_tp);
- devcb_call_write_line(&m_out_tp_func, m_tp);
+ m_out_tp_func(m_tp);
break;
case TIMER_DATA_OUT:
@@ -241,7 +241,7 @@ void upd1990a_device::device_timer(emu_timer &timer, device_timer_id id, int par
if (LOG) logerror("uPD1990A '%s' DATA OUT TICK %u\n", tag(), m_data_out);
- devcb_call_write_line(&m_out_data_func, m_data_out);
+ m_out_data_func(m_data_out);
break;
}
}
@@ -325,7 +325,7 @@ WRITE_LINE_MEMBER( upd1990a_device::stb_w )
/* output LSB of shift register */
m_data_out = BIT(m_shift_reg[0], 0);
- devcb_call_write_line(&m_out_data_func, m_data_out);
+ m_out_data_func(m_data_out);
/* 32 Hz time pulse */
m_timer_tp->adjust(attotime::zero, 0, attotime::from_hz(32*2));
@@ -343,7 +343,7 @@ WRITE_LINE_MEMBER( upd1990a_device::stb_w )
/* output LSB of shift register */
m_data_out = BIT(m_shift_reg[0], 0);
- devcb_call_write_line(&m_out_data_func, m_data_out);
+ m_out_data_func(m_data_out);
/* load shift register data into time counter */
for (int i = 0; i < 5; i++)
@@ -449,7 +449,7 @@ WRITE_LINE_MEMBER( upd1990a_device::clk_w )
if (LOG) logerror("uPD1990A '%s' DATA OUT %u\n", tag(), m_data_out);
- devcb_call_write_line(&m_out_data_func, m_data_out);
+ m_out_data_func(m_data_out);
}
}
}
diff --git a/src/emu/machine/upd7201.c b/src/emu/machine/upd7201.c
index 9063765b403..d86eb9b81d5 100644
--- a/src/emu/machine/upd7201.c
+++ b/src/emu/machine/upd7201.c
@@ -105,7 +105,7 @@ void upd7201_device::device_config_complete()
void upd7201_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
}
diff --git a/src/emu/machine/z80ctc.c b/src/emu/machine/z80ctc.c
index a992193b9a0..9d5333e1098 100644
--- a/src/emu/machine/z80ctc.c
+++ b/src/emu/machine/z80ctc.c
@@ -121,7 +121,7 @@ void z80ctc_device::device_start()
m_period256 = attotime::from_hz(m_clock) * 256;
// resolve callbacks
- devcb_resolve_write_line(&m_intr, &m_intr_cb, this);
+ m_intr.resolve(m_intr_cb, *this);
// start each channel
m_channel[0].start(this, 0, (m_notimer & NOTIMER_0) != 0, &m_zc0_cb);
@@ -255,7 +255,7 @@ void z80ctc_device::z80daisy_irq_reti()
void z80ctc_device::interrupt_check()
{
int state = (z80daisy_irq_state() & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE;
- devcb_call_write_line(&m_intr, state);
+ m_intr(state);
}
@@ -291,7 +291,7 @@ void z80ctc_device::ctc_channel::start(z80ctc_device *device, int index, bool no
m_device = device;
m_index = index;
if (write_line != NULL)
- devcb_resolve_write_line(&m_zc, write_line, m_device);
+ m_zc.resolve(*write_line, *m_device);
m_notimer = notimer;
m_timer = m_device->machine().scheduler().timer_alloc(FUNC(static_timer_callback), this);
@@ -504,8 +504,8 @@ void z80ctc_device::ctc_channel::timer_callback()
}
// generate the clock pulse
- devcb_call_write_line(&m_zc, 1);
- devcb_call_write_line(&m_zc, 0);
+ m_zc(1);
+ m_zc(0);
// reset the down counter
m_down = m_tconst;
diff --git a/src/emu/machine/z80dart.c b/src/emu/machine/z80dart.c
index ea3b80e9cb0..e964cb4b5a2 100644
--- a/src/emu/machine/z80dart.c
+++ b/src/emu/machine/z80dart.c
@@ -163,16 +163,16 @@ const int WR5_DTR = 0x80;
//**************************************************************************
#define RXD \
- devcb_call_read_line(&m_in_rxd_func)
+ m_in_rxd_func()
#define TXD(_state) \
- devcb_call_write_line(&m_out_txd_func, _state)
+ m_out_txd_func(_state)
#define RTS(_state) \
- devcb_call_write_line(&m_out_rts_func, _state)
+ m_out_rts_func(_state)
#define DTR(_state) \
- devcb_call_write_line(&m_out_dtr_func, _state)
+ m_out_dtr_func(_state)
@@ -242,7 +242,7 @@ void z80dart_device::device_config_complete()
void z80dart_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
m_channel[CHANNEL_A].start(this, CHANNEL_A, m_in_rxda_cb, m_out_txda_cb, m_out_dtra_cb, m_out_rtsa_cb, m_out_wrdya_cb, m_out_synca_cb);
m_channel[CHANNEL_B].start(this, CHANNEL_B, m_in_rxdb_cb, m_out_txdb_cb, m_out_dtrb_cb, m_out_rtsb_cb, m_out_wrdyb_cb, m_out_syncb_cb);
@@ -404,7 +404,7 @@ void z80dart_device::z80daisy_irq_reti()
void z80dart_device::check_interrupts()
{
int state = (z80daisy_irq_state() & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE;
- devcb_call_write_line(&m_out_int_func, state);
+ m_out_int_func(state);
}
@@ -476,12 +476,12 @@ void z80dart_device::dart_channel::start(z80dart_device *device, int index, cons
m_index = index;
m_device = device;
- devcb_resolve_read_line(&m_in_rxd_func, &in_rxd, m_device);
- devcb_resolve_write_line(&m_out_txd_func, &out_txd, m_device);
- devcb_resolve_write_line(&m_out_dtr_func, &out_dtr, m_device);
- devcb_resolve_write_line(&m_out_rts_func, &out_rts, m_device);
- devcb_resolve_write_line(&m_out_wrdy_func, &out_wrdy, m_device);
- devcb_resolve_write_line(&m_out_sync_func, &out_sync, m_device);
+ m_in_rxd_func.resolve(in_rxd, *m_device);
+ m_out_txd_func.resolve(out_txd, *m_device);
+ m_out_dtr_func.resolve(out_dtr, *m_device);
+ m_out_rts_func.resolve(out_rts, *m_device);
+ m_out_wrdy_func.resolve(out_wrdy, *m_device);
+ m_out_sync_func.resolve(out_sync, *m_device);
m_device->save_item(NAME(m_rr), m_index);
m_device->save_item(NAME(m_wr), m_index);
diff --git a/src/emu/machine/z80dma.c b/src/emu/machine/z80dma.c
index 2a2c8f3a291..2a43547cfe7 100644
--- a/src/emu/machine/z80dma.c
+++ b/src/emu/machine/z80dma.c
@@ -184,13 +184,13 @@ void z80dma_device::device_config_complete()
void z80dma_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_busreq_func, &m_out_busreq_cb, this);
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
- devcb_resolve_write_line(&m_out_bao_func, &m_out_bao_cb, this);
- devcb_resolve_read8(&m_in_mreq_func, &m_in_mreq_cb, this);
- devcb_resolve_write8(&m_out_mreq_func, &m_out_mreq_cb, this);
- devcb_resolve_read8(&m_in_iorq_func, &m_in_iorq_cb, this);
- devcb_resolve_write8(&m_out_iorq_func, &m_out_iorq_cb, this);
+ m_out_busreq_func.resolve(m_out_busreq_cb, *this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
+ m_out_bao_func.resolve(m_out_bao_cb, *this);
+ m_in_mreq_func.resolve(m_in_mreq_cb, *this);
+ m_out_mreq_func.resolve(m_out_mreq_cb, *this);
+ m_in_iorq_func.resolve(m_in_iorq_cb, *this);
+ m_out_iorq_func.resolve(m_out_iorq_cb, *this);
// allocate timer
m_timer = machine().scheduler().timer_alloc(FUNC(static_timerproc), (void *)this);
@@ -344,7 +344,7 @@ int z80dma_device::is_ready()
void z80dma_device::interrupt_check()
{
- devcb_call_write_line(&m_out_int_func, m_ip ? ASSERT_LINE : CLEAR_LINE);
+ m_out_int_func(m_ip ? ASSERT_LINE : CLEAR_LINE);
}
@@ -393,9 +393,9 @@ void z80dma_device::do_read()
if (PORTA_IS_SOURCE)
{
if (PORTA_MEMORY)
- m_latch = devcb_call_read8(&m_in_mreq_func, m_addressA);
+ m_latch = m_in_mreq_func(m_addressA);
else
- m_latch = devcb_call_read8(&m_in_iorq_func, m_addressA);
+ m_latch = m_in_iorq_func(m_addressA);
if (LOG) logerror("Z80DMA '%s' A src: %04x %s -> data: %02x\n", tag(), m_addressA, PORTA_MEMORY ? "mem" : "i/o", m_latch);
m_addressA += PORTA_FIXED ? 0 : PORTA_INC ? 1 : -1;
@@ -403,9 +403,9 @@ void z80dma_device::do_read()
else
{
if (PORTB_MEMORY)
- m_latch = devcb_call_read8(&m_in_mreq_func, m_addressB);
+ m_latch = m_in_mreq_func(m_addressB);
else
- m_latch = devcb_call_read8(&m_in_iorq_func, m_addressB);
+ m_latch = m_in_iorq_func(m_addressB);
if (LOG) logerror("Z80DMA '%s' B src: %04x %s -> data: %02x\n", tag(), m_addressB, PORTB_MEMORY ? "mem" : "i/o", m_latch);
m_addressB += PORTB_FIXED ? 0 : PORTB_INC ? 1 : -1;
@@ -440,9 +440,9 @@ int z80dma_device::do_write()
if (PORTA_IS_SOURCE)
{
if (PORTB_MEMORY)
- devcb_call_write8(&m_out_mreq_func, m_addressB, m_latch);
+ m_out_mreq_func(m_addressB, m_latch);
else
- devcb_call_write8(&m_out_iorq_func, m_addressB, m_latch);
+ m_out_iorq_func(m_addressB, m_latch);
if (LOG) logerror("Z80DMA '%s' B dst: %04x %s\n", tag(), m_addressB, PORTB_MEMORY ? "mem" : "i/o");
m_addressB += PORTB_FIXED ? 0 : PORTB_INC ? 1 : -1;
@@ -450,9 +450,9 @@ int z80dma_device::do_write()
else
{
if (PORTA_MEMORY)
- devcb_call_write8(&m_out_mreq_func, m_addressA, m_latch);
+ m_out_mreq_func(m_addressA, m_latch);
else
- devcb_call_write8(&m_out_iorq_func, m_addressA, m_latch);
+ m_out_iorq_func(m_addressA, m_latch);
if (LOG) logerror("Z80DMA '%s' A dst: %04x %s\n", tag(), m_addressA, PORTA_MEMORY ? "mem" : "i/o");
m_addressA += PORTA_FIXED ? 0 : PORTA_INC ? 1 : -1;
@@ -578,7 +578,7 @@ void z80dma_device::update_status()
}
// set the busreq line
- devcb_call_write_line(&m_out_busreq_func, pending_transfer ? ASSERT_LINE : CLEAR_LINE);
+ m_out_busreq_func(pending_transfer ? ASSERT_LINE : CLEAR_LINE);
}
diff --git a/src/emu/machine/z80pio.c b/src/emu/machine/z80pio.c
index 35046726c07..51e53b06219 100644
--- a/src/emu/machine/z80pio.c
+++ b/src/emu/machine/z80pio.c
@@ -99,7 +99,7 @@ void z80pio_device::device_start()
m_port[PORT_B].start(this, PORT_B, m_in_pb_cb, m_out_pb_cb, m_out_brdy_cb);
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
}
@@ -237,7 +237,7 @@ void z80pio_device::check_interrupts()
if (m_port[index].interrupt_signalled())
state = ASSERT_LINE;
- devcb_call_write_line(&m_out_int_func, state);
+ m_out_int_func(state);
}
@@ -284,9 +284,9 @@ void z80pio_device::pio_port::start(z80pio_device *device, int index, const devc
m_index = index;
// resolve callbacks
- devcb_resolve_read8(&m_in_p_func, &infunc, m_device);
- devcb_resolve_write8(&m_out_p_func, &outfunc, m_device);
- devcb_resolve_write_line(&m_out_rdy_func, &rdyfunc, m_device);
+ m_in_p_func.resolve(infunc, *m_device);
+ m_out_p_func.resolve(outfunc, *m_device);
+ m_out_rdy_func.resolve(rdyfunc, *m_device);
// register for state saving
m_device->save_item(NAME(m_mode), m_index);
@@ -396,7 +396,7 @@ void z80pio_device::pio_port::set_rdy(bool state)
if (LOG) logerror("Z80PIO '%s' Port %c Ready: %u\n", m_device->tag(), 'A' + m_index, state);
m_rdy = state;
- devcb_call_write_line(&m_out_rdy_func, state);
+ m_out_rdy_func(state);
}
@@ -412,7 +412,7 @@ void z80pio_device::pio_port::set_mode(int mode)
{
case MODE_OUTPUT:
// enable data output
- devcb_call_write8(&m_out_p_func, 0, m_output);
+ m_out_p_func(0, m_output);
// assert ready line
set_rdy(true);
@@ -477,9 +477,9 @@ void z80pio_device::pio_port::strobe(bool state)
if (m_stb && !state) // falling edge
{
if (m_index == PORT_A)
- devcb_call_write8(&m_out_p_func, 0, m_output);
+ m_out_p_func(0, m_output);
else
- m_device->m_port[PORT_A].m_input = devcb_call_read8(&m_device->m_port[PORT_A].m_in_p_func, 0);
+ m_device->m_port[PORT_A].m_input = m_device->m_port[PORT_A].m_in_p_func(0);
}
else if (!m_stb && state) // rising edge
{
@@ -511,7 +511,7 @@ void z80pio_device::pio_port::strobe(bool state)
if (!state)
{
// input port data
- m_input = devcb_call_read8(&m_in_p_func, 0);
+ m_input = m_in_p_func(0);
}
else if (!m_stb && state) // rising edge
{
@@ -687,7 +687,7 @@ UINT8 z80pio_device::pio_port::data_read()
if (!m_stb)
{
// input port data
- m_input = devcb_call_read8(&m_in_p_func, 0);
+ m_input = m_in_p_func(0);
}
data = m_input;
@@ -711,7 +711,7 @@ UINT8 z80pio_device::pio_port::data_read()
case MODE_BIT_CONTROL:
// input port data
- m_input = devcb_call_read8(&m_in_p_func, 0);
+ m_input = m_in_p_func(0);
data = (m_input & m_ior) | (m_output & (m_ior ^ 0xff));
break;
@@ -737,7 +737,7 @@ void z80pio_device::pio_port::data_write(UINT8 data)
m_output = data;
// output data to port
- devcb_call_write8(&m_out_p_func, 0, data);
+ m_out_p_func(0, data);
// assert ready line
set_rdy(true);
@@ -758,7 +758,7 @@ void z80pio_device::pio_port::data_write(UINT8 data)
if (!m_stb)
{
// output data to port
- devcb_call_write8(&m_out_p_func, 0, data);
+ m_out_p_func(0, data);
}
// assert ready line
@@ -770,7 +770,7 @@ void z80pio_device::pio_port::data_write(UINT8 data)
m_output = data;
// output data to port
- devcb_call_write8(&m_out_p_func, 0, m_ior | (m_output & (m_ior ^ 0xff)));
+ m_out_p_func(0, m_ior | (m_output & (m_ior ^ 0xff)));
break;
}
}
diff --git a/src/emu/machine/z80sti.c b/src/emu/machine/z80sti.c
index 8b0161fd119..33647b1748a 100644
--- a/src/emu/machine/z80sti.c
+++ b/src/emu/machine/z80sti.c
@@ -200,15 +200,15 @@ void z80sti_device::device_config_complete()
void z80sti_device::device_start()
{
// resolve callbacks
- devcb_resolve_read8(&m_in_gpio_func, &m_in_gpio_cb, this);
- devcb_resolve_write8(&m_out_gpio_func, &m_out_gpio_cb, this);
- devcb_resolve_read_line(&m_in_si_func, &m_in_si_cb, this);
- devcb_resolve_write_line(&m_out_so_func, &m_out_so_cb, this);
- devcb_resolve_write_line(&m_out_timer_func[TIMER_A], &m_out_tao_cb, this);
- devcb_resolve_write_line(&m_out_timer_func[TIMER_B], &m_out_tbo_cb, this);
- devcb_resolve_write_line(&m_out_timer_func[TIMER_C], &m_out_tco_cb, this);
- devcb_resolve_write_line(&m_out_timer_func[TIMER_D], &m_out_tdo_cb, this);
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
+ m_in_gpio_func.resolve(m_in_gpio_cb, *this);
+ m_out_gpio_func.resolve(m_out_gpio_cb, *this);
+ m_in_si_func.resolve(m_in_si_cb, *this);
+ m_out_so_func.resolve(m_out_so_cb, *this);
+ m_out_timer_func[TIMER_A].resolve(m_out_tao_cb, *this);
+ m_out_timer_func[TIMER_B].resolve(m_out_tbo_cb, *this);
+ m_out_timer_func[TIMER_C].resolve(m_out_tco_cb, *this);
+ m_out_timer_func[TIMER_D].resolve(m_out_tdo_cb, *this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
// create the counter timers
m_timer[TIMER_A] = machine().scheduler().timer_alloc(FUNC(static_timer_count), (void *)this);
@@ -382,11 +382,11 @@ void z80sti_device::check_interrupts()
{
if (m_ipr & m_imr)
{
- devcb_call_write_line(&m_out_int_func, ASSERT_LINE);
+ m_out_int_func(ASSERT_LINE);
}
else
{
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
+ m_out_int_func(CLEAR_LINE);
}
}
@@ -447,7 +447,7 @@ UINT8 z80sti_device::read(offs_t offset)
}
break;
- case Z80STI_REGISTER_GPIP: m_gpip = (devcb_call_read8(&m_in_gpio_func, 0) & ~m_ddr) | (m_gpip & m_ddr); return m_gpip;
+ case Z80STI_REGISTER_GPIP: m_gpip = (m_in_gpio_func(0) & ~m_ddr) | (m_gpip & m_ddr); return m_gpip;
case Z80STI_REGISTER_IPRB: return m_ipr & 0xff;
case Z80STI_REGISTER_IPRA: return m_ipr >> 8;
case Z80STI_REGISTER_ISRB: return m_isr & 0xff;
@@ -541,7 +541,7 @@ void z80sti_device::write(offs_t offset, UINT8 data)
LOG(("Z80STI '%s' Timer A Reset\n", tag()));
m_to[TIMER_A] = 0;
- devcb_call_write_line(&m_out_timer_func[TIMER_A], m_to[TIMER_A]);
+ m_out_timer_func[TIMER_A](m_to[TIMER_A]);
}
if (BIT(data, 3))
@@ -549,7 +549,7 @@ void z80sti_device::write(offs_t offset, UINT8 data)
LOG(("Z80STI '%s' Timer B Reset\n", tag()));
m_to[TIMER_B] = 0;
- devcb_call_write_line(&m_out_timer_func[TIMER_B], m_to[TIMER_B]);
+ m_out_timer_func[TIMER_B](m_to[TIMER_B]);
}
}
break;
@@ -559,7 +559,7 @@ void z80sti_device::write(offs_t offset, UINT8 data)
case Z80STI_REGISTER_GPIP:
LOG(("Z80STI '%s' General Purpose I/O Register: %x\n", tag(), data));
m_gpip = data & m_ddr;
- devcb_call_write8(&m_out_gpio_func, 0, m_gpip);
+ m_out_gpio_func(0, m_gpip);
break;
case Z80STI_REGISTER_IPRB:
@@ -689,7 +689,7 @@ void z80sti_device::timer_count(int index)
// toggle timer output signal
m_to[index] = !m_to[index];
- devcb_call_write_line(&m_out_timer_func[index], m_to[index]);
+ m_out_timer_func[index](m_to[index]);
if (m_ier & (1 << INT_LEVEL_TIMER[index]))
{
diff --git a/src/emu/machine/z8536.c b/src/emu/machine/z8536.c
index aa779c6f9ec..979dce43e91 100644
--- a/src/emu/machine/z8536.c
+++ b/src/emu/machine/z8536.c
@@ -253,15 +253,15 @@ inline UINT8 z8536_device::read_register(offs_t offset)
switch (offset)
{
case PORT_A_DATA:
- data = devcb_call_read8(&m_in_pa_func, 0);
+ data = m_in_pa_func(0);
break;
case PORT_B_DATA:
- data = devcb_call_read8(&m_in_pb_func, 0);
+ data = m_in_pb_func(0);
break;
case PORT_C_DATA:
- data = 0xf0 | (devcb_call_read8(&m_in_pc_func, 0) & 0x0f);
+ data = 0xf0 | (m_in_pc_func(0) & 0x0f);
break;
default:
@@ -302,11 +302,11 @@ inline void z8536_device::write_register(offs_t offset, UINT8 data)
break;
case PORT_A_DATA:
- devcb_call_write8(&m_out_pa_func, 0, data);
+ m_out_pa_func(0, data);
break;
case PORT_B_DATA:
- devcb_call_write8(&m_out_pb_func, 0, data);
+ m_out_pb_func(0, data);
break;
case PORT_C_DATA:
@@ -315,7 +315,7 @@ inline void z8536_device::write_register(offs_t offset, UINT8 data)
m_output[PORT_C] = (m_output[PORT_C] & mask) | ((data & 0x0f) & (mask ^ 0xff));
- devcb_call_write8(&m_out_pc_func, 0, m_output[PORT_C]);
+ m_out_pc_func(0, m_output[PORT_C]);
}
break;
@@ -420,13 +420,13 @@ void z8536_device::device_start()
m_timer[TIMER_3] = timer_alloc(TIMER_3);
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
- devcb_resolve_read8(&m_in_pa_func, &m_in_pa_cb, this);
- devcb_resolve_write8(&m_out_pa_func, &m_out_pa_cb, this);
- devcb_resolve_read8(&m_in_pb_func, &m_in_pb_cb, this);
- devcb_resolve_write8(&m_out_pb_func, &m_out_pb_cb, this);
- devcb_resolve_read8(&m_in_pc_func, &m_in_pc_cb, this);
- devcb_resolve_write8(&m_out_pc_func, &m_out_pc_cb, this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
+ m_in_pa_func.resolve(m_in_pa_cb, *this);
+ m_out_pa_func.resolve(m_out_pa_cb, *this);
+ m_in_pb_func.resolve(m_in_pb_cb, *this);
+ m_out_pb_func.resolve(m_out_pb_cb, *this);
+ m_in_pc_func.resolve(m_in_pc_cb, *this);
+ m_out_pc_func.resolve(m_out_pc_cb, *this);
}
diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c
index 6c872e3f9a9..8e285771b3c 100644
--- a/src/emu/sound/ay8910.c
+++ b/src/emu/sound/ay8910.c
@@ -485,14 +485,14 @@ static void ay8910_write_reg(ay8910_context *psg, int r, int v)
((psg->last_enable & 0x40) != (psg->regs[AY_ENABLE] & 0x40)))
{
/* write out 0xff if port set to input */
- devcb_call_write8(&psg->portAwrite, 0, (psg->regs[AY_ENABLE] & 0x40) ? psg->regs[AY_PORTA] : 0xff);
+ psg->portAwrite(0, (psg->regs[AY_ENABLE] & 0x40) ? psg->regs[AY_PORTA] : 0xff);
}
if ((psg->last_enable == -1) ||
((psg->last_enable & 0x80) != (psg->regs[AY_ENABLE] & 0x80)))
{
/* write out 0xff if port set to input */
- devcb_call_write8(&psg->portBwrite, 0, (psg->regs[AY_ENABLE] & 0x80) ? psg->regs[AY_PORTB] : 0xff);
+ psg->portBwrite(0, (psg->regs[AY_ENABLE] & 0x80) ? psg->regs[AY_PORTB] : 0xff);
}
psg->last_enable = psg->regs[AY_ENABLE];
@@ -521,8 +521,8 @@ static void ay8910_write_reg(ay8910_context *psg, int r, int v)
case AY_PORTA:
if (psg->regs[AY_ENABLE] & 0x40)
{
- if (psg->portAwrite.write)
- devcb_call_write8(&psg->portAwrite, 0, psg->regs[AY_PORTA]);
+ if (!psg->portAwrite.isnull())
+ psg->portAwrite(0, psg->regs[AY_PORTA]);
else
logerror("warning - write %02x to 8910 '%s' Port A\n",psg->regs[AY_PORTA],psg->device->tag());
}
@@ -534,8 +534,8 @@ static void ay8910_write_reg(ay8910_context *psg, int r, int v)
case AY_PORTB:
if (psg->regs[AY_ENABLE] & 0x80)
{
- if (psg->portBwrite.write)
- devcb_call_write8(&psg->portBwrite, 0, psg->regs[AY_PORTB]);
+ if (!psg->portBwrite.isnull())
+ psg->portBwrite(0, psg->regs[AY_PORTB]);
else
logerror("warning - write %02x to 8910 '%s' Port B\n",psg->regs[AY_PORTB],psg->device->tag());
}
@@ -742,10 +742,10 @@ void *ay8910_start_ym(void *infoptr, device_type chip_type, device_t *device, in
info->device = device;
info->intf = intf;
- devcb_resolve_read8(&info->portAread, &intf->portAread, device);
- devcb_resolve_read8(&info->portBread, &intf->portBread, device);
- devcb_resolve_write8(&info->portAwrite, &intf->portAwrite, device);
- devcb_resolve_write8(&info->portBwrite, &intf->portBwrite, device);
+ info->portAread.resolve(intf->portAread, *device);
+ info->portBread.resolve(intf->portBread, *device);
+ info->portAwrite.resolve(intf->portAwrite, *device);
+ info->portBwrite.resolve(intf->portBwrite, *device);
if ((info->intf->flags & AY8910_SINGLE_OUTPUT) != 0)
{
logerror("AY-3-8910/YM2149 using single output!\n");
@@ -884,16 +884,16 @@ int ay8910_read_ym(void *chip)
even if the port is set as output, we still need to return the external
data. Some games, like kidniki, need this to work.
*/
- if (psg->portAread.read)
- psg->regs[AY_PORTA] = devcb_call_read8(&psg->portAread, 0);
+ if (!psg->portAread.isnull())
+ psg->regs[AY_PORTA] = psg->portAread(0);
else
logerror("%s: warning - read 8910 '%s' Port A\n",psg->device->machine().describe_context(),psg->device->tag());
break;
case AY_PORTB:
if ((psg->regs[AY_ENABLE] & 0x80) != 0)
logerror("warning: read from 8910 '%s' Port B set as output\n",psg->device->tag());
- if (psg->portBread.read)
- psg->regs[AY_PORTB] = devcb_call_read8(&psg->portBread, 0);
+ if (!psg->portBread.isnull())
+ psg->regs[AY_PORTB] = psg->portBread(0);
else
logerror("%s: warning - read 8910 '%s' Port B\n",psg->device->machine().describe_context(),psg->device->tag());
break;
diff --git a/src/emu/sound/cdp1864.c b/src/emu/sound/cdp1864.c
index c96cb0c08cc..7fdd811c02d 100644
--- a/src/emu/sound/cdp1864.c
+++ b/src/emu/sound/cdp1864.c
@@ -145,14 +145,14 @@ void cdp1864_device::device_config_complete()
void cdp1864_device::device_start()
{
// resolve callbacks
- devcb_resolve_read_line(&m_in_inlace_func, &m_in_inlace_cb, this);
- devcb_resolve_read_line(&m_in_rdata_func, &m_in_rdata_cb, this);
- devcb_resolve_read_line(&m_in_bdata_func, &m_in_bdata_cb, this);
- devcb_resolve_read_line(&m_in_gdata_func, &m_in_gdata_cb, this);
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
- devcb_resolve_write_line(&m_out_dmao_func, &m_out_dmao_cb, this);
- devcb_resolve_write_line(&m_out_efx_func, &m_out_efx_cb, this);
- devcb_resolve_write_line(&m_out_hsync_func, &m_out_hsync_cb, this);
+ m_in_inlace_func.resolve(m_in_inlace_cb, *this);
+ m_in_rdata_func.resolve(m_in_rdata_cb, *this);
+ m_in_bdata_func.resolve(m_in_bdata_cb, *this);
+ m_in_gdata_func.resolve(m_in_gdata_cb, *this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
+ m_out_dmao_func.resolve(m_out_dmao_cb, *this);
+ m_out_efx_func.resolve(m_out_efx_cb, *this);
+ m_out_hsync_func.resolve(m_out_hsync_cb, *this);
// initialize palette
initialize_palette();
@@ -196,9 +196,9 @@ void cdp1864_device::device_reset()
m_disp = 0;
m_dmaout = 0;
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
- devcb_call_write_line(&m_out_dmao_func, CLEAR_LINE);
- devcb_call_write_line(&m_out_efx_func, CLEAR_LINE);
+ m_out_int_func(CLEAR_LINE);
+ m_out_dmao_func(CLEAR_LINE);
+ m_out_efx_func(CLEAR_LINE);
}
@@ -217,7 +217,7 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (m_disp)
{
- devcb_call_write_line(&m_out_int_func, ASSERT_LINE);
+ m_out_int_func(ASSERT_LINE);
}
m_int_timer->adjust(m_screen->time_until_pos( CDP1864_SCANLINE_INT_END, 0));
@@ -226,7 +226,7 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (m_disp)
{
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
+ m_out_int_func(CLEAR_LINE);
}
m_int_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_INT_START, 0));
@@ -237,22 +237,22 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
switch (scanline)
{
case CDP1864_SCANLINE_EFX_TOP_START:
- devcb_call_write_line(&m_out_efx_func, ASSERT_LINE);
+ m_out_efx_func(ASSERT_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_END, 0));
break;
case CDP1864_SCANLINE_EFX_TOP_END:
- devcb_call_write_line(&m_out_efx_func, CLEAR_LINE);
+ m_out_efx_func(CLEAR_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_BOTTOM_START, 0));
break;
case CDP1864_SCANLINE_EFX_BOTTOM_START:
- devcb_call_write_line(&m_out_efx_func, ASSERT_LINE);
+ m_out_efx_func(ASSERT_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_BOTTOM_END, 0));
break;
case CDP1864_SCANLINE_EFX_BOTTOM_END:
- devcb_call_write_line(&m_out_efx_func, CLEAR_LINE);
+ m_out_efx_func(CLEAR_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_START, 0));
break;
}
@@ -265,7 +265,7 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (scanline >= CDP1864_SCANLINE_DISPLAY_START && scanline < CDP1864_SCANLINE_DISPLAY_END)
{
- devcb_call_write_line(&m_out_dmao_func, CLEAR_LINE);
+ m_out_dmao_func(CLEAR_LINE);
}
}
@@ -279,7 +279,7 @@ void cdp1864_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (scanline >= CDP1864_SCANLINE_DISPLAY_START && scanline < CDP1864_SCANLINE_DISPLAY_END)
{
- devcb_call_write_line(&m_out_dmao_func, ASSERT_LINE);
+ m_out_dmao_func(ASSERT_LINE);
}
}
@@ -362,8 +362,8 @@ READ8_MEMBER( cdp1864_device::dispoff_r )
{
m_disp = 0;
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
- devcb_call_write_line(&m_out_dmao_func, CLEAR_LINE);
+ m_out_int_func(CLEAR_LINE);
+ m_out_dmao_func(CLEAR_LINE);
return 0xff;
}
@@ -408,9 +408,9 @@ WRITE8_MEMBER( cdp1864_device::dma_w )
if (!m_con)
{
- rdata = devcb_call_read_line(&m_in_rdata_func);
- bdata = devcb_call_read_line(&m_in_bdata_func);
- gdata = devcb_call_read_line(&m_in_gdata_func);
+ rdata = m_in_rdata_func();
+ bdata = m_in_bdata_func();
+ gdata = m_in_gdata_func();
}
for (int x = 0; x < 8; x++)
diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c
index 07417111c68..5387abdf30a 100644
--- a/src/emu/sound/cdp1869.c
+++ b/src/emu/sound/cdp1869.c
@@ -76,7 +76,7 @@ ADDRESS_MAP_END
inline bool cdp1869_device::is_ntsc()
{
- return devcb_call_read_line(&m_in_pal_ntsc_func) ? false : true;
+ return m_in_pal_ntsc_func() ? false : true;
}
@@ -369,8 +369,8 @@ void cdp1869_device::device_start()
assert(m_screen != NULL);
// resolve callbacks
- devcb_resolve_read_line(&m_in_pal_ntsc_func, &in_pal_ntsc_cb, this);
- devcb_resolve_write_line(&m_out_prd_func, &out_prd_cb, this);
+ m_in_pal_ntsc_func.resolve(in_pal_ntsc_cb, *this);
+ m_out_prd_func.resolve(out_prd_cb, *this);
m_in_pcb_func = in_pcb_cb;
m_in_char_ram_func = in_char_ram_cb;
m_out_char_ram_func = out_char_ram_cb;
@@ -427,7 +427,7 @@ void cdp1869_device::device_post_load()
void cdp1869_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- devcb_call_write_line(&m_out_prd_func, param);
+ m_out_prd_func(param);
m_prd = param;
update_prd_changed_timer();
@@ -899,7 +899,7 @@ READ_LINE_MEMBER( cdp1869_device::predisplay_r )
READ_LINE_MEMBER( cdp1869_device::pal_ntsc_r )
{
- return devcb_call_read_line(&m_in_pal_ntsc_func);
+ return m_in_pal_ntsc_func();
}
diff --git a/src/emu/sound/pokey.c b/src/emu/sound/pokey.c
index 3d24de83aae..56968981b21 100644
--- a/src/emu/sound/pokey.c
+++ b/src/emu/sound/pokey.c
@@ -657,11 +657,11 @@ static DEVICE_START( pokey )
for (i=0; i<8; i++)
{
chip->ptimer[i] = device->machine().scheduler().timer_alloc(FUNC(pokey_pot_trigger), chip);
- devcb_resolve_read8(&chip->pot_r[i], &chip->intf.pot_r[i], device);
+ chip->pot_r[i].resolve(chip->intf.pot_r[i], *device);
}
- devcb_resolve_read8(&chip->allpot_r, &chip->intf.allpot_r, device);
- devcb_resolve_read8(&chip->serin_r, &chip->intf.serin_r, device);
- devcb_resolve_write8(&chip->serout_w, &chip->intf.serout_w, device);
+ chip->allpot_r.resolve(chip->intf.allpot_r, *device);
+ chip->serin_r.resolve(chip->intf.serin_r, *device);
+ chip->serout_w.resolve(chip->intf.serout_w, *device);
chip->interrupt_cb = chip->intf.interrupt_cb;
chip->channel = device->machine().sound().stream_alloc(*device, 0, 1, sample_rate, chip, pokey_update);
@@ -795,9 +795,9 @@ static void pokey_potgo(pokey_state *p)
for( pot = 0; pot < 8; pot++ )
{
p->POTx[pot] = 0xff;
- if( p->pot_r[pot].read )
+ if( !p->pot_r[pot].isnull() )
{
- int r = devcb_call_read8(&p->pot_r[pot], pot);
+ int r = p->pot_r[pot](pot);
LOG(("POKEY %s pot_r(%d) returned $%02x\n", p->device->tag(), pot, r));
if( r != -1 )
@@ -824,7 +824,7 @@ READ8_DEVICE_HANDLER( pokey_r )
case POT0_C: case POT1_C: case POT2_C: case POT3_C:
case POT4_C: case POT5_C: case POT6_C: case POT7_C:
pot = offset & 7;
- if( p->pot_r[pot].read )
+ if( !p->pot_r[pot].isnull() )
{
/*
* If the conversion is not yet finished (ptimer running),
@@ -856,9 +856,9 @@ READ8_DEVICE_HANDLER( pokey_r )
data = 0;
LOG(("POKEY '%s' ALLPOT internal $%02x (reset)\n", p->device->tag(), data));
}
- else if( p->allpot_r.read )
+ else if( !p->allpot_r.isnull() )
{
- data = devcb_call_read8(&p->allpot_r, offset);
+ data = p->allpot_r(offset);
LOG(("POKEY '%s' ALLPOT callback $%02x\n", p->device->tag(), data));
}
else
@@ -910,8 +910,8 @@ READ8_DEVICE_HANDLER( pokey_r )
break;
case SERIN_C:
- if( p->serin_r.read )
- p->SERIN = devcb_call_read8(&p->serin_r, offset);
+ if( !p->serin_r.isnull() )
+ p->SERIN = p->serin_r(offset);
data = p->SERIN;
LOG(("POKEY '%s' SERIN $%02x\n", p->device->tag(), data));
break;
@@ -1131,7 +1131,7 @@ WRITE8_DEVICE_HANDLER( pokey_w )
case SEROUT_C:
LOG(("POKEY '%s' SEROUT $%02x\n", p->device->tag(), data));
- devcb_call_write8(&p->serout_w, offset, data);
+ p->serout_w(offset, data);
p->SKSTAT |= SK_SEROUT;
/*
* These are arbitrary values, tested with some custom boot
diff --git a/src/emu/sound/sp0256.c b/src/emu/sound/sp0256.c
index acdf69dc78a..d6ed1337ac4 100644
--- a/src/emu/sound/sp0256.c
+++ b/src/emu/sound/sp0256.c
@@ -55,7 +55,7 @@
if( sp->sby_line != line_state ) \
{ \
sp->sby_line = line_state; \
- devcb_call_write_line(&sp->sby, sp->sby_line); \
+ sp->sby(sp->sby_line); \
} \
}
@@ -773,7 +773,7 @@ static void sp0256_micro(sp0256_state *sp)
sp->ald = 0;
for (i = 0; i < 16; i++)
sp->filt.r[i] = 0;
- devcb_call_write_line(&sp->drq, 1);
+ sp->drq(1);
}
/* ---------------------------------------------------------------- */
@@ -1181,10 +1181,10 @@ static DEVICE_START( sp0256 )
sp0256_state *sp = get_safe_token(device);
sp->device = device;
- devcb_resolve_write_line(&sp->drq, &intf->lrq_callback, device);
- devcb_resolve_write_line(&sp->sby, &intf->sby_callback, device);
- devcb_call_write_line(&sp->drq, 1);
- devcb_call_write_line(&sp->sby, 1);
+ sp->drq.resolve(intf->lrq_callback, *device);
+ sp->sby.resolve(intf->sby_callback, *device);
+ sp->drq(1);
+ sp->sby(1);
sp->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() / CLOCK_DIVIDER, sp, sp0256_update);
@@ -1234,7 +1234,7 @@ static void sp0256_reset(sp0256_state *sp)
sp->mode = 0;
sp->page = 0x1000 << 3;
sp->silent = 1;
- devcb_call_write_line(&sp->drq, 1);
+ sp->drq(1);
SET_SBY(1)
}
@@ -1263,7 +1263,7 @@ WRITE8_DEVICE_HANDLER( sp0256_ALD_w )
/* ---------------------------------------------------------------- */
sp->lrq = 0;
sp->ald = (0xFF & data) << 4;
- devcb_call_write_line(&sp->drq, 0);
+ sp->drq(0);
SET_SBY(0)
return;
diff --git a/src/emu/sound/tms5110.c b/src/emu/sound/tms5110.c
index 0bf70e8d298..fef1b4f35d2 100644
--- a/src/emu/sound/tms5110.c
+++ b/src/emu/sound/tms5110.c
@@ -247,16 +247,16 @@ void tms5110_set_variant(tms5110_state *tms, int variant)
static void new_int_write(tms5110_state *tms, UINT8 rc, UINT8 m0, UINT8 m1, UINT8 addr)
{
- if (tms->m0_func.write)
- devcb_call_write_line(&tms->m0_func, m0);
- if (tms->m1_func.write)
- devcb_call_write_line(&tms->m1_func, m1);
- if (tms->addr_func.write)
- devcb_call_write8(&tms->addr_func, 0, addr);
- if (tms->romclk_func.write)
+ if (!tms->m0_func.isnull())
+ tms->m0_func(m0);
+ if (!tms->m1_func.isnull())
+ tms->m1_func(m1);
+ if (!tms->addr_func.isnull())
+ tms->addr_func(0, addr);
+ if (!tms->romclk_func.isnull())
{
//printf("rc %d\n", rc);
- devcb_call_write_line(&tms->romclk_func, rc);
+ tms->romclk_func(rc);
}
}
@@ -274,8 +274,8 @@ static UINT8 new_int_read(tms5110_state *tms)
new_int_write(tms, 0, 1, 0, 0);
new_int_write(tms, 1, 0, 0, 0);
new_int_write(tms, 0, 0, 0, 0);
- if (tms->data_func.read)
- return devcb_call_read_line(&tms->data_func);
+ if (!tms->data_func.isnull())
+ return tms->data_func();
return 0;
}
@@ -1024,11 +1024,11 @@ static DEVICE_START( tms5110 )
tms5110_set_variant(tms, TMS5110_IS_5110A);
/* resolve lines */
- devcb_resolve_write_line(&tms->m0_func, &tms->intf->m0_func, device);
- devcb_resolve_write_line(&tms->m1_func, &tms->intf->m1_func, device);
- devcb_resolve_write_line(&tms->romclk_func, &tms->intf->romclk_func, device);
- devcb_resolve_write8(&tms->addr_func, &tms->intf->addr_func, device);
- devcb_resolve_read_line(&tms->data_func, &tms->intf->data_func, device);
+ tms->m0_func.resolve(tms->intf->m0_func, *device);
+ tms->m1_func.resolve(tms->intf->m1_func, *device);
+ tms->romclk_func.resolve(tms->intf->romclk_func, *device);
+ tms->addr_func.resolve(tms->intf->addr_func, *device);
+ tms->data_func.resolve(tms->intf->data_func, *device);
/* initialize a stream */
tms->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() / 80, tms, tms5110_update);
@@ -1394,10 +1394,10 @@ static TIMER_CALLBACK( tmsprom_step )
if (ctrl & (1 << tms->intf->reset_bit))
tms->address = 0;
- devcb_call_write8(&tms->ctl_func, 0, BITSWAP8(ctrl,0,0,0,0,tms->intf->ctl8_bit,
+ tms->ctl_func(0, BITSWAP8(ctrl,0,0,0,0,tms->intf->ctl8_bit,
tms->intf->ctl4_bit,tms->intf->ctl2_bit,tms->intf->ctl1_bit));
- devcb_call_write_line(&tms->pdc_func, (ctrl >> tms->intf->pdc_bit) & 0x01);
+ tms->pdc_func((ctrl >> tms->intf->pdc_bit) & 0x01);
}
static DEVICE_START( tmsprom )
@@ -1410,8 +1410,8 @@ static DEVICE_START( tmsprom )
assert_always(tms->intf != NULL, "Error creating TMSPROM chip: No configuration");
/* resolve lines */
- devcb_resolve_write_line(&tms->pdc_func, &tms->intf->pdc_func, device);
- devcb_resolve_write8(&tms->ctl_func, &tms->intf->ctl_func, device);
+ tms->pdc_func.resolve(tms->intf->pdc_func, *device);
+ tms->ctl_func.resolve(tms->intf->ctl_func, *device);
tms->rom = *device->region();
assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No rom region found");
diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c
index a1cbda636c3..db0a95157e0 100644
--- a/src/emu/sound/tms5220.c
+++ b/src/emu/sound/tms5220.c
@@ -1539,8 +1539,8 @@ static void set_interrupt_state(tms5220_state *tms, int state)
#ifdef DEBUG_PIN_READS
logerror("irq pin set to state %d\n", state);
#endif
- if (tms->irq_func.write && state != tms->irq_pin)
- devcb_call_write_line(&tms->irq_func, !state);
+ if (!tms->irq_func.isnull() && state != tms->irq_pin)
+ tms->irq_func(!state);
tms->irq_pin = state;
}
@@ -1556,8 +1556,8 @@ static void update_ready_state(tms5220_state *tms)
#ifdef DEBUG_PIN_READS
logerror("ready pin set to state %d\n", state);
#endif
- if (tms->readyq_func.write && state != tms->ready_pin)
- devcb_call_write_line(&tms->readyq_func, !state);
+ if (!tms->readyq_func.isnull() && state != tms->ready_pin)
+ tms->readyq_func(!state);
tms->ready_pin = state;
}
@@ -1583,8 +1583,8 @@ static DEVICE_START( tms5220 )
assert_always(tms != NULL, "Error creating TMS5220 chip");
/* resolve irq and readyq line */
- devcb_resolve_write_line(&tms->irq_func, &tms->intf->irq_func, device);
- devcb_resolve_write_line(&tms->readyq_func, &tms->intf->readyq_func, device);
+ tms->irq_func.resolve(tms->intf->irq_func, *device);
+ tms->readyq_func.resolve(tms->intf->readyq_func, *device);
/* initialize a stream */
tms->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() / 80, tms, tms5220_update);
diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c
index dcfe3a2fe53..249dc42105c 100644
--- a/src/emu/sound/ymf271.c
+++ b/src/emu/sound/ymf271.c
@@ -1402,9 +1402,9 @@ static TIMER_CALLBACK( ymf271_timer_b_tick )
static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address)
{
- if( chip->ext_mem_read.read )
+ if( !chip->ext_mem_read.isnull() )
{
- return devcb_call_read8(&chip->ext_mem_read, address);
+ return chip->ext_mem_read(address);
}
else
{
@@ -1416,7 +1416,7 @@ static UINT8 ymf271_read_ext_memory(YMF271Chip *chip, UINT32 address)
static void ymf271_write_ext_memory(YMF271Chip *chip, UINT32 address, UINT8 data)
{
- devcb_call_write8(&chip->ext_mem_write, address, data);
+ chip->ext_mem_write(address, data);
}
static void ymf271_write_timer(YMF271Chip *chip, int data)
@@ -1758,8 +1758,8 @@ static void ymf271_init(device_t *device, YMF271Chip *chip, UINT8 *rom, void (*c
chip->rom = rom;
chip->irq_callback = cb;
- devcb_resolve_read8(&chip->ext_mem_read, ext_read, device);
- devcb_resolve_write8(&chip->ext_mem_write, ext_write, device);
+ chip->ext_mem_read.resolve(*ext_read, *device);
+ chip->ext_mem_write.resolve(*ext_write, *device);
init_tables(device->machine());
init_state(chip, device);
diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c
index 6d58cc99af3..6de02311f96 100644
--- a/src/emu/sound/ymz280b.c
+++ b/src/emu/sound/ymz280b.c
@@ -638,8 +638,8 @@ static DEVICE_START( ymz280b )
ymz280b_state *chip = get_safe_token(device);
chip->device = device;
- devcb_resolve_read8(&chip->ext_ram_read, &intf->ext_read, device);
- devcb_resolve_write8(&chip->ext_ram_write, &intf->ext_write, device);
+ chip->ext_ram_read.resolve(intf->ext_read, *device);
+ chip->ext_ram_write.resolve(intf->ext_write, *device);
/* compute ADPCM tables */
compute_tables();
@@ -839,8 +839,8 @@ static void write_to_register(ymz280b_state *chip, int data)
break;
case 0x87: /* RAM write */
- if (chip->ext_ram_write.write)
- devcb_call_write8(&chip->ext_ram_write, chip->rom_readback_addr, data);
+ if (!chip->ext_ram_write.isnull())
+ chip->ext_ram_write(chip->rom_readback_addr, data);
else
logerror("YMZ280B attempted RAM write to %X\n", chip->rom_readback_addr);
break;
@@ -925,7 +925,7 @@ READ8_DEVICE_HANDLER( ymz280b_r )
ymz280b_state *chip = get_safe_token(device);
if ((offset & 1) == 0)
- return devcb_call_read8(&chip->ext_ram_read, chip->rom_readback_addr++ - 1);
+ return chip->ext_ram_read(chip->rom_readback_addr++ - 1);
else
return compute_status(chip);
}
diff --git a/src/emu/video/cdp1861.c b/src/emu/video/cdp1861.c
index dffa37af41b..796f9567cce 100644
--- a/src/emu/video/cdp1861.c
+++ b/src/emu/video/cdp1861.c
@@ -70,9 +70,9 @@ void cdp1861_device::device_config_complete()
void cdp1861_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
- devcb_resolve_write_line(&m_out_dmao_func, &m_out_dmao_cb, this);
- devcb_resolve_write_line(&m_out_efx_func, &m_out_efx_cb, this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
+ m_out_dmao_func.resolve(m_out_dmao_cb, *this);
+ m_out_efx_func.resolve(m_out_efx_cb, *this);
// allocate timers
m_int_timer = timer_alloc(TIMER_INT);
@@ -105,9 +105,9 @@ void cdp1861_device::device_reset()
m_disp = 0;
m_dmaout = 0;
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
- devcb_call_write_line(&m_out_dmao_func, CLEAR_LINE);
- devcb_call_write_line(&m_out_efx_func, CLEAR_LINE);
+ m_out_int_func(CLEAR_LINE);
+ m_out_dmao_func(CLEAR_LINE);
+ m_out_efx_func(CLEAR_LINE);
}
@@ -126,7 +126,7 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (m_disp)
{
- devcb_call_write_line(&m_out_int_func, ASSERT_LINE);
+ m_out_int_func(ASSERT_LINE);
}
m_int_timer->adjust(m_screen->time_until_pos( CDP1861_SCANLINE_INT_END, 0));
@@ -135,7 +135,7 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (m_disp)
{
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
+ m_out_int_func(CLEAR_LINE);
}
m_int_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0));
@@ -146,22 +146,22 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
switch (scanline)
{
case CDP1861_SCANLINE_EFX_TOP_START:
- devcb_call_write_line(&m_out_efx_func, ASSERT_LINE);
+ m_out_efx_func(ASSERT_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_END, 0));
break;
case CDP1861_SCANLINE_EFX_TOP_END:
- devcb_call_write_line(&m_out_efx_func, CLEAR_LINE);
+ m_out_efx_func(CLEAR_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_START, 0));
break;
case CDP1861_SCANLINE_EFX_BOTTOM_START:
- devcb_call_write_line(&m_out_efx_func, ASSERT_LINE);
+ m_out_efx_func(ASSERT_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_END, 0));
break;
case CDP1861_SCANLINE_EFX_BOTTOM_END:
- devcb_call_write_line(&m_out_efx_func, CLEAR_LINE);
+ m_out_efx_func(CLEAR_LINE);
m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0));
break;
}
@@ -174,7 +174,7 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (scanline >= CDP1861_SCANLINE_DISPLAY_START && scanline < CDP1861_SCANLINE_DISPLAY_END)
{
- devcb_call_write_line(&m_out_dmao_func, CLEAR_LINE);
+ m_out_dmao_func(CLEAR_LINE);
}
}
@@ -188,7 +188,7 @@ void cdp1861_device::device_timer(emu_timer &timer, device_timer_id id, int para
{
if (scanline >= CDP1861_SCANLINE_DISPLAY_START && scanline < CDP1861_SCANLINE_DISPLAY_END)
{
- devcb_call_write_line(&m_out_dmao_func, ASSERT_LINE);
+ m_out_dmao_func(ASSERT_LINE);
}
}
@@ -242,8 +242,8 @@ WRITE_LINE_MEMBER( cdp1861_device::disp_off_w )
m_dispoff = state;
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
- devcb_call_write_line(&m_out_dmao_func, CLEAR_LINE);
+ m_out_int_func(CLEAR_LINE);
+ m_out_dmao_func(CLEAR_LINE);
}
diff --git a/src/emu/video/cdp1862.c b/src/emu/video/cdp1862.c
index 5f8d8cfe139..f1a6b276d39 100644
--- a/src/emu/video/cdp1862.c
+++ b/src/emu/video/cdp1862.c
@@ -116,9 +116,9 @@ void cdp1862_device::device_config_complete()
void cdp1862_device::device_start()
{
// resolve callbacks
- devcb_resolve_read_line(&m_in_rd_func, &m_in_rd_cb, this);
- devcb_resolve_read_line(&m_in_bd_func, &m_in_bd_cb, this);
- devcb_resolve_read_line(&m_in_gd_func, &m_in_gd_cb, this);
+ m_in_rd_func.resolve(m_in_rd_cb, *this);
+ m_in_bd_func.resolve(m_in_bd_cb, *this);
+ m_in_gd_func.resolve(m_in_gd_cb, *this);
// find devices
m_screen = machine().device<screen_device>(m_screen_tag);
@@ -157,9 +157,9 @@ WRITE8_MEMBER( cdp1862_device::dma_w )
if (!m_con)
{
- rd = devcb_call_read_line(&m_in_rd_func);
- bd = devcb_call_read_line(&m_in_bd_func);
- gd = devcb_call_read_line(&m_in_gd_func);
+ rd = m_in_rd_func();
+ bd = m_in_bd_func();
+ gd = m_in_gd_func();
}
for (x = 0; x < 8; x++)
diff --git a/src/emu/video/crt9007.c b/src/emu/video/crt9007.c
index de4ed8dec06..731b2a20aaf 100644
--- a/src/emu/video/crt9007.c
+++ b/src/emu/video/crt9007.c
@@ -250,7 +250,7 @@ inline void crt9007_device::trigger_interrupt(int line)
if (!(status & STATUS_INTERRUPT_PENDING))
{
if (LOG) logerror("CRT9007 '%s' INT 1\n", tag());
- devcb_call_write_line(&m_out_int_func, ASSERT_LINE);
+ m_out_int_func(ASSERT_LINE);
}
}
}
@@ -274,7 +274,7 @@ inline void crt9007_device::update_cblank_line()
if (LOG) logerror("CRT9007 '%s' y %03u x %04u : CBLANK %u\n", tag(), y, x, m_cblank);
- devcb_call_write_line(&m_out_cblank_func, m_cblank);
+ m_out_cblank_func(m_cblank);
}
}
@@ -504,16 +504,16 @@ void crt9007_device::device_start()
m_dma_timer = timer_alloc(TIMER_DMA);
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
- devcb_resolve_write_line(&m_out_dmar_func, &m_out_dmar_cb, this);
- devcb_resolve_write_line(&m_out_hs_func, &m_out_hs_cb, this);
- devcb_resolve_write_line(&m_out_vs_func, &m_out_vs_cb, this);
- devcb_resolve_write_line(&m_out_vlt_func, &m_out_vlt_cb, this);
- devcb_resolve_write_line(&m_out_curs_func, &m_out_curs_cb, this);
- devcb_resolve_write_line(&m_out_drb_func, &m_out_drb_cb, this);
- devcb_resolve_write_line(&m_out_cblank_func, &m_out_cblank_cb, this);
- devcb_resolve_write_line(&m_out_slg_func, &m_out_slg_cb, this);
- devcb_resolve_write_line(&m_out_sld_func, &m_out_sld_cb, this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
+ m_out_dmar_func.resolve(m_out_dmar_cb, *this);
+ m_out_hs_func.resolve(m_out_hs_cb, *this);
+ m_out_vs_func.resolve(m_out_vs_cb, *this);
+ m_out_vlt_func.resolve(m_out_vlt_cb, *this);
+ m_out_curs_func.resolve(m_out_curs_cb, *this);
+ m_out_drb_func.resolve(m_out_drb_cb, *this);
+ m_out_cblank_func.resolve(m_out_cblank_cb, *this);
+ m_out_slg_func.resolve(m_out_slg_cb, *this);
+ m_out_sld_func.resolve(m_out_sld_cb, *this);
// get the screen device
m_screen = machine().device<screen_device>(m_screen_tag);
@@ -536,36 +536,36 @@ void crt9007_device::device_reset()
m_disp = 0;
// HS = 1
- devcb_call_write_line(&m_out_hs_func, 1);
+ m_out_hs_func(1);
// VS = 1
- devcb_call_write_line(&m_out_vs_func, 1);
+ m_out_vs_func(1);
// CBLANK = 1
- devcb_call_write_line(&m_out_cblank_func, 0);
+ m_out_cblank_func(0);
// CURS = 0
- devcb_call_write_line(&m_out_curs_func, 0);
+ m_out_curs_func(0);
// VLT = 0
- devcb_call_write_line(&m_out_vlt_func, 0);
+ m_out_vlt_func(0);
// DRB = 1
- devcb_call_write_line(&m_out_drb_func, 1);
+ m_out_drb_func(1);
// INT = 0
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
+ m_out_int_func(CLEAR_LINE);
// 28 (DMAR) = 0
- devcb_call_write_line(&m_out_dmar_func, CLEAR_LINE);
+ m_out_dmar_func(CLEAR_LINE);
// 29 (WBEN) = 0
// 30 (SLG) = 0
- devcb_call_write_line(&m_out_slg_func, 0);
+ m_out_slg_func(0);
// 31 (SLD) = 0
- devcb_call_write_line(&m_out_sld_func, 0);
+ m_out_sld_func(0);
// 32 (LPSTB) = 0
}
@@ -597,7 +597,7 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
if (LOG) logerror("CRT9007 '%s' y %03u x %04u : HS %u\n", tag(), y, x, m_hs);
- devcb_call_write_line(&m_out_hs_func, m_hs);
+ m_out_hs_func(m_hs);
update_cblank_line();
@@ -609,7 +609,7 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
if (LOG) logerror("CRT9007 '%s' y %03u x %04u : VS %u\n", tag(), y, x, m_vs);
- devcb_call_write_line(&m_out_vs_func, param);
+ m_out_vs_func(param);
if (m_vs)
{
@@ -631,7 +631,7 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
if (LOG) logerror("CRT9007 '%s' y %03u x %04u : VLT %u\n", tag(), y, x, m_vlt);
- devcb_call_write_line(&m_out_vlt_func, param);
+ m_out_vlt_func(param);
update_vlt_timer(param);
break;
@@ -639,7 +639,7 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
case TIMER_CURS:
if (LOG) logerror("CRT9007 '%s' y %03u x %04u : CURS %u\n", tag(), y, x, param);
- devcb_call_write_line(&m_out_curs_func, param);
+ m_out_curs_func(param);
update_curs_timer(param);
break;
@@ -649,7 +649,7 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
if (LOG) logerror("CRT9007 '%s' y %03u x %04u : DRB %u\n", tag(), y, x, m_drb);
- devcb_call_write_line(&m_out_drb_func, param);
+ m_out_drb_func(param);
if (!m_drb && !DMA_DISABLE)
{
@@ -660,7 +660,7 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_dmar = 1;
if (LOG) logerror("CRT9007 '%s' DMAR 1\n", tag());
- devcb_call_write_line(&m_out_dmar_func, ASSERT_LINE);
+ m_out_dmar_func(ASSERT_LINE);
}
update_drb_timer(param);
@@ -720,7 +720,7 @@ READ8_MEMBER( crt9007_device::read )
// reset interrupt pending bit
m_status &= ~STATUS_INTERRUPT_PENDING;
if (LOG) logerror("CRT9007 '%s' INT 0\n", tag());
- devcb_call_write_line(&m_out_int_func, CLEAR_LINE);
+ m_out_int_func(CLEAR_LINE);
break;
case 0x3b:
diff --git a/src/emu/video/crt9021.c b/src/emu/video/crt9021.c
index 5f82c8579e2..909ceb59943 100644
--- a/src/emu/video/crt9021.c
+++ b/src/emu/video/crt9021.c
@@ -119,9 +119,9 @@ void crt9021_device::device_start()
// allocate timers
// resolve callbacks
- devcb_resolve_read8(&m_in_data_func, &in_data_cb, this);
- devcb_resolve_read8(&m_in_attr_func, &in_attr_cb, this);
- devcb_resolve_read_line(&m_in_atten_func, &in_atten_cb, this);
+ m_in_data_func.resolve(in_data_cb, *this);
+ m_in_attr_func.resolve(in_attr_cb, *this);
+ m_in_atten_func.resolve(in_atten_cb, *this);
// get the screen device
m_screen = machine().device<screen_device>(screen_tag);
diff --git a/src/emu/video/crt9212.c b/src/emu/video/crt9212.c
index 6ee7f95ea5a..b847e7f97aa 100644
--- a/src/emu/video/crt9212.c
+++ b/src/emu/video/crt9212.c
@@ -20,19 +20,19 @@
#define REN \
- devcb_call_read_line(&m_in_ren_func)
+ m_in_ren_func()
#define WEN \
- devcb_call_read_line(&m_in_wen_func)
+ m_in_wen_func()
#define WEN2 \
- devcb_call_read_line(&m_in_wen2_func)
+ m_in_wen2_func()
#define ROF(_state) \
- devcb_call_write_line(&m_out_rof_func, _state);
+ m_out_rof_func(_state);
#define WOF(_state) \
- devcb_call_write_line(&m_out_wof_func, _state);
+ m_out_wof_func(_state);
@@ -90,11 +90,11 @@ void crt9212_device::device_config_complete()
void crt9212_device::device_start()
{
// resolve callbacks
- devcb_resolve_write_line(&m_out_rof_func, &m_out_rof_cb, this);
- devcb_resolve_write_line(&m_out_wof_func, &m_out_wof_cb, this);
- devcb_resolve_read_line(&m_in_ren_func, &m_in_ren_cb, this);
- devcb_resolve_read_line(&m_in_wen_func, &m_in_wen_cb, this);
- devcb_resolve_read_line(&m_in_wen2_func, &m_in_wen2_cb, this);
+ m_out_rof_func.resolve(m_out_rof_cb, *this);
+ m_out_wof_func.resolve(m_out_wof_cb, *this);
+ m_in_ren_func.resolve(m_in_ren_cb, *this);
+ m_in_wen_func.resolve(m_in_wen_cb, *this);
+ m_in_wen2_func.resolve(m_in_wen2_cb, *this);
// register for state saving
save_item(NAME(m_input));
diff --git a/src/emu/video/dm9368.c b/src/emu/video/dm9368.c
index 604c291d091..8f10b5db48c 100644
--- a/src/emu/video/dm9368.c
+++ b/src/emu/video/dm9368.c
@@ -40,9 +40,9 @@ static const UINT8 OUTPUT[16] =
inline int dm9368_device::get_rbi()
{
- if (m_in_rbi_func.target != NULL)
+ if (!m_in_rbi_func.isnull())
{
- m_rbi = devcb_call_read_line(&m_in_rbi_func);
+ m_rbi = m_in_rbi_func();
}
return m_rbi;
@@ -57,7 +57,7 @@ inline void dm9368_device::set_rbo(int state)
{
m_rbo = state;
- devcb_call_write_line(&m_out_rbo_func, m_rbo);
+ m_out_rbo_func(m_rbo);
}
@@ -107,8 +107,8 @@ void dm9368_device::device_config_complete()
void dm9368_device::device_start()
{
// resolve callbacks
- devcb_resolve_read_line(&m_in_rbi_func, &m_in_rbi_cb, this);
- devcb_resolve_write_line(&m_out_rbo_func, &m_out_rbo_cb, this);
+ m_in_rbi_func.resolve(m_in_rbi_cb, *this);
+ m_out_rbo_func.resolve(m_out_rbo_cb, *this);
// register for state saving
save_item(NAME(m_rbi));
diff --git a/src/emu/video/hd61830.c b/src/emu/video/hd61830.c
index b4c8155030b..d27d20ceeb6 100644
--- a/src/emu/video/hd61830.c
+++ b/src/emu/video/hd61830.c
@@ -157,7 +157,7 @@ void hd61830_device::device_start()
m_busy_timer = timer_alloc();
// resolve callbacks
- devcb_resolve_read8(&m_in_rd_func, &m_in_rd_cb, this);
+ m_in_rd_func.resolve(m_in_rd_cb, *this);
m_screen = machine().device<screen_device>(screen_tag);
@@ -456,7 +456,7 @@ void hd61830_device::draw_char(bitmap_t *bitmap, const rectangle *cliprect, UINT
if (m_mcr & MODE_EXTERNAL_CG)
{
- data = devcb_call_read8(&m_in_rd_func, (cl << 12) | md);
+ data = m_in_rd_func((cl << 12) | md);
}
else
{
diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c
index 5774d9fa45d..0445020f957 100644
--- a/src/emu/video/mc6845.c
+++ b/src/emu/video/mc6845.c
@@ -474,8 +474,8 @@ INLINE void mc6845_set_de(mc6845_t *mc6845, int state)
update_upd_adr_timer(mc6845);
}
- if ( mc6845->out_de_func.target != NULL )
- devcb_call_write_line( &mc6845->out_de_func, mc6845->de );
+ if ( !mc6845->out_de_func.isnull() )
+ mc6845->out_de_func(mc6845->de );
}
}
@@ -486,8 +486,8 @@ INLINE void mc6845_set_hsync(mc6845_t *mc6845, int state)
{
mc6845->hsync = state;
- if ( mc6845->out_hsync_func.target != NULL )
- devcb_call_write_line( &mc6845->out_hsync_func, mc6845->hsync );
+ if ( !mc6845->out_hsync_func.isnull() )
+ mc6845->out_hsync_func(mc6845->hsync );
}
}
@@ -498,8 +498,8 @@ INLINE void mc6845_set_vsync(mc6845_t *mc6845, int state)
{
mc6845->vsync = state;
- if ( mc6845->out_vsync_func.target != NULL )
- devcb_call_write_line( &mc6845->out_vsync_func, mc6845->vsync );
+ if ( !mc6845->out_vsync_func.isnull() )
+ mc6845->out_vsync_func(mc6845->vsync );
}
}
@@ -510,8 +510,8 @@ INLINE void mc6845_set_cur(mc6845_t *mc6845, int state)
{
mc6845->cur = state;
- if ( mc6845->out_cur_func.target != NULL )
- devcb_call_write_line( &mc6845->out_cur_func, mc6845->cur );
+ if ( !mc6845->out_cur_func.isnull() )
+ mc6845->out_cur_func(mc6845->cur );
}
}
@@ -881,10 +881,10 @@ static void common_start(device_t *device, int device_type)
assert(mc6845->intf->hpixels_per_column > 0);
/* resolve callbacks */
- devcb_resolve_write_line(&mc6845->out_de_func, &mc6845->intf->out_de_func, device);
- devcb_resolve_write_line(&mc6845->out_cur_func, &mc6845->intf->out_cur_func, device);
- devcb_resolve_write_line(&mc6845->out_hsync_func, &mc6845->intf->out_hsync_func, device);
- devcb_resolve_write_line(&mc6845->out_vsync_func, &mc6845->intf->out_vsync_func, device);
+ mc6845->out_de_func.resolve(mc6845->intf->out_de_func, *device);
+ mc6845->out_cur_func.resolve(mc6845->intf->out_cur_func, *device);
+ mc6845->out_hsync_func.resolve(mc6845->intf->out_hsync_func, *device);
+ mc6845->out_vsync_func.resolve(mc6845->intf->out_vsync_func, *device);
/* copy the initial parameters */
mc6845->clock = device->clock();
@@ -1014,14 +1014,14 @@ static DEVICE_RESET( mc6845 )
/* internal registers other than status remain unchanged, all outputs go low */
if (mc6845->intf != NULL)
{
- if (mc6845->out_de_func.target != NULL)
- devcb_call_write_line(&mc6845->out_de_func, FALSE);
+ if (!mc6845->out_de_func.isnull())
+ mc6845->out_de_func(FALSE);
- if (mc6845->out_hsync_func.target != NULL)
- devcb_call_write_line(&mc6845->out_hsync_func, FALSE);
+ if (!mc6845->out_hsync_func.isnull())
+ mc6845->out_hsync_func(FALSE);
- if (mc6845->out_vsync_func.target != NULL)
- devcb_call_write_line(&mc6845->out_vsync_func, FALSE);
+ if (!mc6845->out_vsync_func.isnull())
+ mc6845->out_vsync_func(FALSE);
}
if ( ! mc6845->line_timer ->enabled( ) )
diff --git a/src/emu/video/upd3301.c b/src/emu/video/upd3301.c
index 37d2b408694..6eb1d770c73 100644
--- a/src/emu/video/upd3301.c
+++ b/src/emu/video/upd3301.c
@@ -76,7 +76,7 @@ inline void upd3301_device::set_interrupt(int state)
{
if (LOG) logerror("UPD3301 '%s' Interrupt: %u\n", tag(), state);
- devcb_call_write_line(&m_out_int_func, state);
+ m_out_int_func(state);
if (!state)
{
@@ -93,7 +93,7 @@ inline void upd3301_device::set_drq(int state)
{
if (LOG) logerror("UPD3301 '%s' DRQ: %u\n", tag(), state);
- devcb_call_write_line(&m_out_drq_func, state);
+ m_out_drq_func(state);
}
@@ -248,10 +248,10 @@ void upd3301_device::device_start()
m_drq_timer = timer_alloc(TIMER_DRQ);
// resolve callbacks
- devcb_resolve_write_line(&m_out_int_func, &m_out_int_cb, this);
- devcb_resolve_write_line(&m_out_drq_func, &m_out_drq_cb, this);
- devcb_resolve_write_line(&m_out_hrtc_func, &m_out_hrtc_cb, this);
- devcb_resolve_write_line(&m_out_vrtc_func, &m_out_vrtc_cb, this);
+ m_out_int_func.resolve(m_out_int_cb, *this);
+ m_out_drq_func.resolve(m_out_drq_cb, *this);
+ m_out_hrtc_func.resolve(m_out_hrtc_cb, *this);
+ m_out_vrtc_func.resolve(m_out_vrtc_cb, *this);
// get the screen device
m_screen = machine().device<screen_device>(m_screen_tag);
@@ -326,7 +326,7 @@ void upd3301_device::device_timer(emu_timer &timer, device_timer_id id, int para
case TIMER_HRTC:
if (LOG) logerror("UPD3301 '%s' HRTC: %u\n", tag(), param);
- devcb_call_write_line(&m_out_hrtc_func, param);
+ m_out_hrtc_func(param);
m_hrtc = param;
update_hrtc_timer(param);
@@ -335,7 +335,7 @@ void upd3301_device::device_timer(emu_timer &timer, device_timer_id id, int para
case TIMER_VRTC:
if (LOG) logerror("UPD3301 '%s' VRTC: %u\n", tag(), param);
- devcb_call_write_line(&m_out_vrtc_func, param);
+ m_out_vrtc_func(param);
m_vrtc = param;
if (param && !m_me)
diff --git a/src/mame/audio/namco52.c b/src/mame/audio/namco52.c
index 0997cbf5cae..44ef6d34062 100644
--- a/src/mame/audio/namco52.c
+++ b/src/mame/audio/namco52.c
@@ -86,19 +86,19 @@ static READ8_HANDLER( namco_52xx_K_r )
static READ8_HANDLER( namco_52xx_SI_r )
{
namco_52xx_state *state = get_safe_token(space->device().owner());
- return devcb_call_read8(&state->m_si, 0) ? 1 : 0;
+ return state->m_si(0) ? 1 : 0;
}
static READ8_HANDLER( namco_52xx_R0_r )
{
namco_52xx_state *state = get_safe_token(space->device().owner());
- return devcb_call_read8(&state->m_romread, state->m_address) & 0x0f;
+ return state->m_romread(state->m_address) & 0x0f;
}
static READ8_HANDLER( namco_52xx_R1_r )
{
namco_52xx_state *state = get_safe_token(space->device().owner());
- return devcb_call_read8(&state->m_romread, state->m_address) >> 4;
+ return state->m_romread(state->m_address) >> 4;
}
@@ -215,8 +215,8 @@ static DEVICE_START( namco_52xx )
state->m_basenode = intf->firstnode;
/* resolve our read/write callbacks */
- devcb_resolve_read8(&state->m_romread, &intf->romread, device);
- devcb_resolve_read8(&state->m_si, &intf->si, device);
+ state->m_romread.resolve(intf->romread, *device);
+ state->m_si.resolve(intf->si, *device);
/* start the external clock */
if (intf->extclock != 0)
diff --git a/src/mame/machine/gaelco3d.c b/src/mame/machine/gaelco3d.c
index b4b72c81387..e2b127baddc 100644
--- a/src/mame/machine/gaelco3d.c
+++ b/src/mame/machine/gaelco3d.c
@@ -268,7 +268,7 @@ static void process_in(gaelco_serial_state *state)
LOGMSG(("command receive %02x at %d (%d)\n", state->m_in_ptr->data, state->m_out_ptr->cnt, state->m_in_ptr->cnt));
if ((state->m_status & GAELCOSER_STATUS_IRQ_ENABLE) != 0)
{
- devcb_call_write_line(&state->m_irq_func, 1);
+ state->m_irq_func(1);
LOGMSG(("irq!\n"));
}
}
@@ -362,7 +362,7 @@ READ8_DEVICE_HANDLER( gaelco_serial_data_r)
process_in(serial);
ret = (serial->m_in_ptr->data & 0xff);
- devcb_call_write_line(&serial->m_irq_func, 0);
+ serial->m_irq_func(0);
LOGMSG(("read %02x at %d (%d)\n", ret, serial->m_out_ptr->cnt, serial->m_in_ptr->cnt));
/* if we are not sending, mark as as ready */
@@ -435,7 +435,7 @@ static DEVICE_START( gaelco_serial )
memset(state, 0, sizeof(*state));
state->m_device = device;
- devcb_resolve_write_line(&state->m_irq_func, &intf->irq_func, device);
+ state->m_irq_func.resolve(intf->irq_func, *device);
state->m_sync_timer = device->machine().scheduler().timer_alloc(FUNC(link_cb), state);
/* register for save states */
diff --git a/src/mame/machine/namco51.c b/src/mame/machine/namco51.c
index ca75edf7202..7dea842fd20 100644
--- a/src/mame/machine/namco51.c
+++ b/src/mame/machine/namco51.c
@@ -63,8 +63,8 @@
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
-#define READ_PORT(st,num) devcb_call_read8(&(st)->m_in[num], 0)
-#define WRITE_PORT(st,num,data) devcb_call_write8(&(st)->m_out[num], 0, data)
+#define READ_PORT(st,num) (st)->m_in[num](0)
+#define WRITE_PORT(st,num,data) (st)->m_out[num](0, data)
typedef struct _namco_51xx_state namco_51xx_state;
@@ -390,14 +390,14 @@ static DEVICE_START( namco_51xx )
assert(state->m_cpu != NULL);
/* resolve our read callbacks */
- devcb_resolve_read8(&state->m_in[0], &config->in[0], device);
- devcb_resolve_read8(&state->m_in[1], &config->in[1], device);
- devcb_resolve_read8(&state->m_in[2], &config->in[2], device);
- devcb_resolve_read8(&state->m_in[3], &config->in[3], device);
+ state->m_in[0].resolve(config->in[0], *device);
+ state->m_in[1].resolve(config->in[1], *device);
+ state->m_in[2].resolve(config->in[2], *device);
+ state->m_in[3].resolve(config->in[3], *device);
/* resolve our write callbacks */
- devcb_resolve_write8(&state->m_out[0], &config->out[0], device);
- devcb_resolve_write8(&state->m_out[1], &config->out[1], device);
+ state->m_out[0].resolve(config->out[0], *device);
+ state->m_out[1].resolve(config->out[1], *device);
#if 0
INT32 lastcoins,lastbuttons;
INT32 credits;
diff --git a/src/mame/machine/namco53.c b/src/mame/machine/namco53.c
index 83a3003e848..79f5c26b72a 100644
--- a/src/mame/machine/namco53.c
+++ b/src/mame/machine/namco53.c
@@ -84,13 +84,13 @@ INLINE namco_53xx_state *get_safe_token(device_t *device)
static READ8_HANDLER( namco_53xx_K_r )
{
namco_53xx_state *state = get_safe_token(space->device().owner());
- return devcb_call_read8(&state->m_k, 0);
+ return state->m_k(0);
}
static READ8_HANDLER( namco_53xx_Rx_r )
{
namco_53xx_state *state = get_safe_token(space->device().owner());
- return devcb_call_read8(&state->m_in[offset], 0);
+ return state->m_in[offset](0);
}
static WRITE8_HANDLER( namco_53xx_O_w )
@@ -106,7 +106,7 @@ static WRITE8_HANDLER( namco_53xx_O_w )
static WRITE8_HANDLER( namco_53xx_P_w )
{
namco_53xx_state *state = get_safe_token(space->device().owner());
- devcb_call_write8(&state->m_p, 0, data);
+ state->m_p(0, data);
}
@@ -181,12 +181,12 @@ static DEVICE_START( namco_53xx )
assert(state->m_cpu != NULL);
/* resolve our read/write callbacks */
- devcb_resolve_read8(&state->m_k, &config->k, device);
- devcb_resolve_read8(&state->m_in[0], &config->in[0], device);
- devcb_resolve_read8(&state->m_in[1], &config->in[1], device);
- devcb_resolve_read8(&state->m_in[2], &config->in[2], device);
- devcb_resolve_read8(&state->m_in[3], &config->in[3], device);
- devcb_resolve_write8(&state->m_p, &config->p, device);
+ state->m_k.resolve(config->k, *device);
+ state->m_in[0].resolve(config->in[0], *device);
+ state->m_in[1].resolve(config->in[1], *device);
+ state->m_in[2].resolve(config->in[2], *device);
+ state->m_in[3].resolve(config->in[3], *device);
+ state->m_p.resolve(config->p, *device);
device->save_item(NAME(state->m_portO));
}
diff --git a/src/mame/machine/namco62.c b/src/mame/machine/namco62.c
index bee8ea26a63..5d56e593adb 100644
--- a/src/mame/machine/namco62.c
+++ b/src/mame/machine/namco62.c
@@ -74,14 +74,14 @@ static DEVICE_START( namco_62xx )
assert(state->m_cpu != NULL);
/* resolve our read callbacks */
- devcb_resolve_read8(&state->m_in[0], &config->in[0], device);
- devcb_resolve_read8(&state->m_in[1], &config->in[1], device);
- devcb_resolve_read8(&state->m_in[2], &config->in[2], device);
- devcb_resolve_read8(&state->m_in[3], &config->in[3], device);
+ state->m_in[0].resolve(config->in[0], *device);
+ state->m_in[1].resolve(config->in[1], *device);
+ state->m_in[2].resolve(config->in[2], *device);
+ state->m_in[3].resolve(config->in[3], *device);
/* resolve our write callbacks */
- devcb_resolve_write8(&state->m_out[0], &config->out[0], device);
- devcb_resolve_write8(&state->m_out[1], &config->out[1], device);
+ state->m_out[0].resolve(config->out[0], *device);
+ state->m_out[1].resolve(config->out[1], *device);
}
diff --git a/src/mame/machine/namcoio.c b/src/mame/machine/namcoio.c
index d1e28b7654c..ff3c0cb3610 100644
--- a/src/mame/machine/namcoio.c
+++ b/src/mame/machine/namcoio.c
@@ -159,8 +159,8 @@ INLINE const namcoio_interface *get_interface( device_t *device )
DEVICE HANDLERS
*****************************************************************************/
-#define READ_PORT(n) (devcb_call_read8(&namcoio->in[n], 0) & 0x0f)
-#define WRITE_PORT(n,d) (devcb_call_write8(&namcoio->out[n], 0, (d) & 0x0f))
+#define READ_PORT(n) (namcoio->in[n](0) & 0x0f)
+#define WRITE_PORT(n,d) (namcoio->out[n](0, (d) & 0x0f))
#define IORAM_READ(offset) (namcoio->ram[offset] & 0x0f)
#define IORAM_WRITE(offset,data) {namcoio->ram[offset] = (data) & 0x0f;}
@@ -514,12 +514,12 @@ static DEVICE_START( namcoio )
namcoio->device = intf->device;
- devcb_resolve_read8(&namcoio->in[0], &intf->in[0], device);
- devcb_resolve_read8(&namcoio->in[1], &intf->in[1], device);
- devcb_resolve_read8(&namcoio->in[2], &intf->in[2], device);
- devcb_resolve_read8(&namcoio->in[3], &intf->in[3], device);
- devcb_resolve_write8(&namcoio->out[0], &intf->out[0], device);
- devcb_resolve_write8(&namcoio->out[1], &intf->out[1], device);
+ namcoio->in[0].resolve(intf->in[0], *device);
+ namcoio->in[1].resolve(intf->in[1], *device);
+ namcoio->in[2].resolve(intf->in[2], *device);
+ namcoio->in[3].resolve(intf->in[3], *device);
+ namcoio->out[0].resolve(intf->out[0], *device);
+ namcoio->out[1].resolve(intf->out[1], *device);
device->save_item(NAME(namcoio->ram));
device->save_item(NAME(namcoio->reset));
diff --git a/src/mame/machine/taitoio.c b/src/mame/machine/taitoio.c
index c2698541e3e..23b5d007ea9 100644
--- a/src/mame/machine/taitoio.c
+++ b/src/mame/machine/taitoio.c
@@ -95,22 +95,22 @@ READ8_DEVICE_HANDLER( tc0220ioc_r )
switch (offset)
{
case 0x00:
- return devcb_call_read8(&tc0220ioc->read_0, 0);
+ return tc0220ioc->read_0(0);
case 0x01:
- return devcb_call_read8(&tc0220ioc->read_1, 0);
+ return tc0220ioc->read_1(0);
case 0x02:
- return devcb_call_read8(&tc0220ioc->read_2, 0);
+ return tc0220ioc->read_2(0);
case 0x03:
- return devcb_call_read8(&tc0220ioc->read_3, 0);
+ return tc0220ioc->read_3(0);
case 0x04: /* coin counters and lockout */
return tc0220ioc->regs[4];
case 0x07:
- return devcb_call_read8(&tc0220ioc->read_7, 0);
+ return tc0220ioc->read_7(0);
default:
//logerror("PC %06x: warning - read TC0220IOC address %02x\n",cpu_get_pc(&space->device()),offset);
@@ -182,11 +182,11 @@ static DEVICE_START( tc0220ioc )
tc0220ioc_state *tc0220ioc = tc0220ioc_get_safe_token(device);
const tc0220ioc_interface *intf = tc0220ioc_get_interface(device);
- devcb_resolve_read8(&tc0220ioc->read_0, &intf->read_0, device);
- devcb_resolve_read8(&tc0220ioc->read_1, &intf->read_1, device);
- devcb_resolve_read8(&tc0220ioc->read_2, &intf->read_2, device);
- devcb_resolve_read8(&tc0220ioc->read_3, &intf->read_3, device);
- devcb_resolve_read8(&tc0220ioc->read_7, &intf->read_7, device);
+ tc0220ioc->read_0.resolve(intf->read_0, *device);
+ tc0220ioc->read_1.resolve(intf->read_1, *device);
+ tc0220ioc->read_2.resolve(intf->read_2, *device);
+ tc0220ioc->read_3.resolve(intf->read_3, *device);
+ tc0220ioc->read_7.resolve(intf->read_7, *device);
device->save_item(NAME(tc0220ioc->regs));
device->save_item(NAME(tc0220ioc->port));
@@ -252,22 +252,22 @@ READ8_DEVICE_HANDLER( tc0510nio_r )
switch (offset)
{
case 0x00:
- return devcb_call_read8(&tc0510nio->read_0, 0);
+ return tc0510nio->read_0(0);
case 0x01:
- return devcb_call_read8(&tc0510nio->read_1, 0);
+ return tc0510nio->read_1(0);
case 0x02:
- return devcb_call_read8(&tc0510nio->read_2, 0);
+ return tc0510nio->read_2(0);
case 0x03:
- return devcb_call_read8(&tc0510nio->read_3, 0);
+ return tc0510nio->read_3(0);
case 0x04: /* coin counters and lockout */
return tc0510nio->regs[4];
case 0x07:
- return devcb_call_read8(&tc0510nio->read_7, 0);
+ return tc0510nio->read_7(0);
default:
//logerror("PC %06x: warning - read TC0510NIO address %02x\n",cpu_get_pc(&space->device()),offset);
@@ -337,11 +337,11 @@ static DEVICE_START( tc0510nio )
tc0510nio_state *tc0510nio = tc0510nio_get_safe_token(device);
const tc0510nio_interface *intf = tc0510nio_get_interface(device);
- devcb_resolve_read8(&tc0510nio->read_0, &intf->read_0, device);
- devcb_resolve_read8(&tc0510nio->read_1, &intf->read_1, device);
- devcb_resolve_read8(&tc0510nio->read_2, &intf->read_2, device);
- devcb_resolve_read8(&tc0510nio->read_3, &intf->read_3, device);
- devcb_resolve_read8(&tc0510nio->read_7, &intf->read_7, device);
+ tc0510nio->read_0.resolve(intf->read_0, *device);
+ tc0510nio->read_1.resolve(intf->read_1, *device);
+ tc0510nio->read_2.resolve(intf->read_2, *device);
+ tc0510nio->read_3.resolve(intf->read_3, *device);
+ tc0510nio->read_7.resolve(intf->read_7, *device);
device->save_item(NAME(tc0510nio->regs));
}
@@ -403,22 +403,22 @@ READ8_DEVICE_HANDLER( tc0640fio_r )
switch (offset)
{
case 0x00:
- return devcb_call_read8(&tc0640fio->read_0, 0);
+ return tc0640fio->read_0(0);
case 0x01:
- return devcb_call_read8(&tc0640fio->read_1, 0);
+ return tc0640fio->read_1(0);
case 0x02:
- return devcb_call_read8(&tc0640fio->read_2, 0);
+ return tc0640fio->read_2(0);
case 0x03:
- return devcb_call_read8(&tc0640fio->read_3, 0);
+ return tc0640fio->read_3(0);
case 0x04: /* coin counters and lockout */
return tc0640fio->regs[4];
case 0x07:
- return devcb_call_read8(&tc0640fio->read_7, 0);
+ return tc0640fio->read_7(0);
default:
//logerror("PC %06x: warning - read TC0640FIO address %02x\n",cpu_get_pc(&space->device()),offset);
@@ -492,11 +492,11 @@ static DEVICE_START( tc0640fio )
tc0640fio_state *tc0640fio = tc0640fio_get_safe_token(device);
const tc0640fio_interface *intf = tc0640fio_get_interface(device);
- devcb_resolve_read8(&tc0640fio->read_0, &intf->read_0, device);
- devcb_resolve_read8(&tc0640fio->read_1, &intf->read_1, device);
- devcb_resolve_read8(&tc0640fio->read_2, &intf->read_2, device);
- devcb_resolve_read8(&tc0640fio->read_3, &intf->read_3, device);
- devcb_resolve_read8(&tc0640fio->read_7, &intf->read_7, device);
+ tc0640fio->read_0.resolve(intf->read_0, *device);
+ tc0640fio->read_1.resolve(intf->read_1, *device);
+ tc0640fio->read_2.resolve(intf->read_2, *device);
+ tc0640fio->read_3.resolve(intf->read_3, *device);
+ tc0640fio->read_7.resolve(intf->read_7, *device);
device->save_item(NAME(tc0640fio->regs));
}