mirror of
https://github.com/holub/mame
synced 2025-05-21 13:18:56 +03:00
Changed irq callback to be of type devcb_write_line
- Updated drivers accordingly - Removed some trampoline functions
This commit is contained in:
parent
7b6de74a1e
commit
fecae12d70
@ -49,6 +49,7 @@ TI's naming has D7 as LSB and D0 as MSB and is in uppercase
|
||||
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
|
||||
|
||||
#define MAX_SAMPLE_CHUNK 512
|
||||
#define FIFO_SIZE 16
|
||||
|
||||
|
||||
enum _tms5220_variant
|
||||
@ -74,8 +75,10 @@ typedef enum _tms5220_variant tms5220_variant;
|
||||
typedef struct _tms5220_state tms5220_state;
|
||||
struct _tms5220_state
|
||||
{
|
||||
/* callbacks */
|
||||
devcb_resolved_write_line irq_func;
|
||||
|
||||
/* these contain data that describes the 128-bit data FIFO */
|
||||
#define FIFO_SIZE 16
|
||||
UINT8 fifo[FIFO_SIZE];
|
||||
UINT8 fifo_head;
|
||||
UINT8 fifo_tail;
|
||||
@ -100,9 +103,6 @@ struct _tms5220_state
|
||||
UINT8 buffer_empty; /* FIFO is empty*/
|
||||
UINT8 irq_pin; /* state of the IRQ pin (output) */
|
||||
|
||||
void (*irq_func)(const device_config *device, int state); /* called when the state of the IRQ pin changes */
|
||||
|
||||
|
||||
/* these contain data describing the current and previous voice frames */
|
||||
UINT16 old_energy;
|
||||
UINT16 old_pitch;
|
||||
@ -1097,8 +1097,8 @@ static void check_buffer_low(tms5220_state *tms)
|
||||
|
||||
static void set_interrupt_state(tms5220_state *tms, int state)
|
||||
{
|
||||
if (tms->intf->irq && state != tms->irq_pin)
|
||||
tms->intf->irq(tms->device, state);
|
||||
if (tms->irq_func.write && state != tms->irq_pin)
|
||||
devcb_call_write_line(&tms->irq_func, !state);
|
||||
tms->irq_pin = state;
|
||||
}
|
||||
|
||||
@ -1111,7 +1111,7 @@ static void set_interrupt_state(tms5220_state *tms, int state)
|
||||
|
||||
static DEVICE_START( tms5220 )
|
||||
{
|
||||
static const tms5220_interface dummy = { 0 };
|
||||
static const tms5220_interface dummy = { DEVCB_NULL };
|
||||
tms5220_state *tms = get_safe_token(device);
|
||||
|
||||
/* set the interface and device */
|
||||
@ -1119,6 +1119,10 @@ static DEVICE_START( tms5220 )
|
||||
tms->device = device;
|
||||
tms->clock = device->clock;
|
||||
|
||||
/* resolve */
|
||||
|
||||
devcb_resolve_write_line(&tms->irq_func, &tms->intf->irq_func, device);
|
||||
|
||||
/* initialize a stream */
|
||||
tms->stream = stream_create(device, 0, 1, device->clock / 80, tms, tms5220_update);
|
||||
|
||||
@ -1158,7 +1162,7 @@ static DEVICE_RESET( tms5220 )
|
||||
/* initialize the chip state */
|
||||
/* Note that we do not actually clear IRQ on start-up : IRQ is even raised if tms->buffer_empty or tms->buffer_low are 0 */
|
||||
tms->tms5220_speaking = tms->speak_external = tms->talk_status = tms->first_frame = tms->last_frame = tms->irq_pin = 0;
|
||||
if (tms->intf->irq) tms->intf->irq(tms->device, 0);
|
||||
set_interrupt_state(tms, 0);
|
||||
tms->buffer_empty = tms->buffer_low = 1;
|
||||
|
||||
tms->RDB_flag = FALSE;
|
||||
|
@ -12,7 +12,7 @@
|
||||
typedef struct _tms5220_interface tms5220_interface;
|
||||
struct _tms5220_interface
|
||||
{
|
||||
void (*irq)(const device_config *device, int state); /* IRQ callback function */
|
||||
devcb_write_line irq_func; /* IRQ callback function */
|
||||
|
||||
int (*read)(const device_config *device, int count); /* speech ROM read callback */
|
||||
void (*load_address)(const device_config *device, int data); /* speech ROM load address callback */
|
||||
|
@ -332,9 +332,9 @@ static WRITE8_HANDLER( looping_souint_clr )
|
||||
}
|
||||
|
||||
|
||||
static void looping_spcint(const device_config *device, int state)
|
||||
static WRITE_LINE_DEVICE_HANDLER( looping_spcint )
|
||||
{
|
||||
cputag_set_input_line_and_vector(device->machine, "audiocpu", 0, state, 6);
|
||||
cputag_set_input_line_and_vector(device->machine, "audiocpu", 0, !state, 6);
|
||||
}
|
||||
|
||||
|
||||
@ -576,7 +576,7 @@ GFXDECODE_END
|
||||
|
||||
static const tms5220_interface tms5220_config =
|
||||
{
|
||||
looping_spcint
|
||||
DEVCB_LINE(looping_spcint)
|
||||
};
|
||||
|
||||
static const ay8910_interface ay8910_config =
|
||||
|
@ -54,6 +54,8 @@ VIDEO_UPDATE( zaccaria );
|
||||
|
||||
|
||||
static int dsw;
|
||||
static int active_8910, port0a, acs;
|
||||
static int last_port0b;
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( zaccaria_dsw_sel_w )
|
||||
{
|
||||
@ -108,10 +110,15 @@ static WRITE8_DEVICE_HANDLER( ay8910_port0a_w )
|
||||
}
|
||||
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0a ) { cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); }
|
||||
static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0b ) { cputag_set_input_line(device->machine, "audiocpu", 0, state ? ASSERT_LINE : CLEAR_LINE); }
|
||||
static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0a )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static int active_8910, port0a, acs;
|
||||
static WRITE_LINE_DEVICE_HANDLER( zaccaria_irq0b )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static READ8_DEVICE_HANDLER( zaccaria_port0a_r )
|
||||
{
|
||||
@ -125,35 +132,33 @@ static WRITE8_DEVICE_HANDLER( zaccaria_port0a_w )
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( zaccaria_port0b_w )
|
||||
{
|
||||
static int last;
|
||||
|
||||
|
||||
/* bit 1 goes to 8910 #0 BDIR pin */
|
||||
if ((last & 0x02) == 0x02 && (data & 0x02) == 0x00)
|
||||
if ((last_port0b & 0x02) == 0x02 && (data & 0x02) == 0x00)
|
||||
{
|
||||
/* bit 0 goes to the 8910 #0 BC1 pin */
|
||||
ay8910_data_address_w(devtag_get_device(device->machine, "ay1"), last, port0a);
|
||||
ay8910_data_address_w(devtag_get_device(device->machine, "ay1"), last_port0b, port0a);
|
||||
}
|
||||
else if ((last & 0x02) == 0x00 && (data & 0x02) == 0x02)
|
||||
else if ((last_port0b & 0x02) == 0x00 && (data & 0x02) == 0x02)
|
||||
{
|
||||
/* bit 0 goes to the 8910 #0 BC1 pin */
|
||||
if (last & 0x01)
|
||||
if (last_port0b & 0x01)
|
||||
active_8910 = 0;
|
||||
}
|
||||
/* bit 3 goes to 8910 #1 BDIR pin */
|
||||
if ((last & 0x08) == 0x08 && (data & 0x08) == 0x00)
|
||||
if ((last_port0b & 0x08) == 0x08 && (data & 0x08) == 0x00)
|
||||
{
|
||||
/* bit 2 goes to the 8910 #1 BC1 pin */
|
||||
ay8910_data_address_w(devtag_get_device(device->machine, "ay2"), last >> 2, port0a);
|
||||
ay8910_data_address_w(devtag_get_device(device->machine, "ay2"), last_port0b >> 2, port0a);
|
||||
}
|
||||
else if ((last & 0x08) == 0x00 && (data & 0x08) == 0x08)
|
||||
else if ((last_port0b & 0x08) == 0x00 && (data & 0x08) == 0x08)
|
||||
{
|
||||
/* bit 2 goes to the 8910 #1 BC1 pin */
|
||||
if (last & 0x04)
|
||||
if (last_port0b & 0x04)
|
||||
active_8910 = 1;
|
||||
}
|
||||
|
||||
last = data;
|
||||
last_port0b = data;
|
||||
}
|
||||
|
||||
static INTERRUPT_GEN( zaccaria_cb1_toggle )
|
||||
@ -165,24 +170,6 @@ static INTERRUPT_GEN( zaccaria_cb1_toggle )
|
||||
toggle ^= 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//static int port1a,port1b;
|
||||
|
||||
static READ8_DEVICE_HANDLER( zaccaria_port1a_r )
|
||||
{
|
||||
const device_config *tms = devtag_get_device(device->machine, "tms");
|
||||
|
||||
return tms5220_status_r(tms,0);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( zaccaria_port1a_w )
|
||||
{
|
||||
const device_config *tms = devtag_get_device(device->machine, "tms");
|
||||
|
||||
tms5220_data_w(tms,0,data);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( zaccaria_port1b_w )
|
||||
{
|
||||
const device_config *tms = devtag_get_device(device->machine, "tms");
|
||||
@ -204,12 +191,6 @@ static READ_LINE_DEVICE_HANDLER( zaccaria_ca2_r )
|
||||
return tms5220_readyq_r(device);
|
||||
}
|
||||
|
||||
static void tms5220_irq_handler(const device_config *device, int state)
|
||||
{
|
||||
const device_config *pia1 = devtag_get_device(device->machine, "pia1");
|
||||
pia6821_cb1_w(pia1,0,state ? 0 : 1);
|
||||
}
|
||||
|
||||
|
||||
static const pia6821_interface pia_0_intf =
|
||||
{
|
||||
@ -230,13 +211,13 @@ static const pia6821_interface pia_0_intf =
|
||||
|
||||
static const pia6821_interface pia_1_intf =
|
||||
{
|
||||
DEVCB_HANDLER(zaccaria_port1a_r), /* port A in */
|
||||
DEVCB_DEVICE_HANDLER("tms", tms5220_status_r), /* port A in */
|
||||
DEVCB_NULL, /* port B in */
|
||||
DEVCB_NULL, /* line CA1 in */
|
||||
DEVCB_NULL, /* line CB1 in */
|
||||
DEVCB_DEVICE_LINE("tms", zaccaria_ca2_r), /* line CA2 in */
|
||||
DEVCB_NULL, /* line CB2 in */
|
||||
DEVCB_HANDLER(zaccaria_port1a_w), /* port A out */
|
||||
DEVCB_DEVICE_HANDLER("tms", tms5220_data_w), /* port A out */
|
||||
DEVCB_HANDLER(zaccaria_port1b_w), /* port B out */
|
||||
DEVCB_NULL, /* line CA2 out */
|
||||
DEVCB_NULL, /* port CB2 out */
|
||||
@ -561,7 +542,7 @@ static const ay8910_interface ay8910_config =
|
||||
|
||||
static const tms5220_interface tms5220_config =
|
||||
{
|
||||
tms5220_irq_handler /* IRQ handler */
|
||||
DEVCB_DEVICE_HANDLER("pia1", pia6821_cb1_w) /* IRQ handler */
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user