summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Couriersud <couriersud@users.noreply.github.com>2009-09-22 20:11:23 +0000
committer Couriersud <couriersud@users.noreply.github.com>2009-09-22 20:11:23 +0000
commit841cbd77c7d7ec4ac6de21f7c96f049e8d90b499 (patch)
tree8808b869dd450915e9f8b519bae32a7ece15ee0b
parent47fbe6897d8732cdf879a1eb38f61dedce891b4c (diff)
Converted 6532riot to devcb interfaces
- updated all drivers - converted drivers to RS/WS tms5220 interface where appropriate - removed quite some trampoline functions
-rw-r--r--src/emu/machine/6532riot.c36
-rw-r--r--src/emu/machine/6532riot.h15
-rw-r--r--src/emu/sound/tms5220.c1
-rw-r--r--src/mame/audio/exidy.c55
-rw-r--r--src/mame/audio/gottlieb.c22
-rw-r--r--src/mame/audio/starwars.c26
-rw-r--r--src/mame/drivers/firefox.c35
-rw-r--r--src/mame/drivers/gameplan.c16
-rw-r--r--src/mame/drivers/tomcat.c13
-rw-r--r--src/mame/drivers/tourtabl.c54
10 files changed, 122 insertions, 151 deletions
diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c
index 58b5199a8cf..e98c7709510 100644
--- a/src/emu/machine/6532riot.c
+++ b/src/emu/machine/6532riot.c
@@ -38,11 +38,11 @@ enum
typedef struct _riot6532_port riot6532_port;
struct _riot6532_port
{
- UINT8 in;
- UINT8 out;
- UINT8 ddr;
- riot_read_func in_func;
- riot_write_func out_func;
+ UINT8 in;
+ UINT8 out;
+ UINT8 ddr;
+ devcb_resolved_read8 in_func;
+ devcb_resolved_write8 out_func;
};
@@ -54,6 +54,8 @@ struct _riot6532_state
int index;
riot6532_port port[2];
+
+ devcb_resolved_write_line irq_func;
UINT8 irqstate;
UINT8 irqenable;
@@ -96,8 +98,8 @@ INLINE void update_irqstate(const device_config *device)
riot6532_state *riot = get_safe_token(device);
int state = (riot->irqstate & riot->irqenable);
- if (riot->intf->irq_func != NULL)
- (*riot->intf->irq_func)(device, (state != 0) ? ASSERT_LINE : CLEAR_LINE);
+ if (riot->irq_func.write != NULL)
+ devcb_call_write_line(&riot->irq_func, (state != 0) ? ASSERT_LINE : CLEAR_LINE);
else
logerror("%s:6532RIOT chip #%d: no irq callback function\n", cpuexec_describe_context(device->machine), riot->index);
}
@@ -256,10 +258,9 @@ WRITE8_DEVICE_HANDLER( riot6532_w )
/* if A0 == 0, we are writing to the port's output */
else
{
- UINT8 olddata = port->out;
port->out = data;
- if (port->out_func != NULL)
- (*port->out_func)(device, data, olddata);
+ if (port->out_func.write != NULL)
+ devcb_call_write8(&port->out_func, 0, data);
else
logerror("%s:6532RIOT chip %s: Port %c is being written to but has no handler. %02X\n", cpuexec_describe_context(device->machine), device->tag, 'A' + (offset & 1), data);
}
@@ -321,9 +322,9 @@ READ8_DEVICE_HANDLER( riot6532_r )
else
{
/* call the input callback if it exists */
- if (port->in_func != NULL)
+ if (port->in_func.read != NULL)
{
- port->in = (*port->in_func)(device, port->in);
+ port->in = devcb_call_read8(&port->in_func, 0);
/* changes to port A need to update the PA7 state */
if (port == &riot->port[0])
@@ -437,10 +438,13 @@ static DEVICE_START( riot6532 )
riot->index = device_list_index(device->machine->config->devicelist, RIOT6532, device->tag);
/* configure the ports */
- riot->port[0].in_func = riot->intf->in_a_func;
- riot->port[0].out_func = riot->intf->out_a_func;
- riot->port[1].in_func = riot->intf->in_b_func;
- riot->port[1].out_func = riot->intf->out_b_func;
+ devcb_resolve_read8(&riot->port[0].in_func, &riot->intf->in_a_func, device);
+ devcb_resolve_write8(&riot->port[0].out_func, &riot->intf->out_a_func, device);
+ devcb_resolve_read8(&riot->port[1].in_func, &riot->intf->in_b_func, device);
+ devcb_resolve_write8(&riot->port[1].out_func, &riot->intf->out_b_func, device);
+
+ /* resolve irq func */
+ devcb_resolve_write_line(&riot->irq_func, &riot->intf->irq_func, device);
/* allocate timers */
riot->timer = timer_alloc(device->machine, timer_end_callback, (void *)device);
diff --git a/src/emu/machine/6532riot.h b/src/emu/machine/6532riot.h
index b893fcc2ff2..c7d604ae45b 100644
--- a/src/emu/machine/6532riot.h
+++ b/src/emu/machine/6532riot.h
@@ -7,24 +7,21 @@
#ifndef __RIOT6532_H__
#define __RIOT6532_H__
+#include "devcb.h"
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
-typedef UINT8 (*riot_read_func)(const device_config *device, UINT8 olddata);
-typedef void (*riot_write_func)(const device_config *device, UINT8 newdata, UINT8 olddata);
-typedef void (*riot_irq_func)(const device_config *device, int state);
-
typedef struct _riot6532_interface riot6532_interface;
struct _riot6532_interface
{
- riot_read_func in_a_func;
- riot_read_func in_b_func;
- riot_write_func out_a_func;
- riot_write_func out_b_func;
- riot_irq_func irq_func;
+ devcb_read8 in_a_func;
+ devcb_read8 in_b_func;
+ devcb_write8 out_a_func;
+ devcb_write8 out_b_func;
+ devcb_write_line irq_func;
};
diff --git a/src/emu/sound/tms5220.c b/src/emu/sound/tms5220.c
index 6aeec828a18..8573c1a443d 100644
--- a/src/emu/sound/tms5220.c
+++ b/src/emu/sound/tms5220.c
@@ -46,6 +46,7 @@ TODO:
If a command is still executing, /READY will be kept high until the command has
finished if the next command is written.
TMS5220C: see below.
+ tomcat has a 5220 which is not hooked up at all
Notes:
Looping has the tms5220 hookep up directly to the cpu. However currently the
diff --git a/src/mame/audio/exidy.c b/src/mame/audio/exidy.c
index be8f0847a54..9f8d6584e09 100644
--- a/src/mame/audio/exidy.c
+++ b/src/mame/audio/exidy.c
@@ -459,35 +459,46 @@ static void r6532_irq(const device_config *device, int state)
}
-static void r6532_porta_w(const device_config *device, UINT8 newdata, UINT8 olddata)
+static WRITE8_DEVICE_HANDLER( r6532_porta_w )
{
if (has_mc3417)
- cputag_set_input_line(device->machine, "cvsdcpu", INPUT_LINE_RESET, (newdata & 0x10) ? CLEAR_LINE : ASSERT_LINE);
+ cputag_set_input_line(device->machine, "cvsdcpu", INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
+
+ if (has_tms5220)
+ {
+ const device_config *tms = devtag_get_device(device->machine, "tms");
+ logerror("(%f)%s:TMS5220 data write = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), riot6532_porta_out_get(riot));
+ tms5220_data_w(tms, 0, data);
+ }
}
+static READ8_DEVICE_HANDLER( r6532_porta_r )
+{
+ if (has_tms5220)
+ {
+ const device_config *tms = devtag_get_device(device->machine, "tms");
+ logerror("(%f)%s:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), tms5220_status_r(tms, 0));
+ return tms5220_status_r(tms, 0);
+ }
+ else
+ return 0xff;
+}
-static void r6532_portb_w(const device_config *device, UINT8 newdata, UINT8 olddata)
+static WRITE8_DEVICE_HANDLER( r6532_portb_w )
{
- const device_config *tms = devtag_get_device(device->machine, "tms");
- if (device != NULL)
+ if (has_tms5220)
{
- if ((olddata & 0x01) && !(newdata & 0x01))
- {
- riot6532_porta_in_set(riot, tms5220_status_r(tms, 0), 0xff);
- logerror("(%f)%s:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), tms5220_status_r(tms, 0));
- }
- if ((olddata & 0x02) && !(newdata & 0x02))
- {
- logerror("(%f)%s:TMS5220 data write = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), riot6532_porta_out_get(riot));
- tms5220_data_w(tms, 0, riot6532_porta_out_get(riot));
- }
+ const device_config *tms = devtag_get_device(device->machine, "tms");
+
+ tms5220_rsq_w(tms, data & 0x01);
+ tms5220_wsq_w(tms, (data >> 1) & 0x01);
}
}
-static UINT8 r6532_portb_r(const device_config *device, UINT8 olddata)
+static READ8_DEVICE_HANDLER( r6532_portb_r )
{
- UINT8 newdata = olddata;
+ UINT8 newdata = riot6532_portb_in_get(device);
if (has_tms5220)
{
const device_config *tms = devtag_get_device(device->machine, "tms");
@@ -501,11 +512,11 @@ static UINT8 r6532_portb_r(const device_config *device, UINT8 olddata)
static const riot6532_interface r6532_interface =
{
- NULL, /* port A read handler */
- r6532_portb_r, /* port B read handler */
- r6532_porta_w, /* port A write handler */
- r6532_portb_w, /* port B write handler */
- r6532_irq /* IRQ callback */
+ DEVCB_HANDLER(r6532_porta_r), /* port A read handler */
+ DEVCB_HANDLER(r6532_portb_r), /* port B read handler */
+ DEVCB_HANDLER(r6532_porta_w), /* port A write handler */
+ DEVCB_HANDLER(r6532_portb_w), /* port B write handler */
+ DEVCB_LINE(r6532_irq) /* IRQ callback */
};
diff --git a/src/mame/audio/gottlieb.c b/src/mame/audio/gottlieb.c
index 336f599a480..eb708225aef 100644
--- a/src/mame/audio/gottlieb.c
+++ b/src/mame/audio/gottlieb.c
@@ -94,32 +94,26 @@ static void gottlieb1_sh_w(const device_config *riot, UINT8 data)
*
*************************************/
-static void snd_interrupt(const device_config *device, int state)
+static WRITE_LINE_DEVICE_HANDLER( snd_interrupt )
{
cputag_set_input_line(device->machine, "audiocpu", M6502_IRQ_LINE, state);
}
-static UINT8 r6532_portb_r(const device_config *device, UINT8 olddata)
-{
- return input_port_read(device->machine, "SB1");
-}
-
-
-static void r6532_portb_w(const device_config *device, UINT8 newdata, UINT8 olddata)
+static WRITE8_DEVICE_HANDLER( r6532_portb_w )
{
/* unsure if this is ever used, but the NMI is connected to the RIOT's PB7 */
- cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, (newdata & 0x80) ? CLEAR_LINE : ASSERT_LINE);
+ cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
}
static const riot6532_interface gottlieb_riot6532_intf =
{
- NULL,
- r6532_portb_r,
- NULL,
- r6532_portb_w,
- snd_interrupt
+ DEVCB_NULL,
+ DEVCB_INPUT_PORT("SB1"),
+ DEVCB_NULL,
+ DEVCB_HANDLER(r6532_portb_w),
+ DEVCB_LINE(snd_interrupt)
};
diff --git a/src/mame/audio/starwars.c b/src/mame/audio/starwars.c
index d264241c2e9..1ffde55cfb2 100644
--- a/src/mame/audio/starwars.c
+++ b/src/mame/audio/starwars.c
@@ -31,7 +31,7 @@ SOUND_START( starwars )
*
*************************************/
-static UINT8 r6532_porta_r(const device_config *device, UINT8 olddata)
+static READ8_DEVICE_HANDLER( r6532_porta_r )
{
/* Configured as follows: */
/* d7 (in) Main Ready Flag */
@@ -44,26 +44,22 @@ static UINT8 r6532_porta_r(const device_config *device, UINT8 olddata)
/* d1 (out) TMS5220 Not Read */
/* d0 (out) TMS5220 Not Write */
/* Note: bit 4 is always set to avoid sound self test */
+ UINT8 olddata = riot6532_porta_in_get(device);
return (olddata & 0xc0) | 0x10 | (tms5220_readyq_r(devtag_get_device(device->machine, "tms")) << 2);
}
-static void r6532_porta_w(const device_config *device, UINT8 newdata, UINT8 olddata)
+static WRITE8_DEVICE_HANDLER( r6532_porta_w )
{
- const device_config *tms = devtag_get_device(device->machine, "tms");
-
/* handle 5220 read */
- if ((olddata & 2) != 0 && (newdata & 2) == 0)
- riot6532_portb_in_set(riot, tms5220_status_r(tms, 0), 0xff);
-
+ tms5220_rsq_w(device, (data & 2)>>1);
/* handle 5220 write */
- if ((olddata & 1) != 0 && (newdata & 1) == 0)
- tms5220_data_w(tms, 0, riot6532_portb_out_get(riot));
+ tms5220_wsq_w(device, (data & 1)>>0);
}
-static void snd_interrupt(const device_config *device, int state)
+static WRITE_LINE_DEVICE_HANDLER( snd_interrupt )
{
cputag_set_input_line(device->machine, "audiocpu", M6809_IRQ_LINE, state);
}
@@ -71,11 +67,11 @@ static void snd_interrupt(const device_config *device, int state)
const riot6532_interface starwars_riot6532_intf =
{
- r6532_porta_r,
- NULL,
- r6532_porta_w,
- NULL,
- snd_interrupt
+ DEVCB_HANDLER(r6532_porta_r),
+ DEVCB_DEVICE_HANDLER("tms", tms5220_status_r),
+ DEVCB_DEVICE_HANDLER("tms", r6532_porta_w),
+ DEVCB_DEVICE_HANDLER("tms", tms5220_data_w),
+ DEVCB_LINE(snd_interrupt)
};
diff --git a/src/mame/drivers/firefox.c b/src/mame/drivers/firefox.c
index 88aaee52726..a43b72f52cf 100644
--- a/src/mame/drivers/firefox.c
+++ b/src/mame/drivers/firefox.c
@@ -289,7 +289,7 @@ static WRITE8_HANDLER( sound_to_main_w )
*
*************************************/
-static UINT8 riot_porta_r(const device_config *device, UINT8 olddata)
+static READ8_DEVICE_HANDLER( riot_porta_r )
{
/* bit 7 = MAINFLAG */
/* bit 6 = SOUNDFLAG */
@@ -300,34 +300,21 @@ static UINT8 riot_porta_r(const device_config *device, UINT8 olddata)
/* bit 1 = TMS /read */
/* bit 0 = TMS /write */
- const device_config *tms = devtag_get_device(device->machine, "tms");
- return (main_to_sound_flag << 7) | (sound_to_main_flag << 6) | 0x10 | (tms5220_readyq_r(tms) << 2);
-}
-
-static UINT8 riot_portb_r(const device_config *device, UINT8 olddata)
-{
- const device_config *tms = devtag_get_device(device->machine, "tms");
- return tms5220_status_r(tms, 0);
+ return (main_to_sound_flag << 7) | (sound_to_main_flag << 6) | 0x10 | (tms5220_readyq_r(device) << 2);
}
-static void riot_porta_w(const device_config *device, UINT8 newdata, UINT8 olddata)
+static WRITE8_DEVICE_HANDLER( riot_porta_w )
{
const device_config *tms = devtag_get_device(device->machine, "tms");
/* handle 5220 read */
- tms5220_rsq_w(tms, (newdata>>1) & 1);
+ tms5220_rsq_w(tms, (data>>1) & 1);
/* handle 5220 write */
- tms5220_wsq_w(tms, newdata & 1);
-}
-
-static void riot_portb_w(const device_config *device, UINT8 newdata, UINT8 olddata)
-{
- const device_config *tms = devtag_get_device(device->machine, "tms");
- tms5220_data_w(tms, 0, newdata);
+ tms5220_wsq_w(tms, data & 1);
}
-static void riot_irq(const device_config *device, int state)
+static WRITE_LINE_DEVICE_HANDLER( riot_irq )
{
cputag_set_input_line(device->machine, "audiocpu", M6502_IRQ_LINE, state ? ASSERT_LINE : CLEAR_LINE);
}
@@ -647,11 +634,11 @@ GFXDECODE_END
static const riot6532_interface riot_intf =
{
- riot_porta_r,
- riot_portb_r,
- riot_porta_w,
- riot_portb_w,
- riot_irq
+ DEVCB_DEVICE_HANDLER("tms", riot_porta_r),
+ DEVCB_DEVICE_HANDLER("tms", tms5220_status_r),
+ DEVCB_DEVICE_HANDLER("tms", riot_porta_w),
+ DEVCB_DEVICE_HANDLER("tms", tms5220_data_w),
+ DEVCB_LINE(riot_irq)
};
diff --git a/src/mame/drivers/gameplan.c b/src/mame/drivers/gameplan.c
index bee1427f5f8..64b489c1b83 100644
--- a/src/mame/drivers/gameplan.c
+++ b/src/mame/drivers/gameplan.c
@@ -180,7 +180,7 @@ static const via6522_interface via_2_interface =
*
*************************************/
-static void r6532_irq(const device_config *device, int state)
+static WRITE_LINE_DEVICE_HANDLER( r6532_irq )
{
cputag_set_input_line(device->machine, "audiocpu", 0, state);
if (state == ASSERT_LINE)
@@ -188,20 +188,20 @@ static void r6532_irq(const device_config *device, int state)
}
-static void r6532_soundlatch_w(const device_config *device, UINT8 newdata, UINT8 olddata)
+static WRITE8_DEVICE_HANDLER( r6532_soundlatch_w )
{
const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
- soundlatch_w(space, 0, newdata);
+ soundlatch_w(space, 0, data);
}
static const riot6532_interface r6532_interface =
{
- NULL, /* port A read handler */
- NULL, /* port B read handler */
- NULL, /* port A write handler */
- r6532_soundlatch_w, /* port B write handler */
- r6532_irq /* IRQ callback */
+ DEVCB_NULL, /* port A read handler */
+ DEVCB_NULL, /* port B read handler */
+ DEVCB_NULL, /* port A write handler */
+ DEVCB_HANDLER(r6532_soundlatch_w), /* port B write handler */
+ DEVCB_LINE(r6532_irq) /* IRQ callback */
};
diff --git a/src/mame/drivers/tomcat.c b/src/mame/drivers/tomcat.c
index b1f46eb73a4..17679e45174 100644
--- a/src/mame/drivers/tomcat.c
+++ b/src/mame/drivers/tomcat.c
@@ -8,7 +8,7 @@
- game has no sound, while sound hardware was developed, sound program was
not prepared
- ToDo:
+ TODO:
- add proper timing of interrupts and framerate (currently commented out,
as they cause test mode to hang)
- vector quality appears to be worse than original game (compared to original
@@ -18,6 +18,7 @@
- current implementation of 68010 <-> tms32010 is a little bit hacky, after
tms32010 is started by 68010, 68010 is suspended until tms32010 reads command
and starts executing
+ - hook up tms5220 - it is currently not used at all
*/
@@ -354,7 +355,7 @@ static NVRAM_HANDLER(tomcat)
static const riot6532_interface tomcat_riot6532_intf =
{
- NULL,
+ DEVCB_NULL,
/*
PA0 = /WS OUTPUT (TMS-5220 WRITE STROBE)
PA1 = /RS OUTPUT (TMS-5220 READ STROBE)
@@ -367,10 +368,10 @@ static const riot6532_interface tomcat_riot6532_intf =
PA6 = /MUSRES OUTPUT (Reset the Yamaha)
PA7 = MAINFLAG INPUT
*/
- NULL,
- NULL,
- NULL, // PB0 - PB7 OUTPUT Speech Data
- NULL // connected to IRQ line of 6502
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL, // PB0 - PB7 OUTPUT Speech Data
+ DEVCB_NULL // connected to IRQ line of 6502
};
static MACHINE_DRIVER_START(tomcat)
diff --git a/src/mame/drivers/tourtabl.c b/src/mame/drivers/tourtabl.c
index 64667edd47d..167d30aa05f 100644
--- a/src/mame/drivers/tourtabl.c
+++ b/src/mame/drivers/tourtabl.c
@@ -16,14 +16,14 @@
#define MASTER_CLOCK 3579575
-static void tourtabl_led_w(const device_config *device, UINT8 newdata, UINT8 olddata)
+static WRITE8_DEVICE_HANDLER( tourtabl_led_w )
{
- set_led_status(0, newdata & 0x40); /* start 1 */
- set_led_status(1, newdata & 0x20); /* start 2 */
- set_led_status(2, newdata & 0x10); /* start 4 */
- set_led_status(3, newdata & 0x80); /* select game */
+ set_led_status(0, data & 0x40); /* start 1 */
+ set_led_status(1, data & 0x20); /* start 2 */
+ set_led_status(2, data & 0x10); /* start 4 */
+ set_led_status(3, data & 0x80); /* select game */
- coin_lockout_global_w(!(newdata & 0x80));
+ coin_lockout_global_w(!(data & 0x80));
}
@@ -51,48 +51,28 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END
-static UINT8 port6_r(const device_config *device, UINT8 olddata)
-{
- return input_port_read(device->machine, "RIOT0_SWA");
-}
-
-static UINT8 port7_r(const device_config *device, UINT8 olddata)
-{
- return input_port_read(device->machine, "RIOT0_SWB");
-}
-
-static UINT8 port8_r(const device_config *device, UINT8 olddata)
-{
- return input_port_read(device->machine, "RIOT1_SWA");
-}
-
-static UINT8 port9_r(const device_config *device, UINT8 olddata)
-{
- return input_port_read(device->machine, "RIOT1_SWB");
-}
-
-static void watchdog_w(const device_config *device, UINT8 newdata, UINT8 olddata)
+static WRITE8_DEVICE_HANDLER( watchdog_w )
{
watchdog_reset(device->machine);
}
static const riot6532_interface r6532_interface_0 =
{
- port6_r,
- port7_r,
- NULL,
- watchdog_w,
- NULL
+ DEVCB_INPUT_PORT("RIOT0_SWA"), /* Port 6 */
+ DEVCB_INPUT_PORT("RIOT0_SWB"), /* Port 7 */
+ DEVCB_NULL,
+ DEVCB_HANDLER(watchdog_w),
+ DEVCB_NULL
};
static const riot6532_interface r6532_interface_1 =
{
- port8_r,
- port9_r,
- NULL,
- tourtabl_led_w,
- NULL
+ DEVCB_INPUT_PORT("RIOT1_SWA"), /* Port 8 */
+ DEVCB_INPUT_PORT("RIOT1_SWB"), /* Port 9 */
+ DEVCB_NULL,
+ DEVCB_HANDLER(tourtabl_led_w),
+ DEVCB_NULL
};