diff options
author | Michaël Banaan Ananas <happppp@users.noreply.github.com> | 2012-09-09 15:19:43 +0000 |
---|---|---|
committer | Michaël Banaan Ananas <happppp@users.noreply.github.com> | 2012-09-09 15:19:43 +0000 |
commit | 043d7775a5355a4c3103b7094706cc69f614f4c5 (patch) | |
tree | a962ef16d3448fbd84209be6e16093e3b18d5381 /src | |
parent | c21b74d779b388b443e8d39bbb69c1e4a201f036 (diff) |
add upd7756_device
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/sound/upd7759.c | 36 | ||||
-rw-r--r-- | src/emu/sound/upd7759.h | 12 | ||||
-rw-r--r-- | src/mame/drivers/homerun.c | 6 |
3 files changed, 47 insertions, 7 deletions
diff --git a/src/emu/sound/upd7759.c b/src/emu/sound/upd7759.c index 9f29e580573..63c0076d120 100644 --- a/src/emu/sound/upd7759.c +++ b/src/emu/sound/upd7759.c @@ -149,6 +149,9 @@ struct _upd7759_state device_t *device; sound_stream *channel; /* stream channel for playback */ + /* chip configuration */ + UINT8 sample_offset_shift; /* header sample address shift (access data > 0xffff) */ + /* internal clock to output sample rate mapping */ UINT32 pos; /* current output sample position */ UINT32 step; /* step value per output sample */ @@ -325,8 +328,8 @@ static void advance_state(upd7759_state *chip) /* Address MSB state: latch the MSB of the sample address and issue a request for the fourth byte */ /* The expected response will be the LSB of the sample address */ case STATE_ADDR_MSB: - chip->offset = (chip->rom ? chip->rom[chip->req_sample * 2 + 5] : chip->fifo_in) << 9; - if (DEBUG_STATES) DEBUG_METHOD("UPD7759: offset_hi = %02X, requesting offset_lo\n", chip->offset >> 9); + chip->offset = (chip->rom ? chip->rom[chip->req_sample * 2 + 5] : chip->fifo_in) << (8 + chip->sample_offset_shift); + if (DEBUG_STATES) DEBUG_METHOD("UPD7759: offset_hi = %02X, requesting offset_lo\n", chip->offset >> (8 + chip->sample_offset_shift)); chip->drq = 1; /* 44 cycles later, we will latch this value and request another byte */ @@ -337,8 +340,8 @@ static void advance_state(upd7759_state *chip) /* Address LSB state: latch the LSB of the sample address and issue a request for the fifth byte */ /* The expected response will be just a dummy */ case STATE_ADDR_LSB: - chip->offset |= (chip->rom ? chip->rom[chip->req_sample * 2 + 6] : chip->fifo_in) << 1; - if (DEBUG_STATES) DEBUG_METHOD("UPD7759: offset_lo = %02X, requesting dummy 2\n", (chip->offset >> 1) & 0xff); + chip->offset |= (chip->rom ? chip->rom[chip->req_sample * 2 + 6] : chip->fifo_in) << chip->sample_offset_shift; + if (DEBUG_STATES) DEBUG_METHOD("UPD7759: offset_lo = %02X, requesting dummy 2\n", (chip->offset >> chip->sample_offset_shift) & 0xff); chip->drq = 1; /* 36 cycles later, we will latch this value and request another byte */ @@ -640,6 +643,9 @@ static DEVICE_START( upd7759 ) chip->device = device; + /* chip configuration */ + chip->sample_offset_shift = (device->type() == UPD7759) ? 1 : 0; + /* allocate a stream channel */ chip->channel = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/4, chip, upd7759_update); @@ -752,6 +758,12 @@ upd7759_device::upd7759_device(const machine_config &mconfig, const char *tag, d { m_token = global_alloc_array_clear(UINT8, sizeof(upd7759_state)); } +upd7759_device::upd7759_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock), + device_sound_interface(mconfig, *this) +{ + m_token = global_alloc_array_clear(UINT8, sizeof(upd7759_state)); +} //------------------------------------------------- // device_config_complete - perform any @@ -792,3 +804,19 @@ void upd7759_device::sound_stream_update(sound_stream &stream, stream_sample_t * } +const device_type UPD7756 = &device_creator<upd7756_device>; + +upd7756_device::upd7756_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : upd7759_device(mconfig, UPD7756, "UPD7756", tag, owner, clock) +{ +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void upd7756_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // should never get here + fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); +} diff --git a/src/emu/sound/upd7759.h b/src/emu/sound/upd7759.h index 0e8ced82bec..71435d6ea3b 100644 --- a/src/emu/sound/upd7759.h +++ b/src/emu/sound/upd7759.h @@ -30,6 +30,7 @@ class upd7759_device : public device_t, { public: upd7759_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + upd7759_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); ~upd7759_device() { global_free(m_token); } // access to legacy token @@ -49,5 +50,16 @@ private: extern const device_type UPD7759; +class upd7756_device : public upd7759_device +{ +public: + upd7756_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); +}; + +extern const device_type UPD7756; + #endif /* __UPD7759_H__ */ diff --git a/src/mame/drivers/homerun.c b/src/mame/drivers/homerun.c index 204d95e5426..f0eb89148fe 100644 --- a/src/mame/drivers/homerun.c +++ b/src/mame/drivers/homerun.c @@ -335,8 +335,8 @@ static MACHINE_CONFIG_START( homerun, homerun_state ) MCFG_SOUND_CONFIG(ym2203_config) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_SOUND_ADD("d7756c", UPD7759, UPD7759_STANDARD_CLOCK) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + MCFG_SOUND_ADD("d7756c", UPD7756, UPD7759_STANDARD_CLOCK) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( ganjaja, homerun ) @@ -400,4 +400,4 @@ ROM_END GAME( 1988, homerun, 0, homerun, homerun, driver_device, 0, ROT0, "Jaleco", "Moero Pro Yakyuu Homerun", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) GAME( 1988, dynashot, 0, homerun, dynashot, driver_device, 0, ROT0, "Jaleco", "Dynamic Shooting", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 1990, ganjaja, 0, ganjaja, ganjaja, driver_device, 0, ROT0, "Jaleco", "Ganbare Jajamaru Saisho wa Goo / Ganbare Jajamaru Hop Step & Jump", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1990, ganjaja, 0, ganjaja, ganjaja, driver_device, 0, ROT0, "Jaleco", "Ganbare Jajamaru Saisho wa Goo / Ganbare Jajamaru Hop Step & Jump", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) |