mirror of
https://github.com/holub/mame
synced 2025-05-29 00:53:09 +03:00
Added polling hooks for SP0250 DRQ line. The callback is now optional.
If not provided, then the kick timer is not used.
This commit is contained in:
parent
3d7b496183
commit
951bb250e5
@ -20,6 +20,7 @@
|
|||||||
#include "sndintrf.h"
|
#include "sndintrf.h"
|
||||||
#include "streams.h"
|
#include "streams.h"
|
||||||
#include "cpuintrf.h"
|
#include "cpuintrf.h"
|
||||||
|
#include "cpuexec.h"
|
||||||
#include "sp0250.h"
|
#include "sp0250.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -106,6 +107,7 @@ static void sp0250_load_values(struct sp0250 *sp)
|
|||||||
sp->filter[5].B = sp0250_gc(sp->fifo[13]);
|
sp->filter[5].B = sp0250_gc(sp->fifo[13]);
|
||||||
sp->filter[5].F = sp0250_gc(sp->fifo[14]);
|
sp->filter[5].F = sp0250_gc(sp->fifo[14]);
|
||||||
sp->fifo_pos = 0;
|
sp->fifo_pos = 0;
|
||||||
|
if (sp->drq != NULL)
|
||||||
sp->drq(ASSERT_LINE);
|
sp->drq(ASSERT_LINE);
|
||||||
|
|
||||||
sp->pcount = 0;
|
sp->pcount = 0;
|
||||||
@ -198,9 +200,12 @@ static SND_START( sp0250 )
|
|||||||
sp = auto_malloc(sizeof(*sp));
|
sp = auto_malloc(sizeof(*sp));
|
||||||
memset(sp, 0, sizeof(*sp));
|
memset(sp, 0, sizeof(*sp));
|
||||||
sp->RNG = 1;
|
sp->RNG = 1;
|
||||||
sp->drq = intf->drq_callback;
|
sp->drq = (intf != NULL) ? intf->drq_callback : NULL;
|
||||||
|
if (sp->drq != NULL)
|
||||||
|
{
|
||||||
sp->drq(ASSERT_LINE);
|
sp->drq(ASSERT_LINE);
|
||||||
timer_pulse(device->machine, attotime_mul(ATTOTIME_IN_HZ(clock), CLOCK_DIVIDER), sp, 0, sp0250_timer_tick);
|
timer_pulse(device->machine, attotime_mul(ATTOTIME_IN_HZ(clock), CLOCK_DIVIDER), sp, 0, sp0250_timer_tick);
|
||||||
|
}
|
||||||
|
|
||||||
sp->stream = stream_create(device, 0, 1, clock / CLOCK_DIVIDER, sp, sp0250_update);
|
sp->stream = stream_create(device, 0, 1, clock / CLOCK_DIVIDER, sp, sp0250_update);
|
||||||
|
|
||||||
@ -211,12 +216,23 @@ static SND_START( sp0250 )
|
|||||||
WRITE8_HANDLER( sp0250_w )
|
WRITE8_HANDLER( sp0250_w )
|
||||||
{
|
{
|
||||||
struct sp0250 *sp = sndti_token(SOUND_SP0250, 0);
|
struct sp0250 *sp = sndti_token(SOUND_SP0250, 0);
|
||||||
|
stream_update(sp->stream);
|
||||||
if (sp->fifo_pos != 15)
|
if (sp->fifo_pos != 15)
|
||||||
{
|
{
|
||||||
sp->fifo[sp->fifo_pos++] = data;
|
sp->fifo[sp->fifo_pos++] = data;
|
||||||
if (sp->fifo_pos == 15)
|
if (sp->fifo_pos == 15 && sp->drq != NULL)
|
||||||
sp->drq(CLEAR_LINE);
|
sp->drq(CLEAR_LINE);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
logerror("%s: overflow SP0250 FIFO\n", cpuexec_describe_context(space->machine));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UINT8 sp0250_drq_r(void)
|
||||||
|
{
|
||||||
|
struct sp0250 *sp = sndti_token(SOUND_SP0250, 0);
|
||||||
|
stream_update(sp->stream);
|
||||||
|
return (sp->fifo_pos == 15) ? CLEAR_LINE : ASSERT_LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ struct sp0250_interface {
|
|||||||
};
|
};
|
||||||
|
|
||||||
WRITE8_HANDLER( sp0250_w );
|
WRITE8_HANDLER( sp0250_w );
|
||||||
|
UINT8 sp0250_drq_r(void);
|
||||||
|
|
||||||
SND_GET_INFO( sp0250 );
|
SND_GET_INFO( sp0250 );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user