mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
modernised YM2612/YM3438 [smf]
This commit is contained in:
parent
30f001dbe9
commit
cd3930106c
@ -12,166 +12,155 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "sound/fm.h"
|
||||
#include "sound/2612intf.h"
|
||||
|
||||
|
||||
struct ym2612_state
|
||||
{
|
||||
sound_stream * stream;
|
||||
emu_timer * timer[2];
|
||||
void * chip;
|
||||
const ym2612_interface *intf;
|
||||
device_t *device;
|
||||
devcb_resolved_write_line irqhandler;
|
||||
};
|
||||
|
||||
|
||||
INLINE ym2612_state *get_safe_token(device_t *device)
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert(device->type() == YM2612 || device->type() == YM3438);
|
||||
return (ym2612_state *)downcast<ym2612_device *>(device)->token();
|
||||
}
|
||||
|
||||
|
||||
#include "fm.h"
|
||||
#include "2612intf.h"
|
||||
|
||||
/*------------------------- TM2612 -------------------------------*/
|
||||
/* IRQ Handler */
|
||||
static void IRQHandler(void *param,int irq)
|
||||
{
|
||||
ym2612_state *info = (ym2612_state *)param;
|
||||
if (!info->irqhandler.isnull())
|
||||
info->irqhandler(irq);
|
||||
ym2612_device *ym2612 = (ym2612_device *) param;
|
||||
ym2612->_IRQHandler(irq);
|
||||
}
|
||||
|
||||
void ym2612_device::_IRQHandler(int irq)
|
||||
{
|
||||
if (!m_irq_handler.isnull())
|
||||
m_irq_handler(irq);
|
||||
}
|
||||
|
||||
/* Timer overflow callback from timer.c */
|
||||
static TIMER_CALLBACK( timer_callback_2612_0 )
|
||||
void ym2612_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
ym2612_state *info = (ym2612_state *)ptr;
|
||||
ym2612_timer_over(info->chip,0);
|
||||
}
|
||||
switch(id)
|
||||
{
|
||||
case 0:
|
||||
ym2612_timer_over(m_chip,0);
|
||||
break;
|
||||
|
||||
static TIMER_CALLBACK( timer_callback_2612_1 )
|
||||
{
|
||||
ym2612_state *info = (ym2612_state *)ptr;
|
||||
ym2612_timer_over(info->chip,1);
|
||||
case 1:
|
||||
ym2612_timer_over(m_chip,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void timer_handler(void *param,int c,int count,int clock)
|
||||
{
|
||||
ym2612_state *info = (ym2612_state *)param;
|
||||
ym2612_device *ym2612 = (ym2612_device *) param;
|
||||
ym2612->_timer_handler(c, count, clock);
|
||||
}
|
||||
|
||||
void ym2612_device::_timer_handler(int c,int count,int clock)
|
||||
{
|
||||
if( count == 0 )
|
||||
{ /* Reset FM Timer */
|
||||
info->timer[c]->enable(false);
|
||||
m_timer[c]->enable(false);
|
||||
}
|
||||
else
|
||||
{ /* Start FM Timer */
|
||||
attotime period = attotime::from_hz(clock) * count;
|
||||
if (!info->timer[c]->enable(1))
|
||||
info->timer[c]->adjust(period);
|
||||
|
||||
if (!m_timer[c]->enable(true))
|
||||
m_timer[c]->adjust(period);
|
||||
}
|
||||
}
|
||||
|
||||
/* update request from fm.c */
|
||||
void ym2612_update_request(void *param)
|
||||
{
|
||||
ym2612_state *info = (ym2612_state *)param;
|
||||
info->stream->update();
|
||||
ym2612_device *ym2612 = (ym2612_device *) param;
|
||||
ym2612->_ym2612_update_request();
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
/* YM2612 */
|
||||
/***********************************************************/
|
||||
|
||||
static STREAM_UPDATE( ym2612_stream_update )
|
||||
void ym2612_device::_ym2612_update_request()
|
||||
{
|
||||
ym2612_state *info = (ym2612_state *)param;
|
||||
ym2612_update_one(info->chip, outputs, samples);
|
||||
m_stream->update();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void ym2612_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
|
||||
{
|
||||
ym2612_update_one(m_chip, outputs, samples);
|
||||
}
|
||||
|
||||
|
||||
static void ym2612_intf_postload(ym2612_state *info)
|
||||
void ym2612_device::device_post_load()
|
||||
{
|
||||
ym2612_postload(info->chip);
|
||||
ym2612_postload(m_chip);
|
||||
}
|
||||
|
||||
|
||||
static DEVICE_START( ym2612 )
|
||||
{
|
||||
static const ym2612_interface dummy = { DEVCB_NULL };
|
||||
ym2612_state *info = get_safe_token(device);
|
||||
int rate = device->clock()/72;
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
info->intf = device->static_config() ? (const ym2612_interface *)device->static_config() : &dummy;
|
||||
info->device = device;
|
||||
info->irqhandler.resolve(info->intf->irqhandler, *device);
|
||||
void ym2612_device::device_start()
|
||||
{
|
||||
int rate = clock()/72;
|
||||
|
||||
m_irq_handler.resolve();
|
||||
|
||||
/* FM init */
|
||||
/* Timer Handler set */
|
||||
info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2612_0), info);
|
||||
info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2612_1), info);
|
||||
m_timer[0] = timer_alloc(0);
|
||||
m_timer[1] = timer_alloc(1);
|
||||
|
||||
/* stream system initialize */
|
||||
info->stream = device->machine().sound().stream_alloc(*device,0,2,rate,info,ym2612_stream_update);
|
||||
m_stream = machine().sound().stream_alloc(*this,0,2,rate);
|
||||
|
||||
/**** initialize YM2612 ****/
|
||||
info->chip = ym2612_init(info,device,device->clock(),rate,timer_handler,IRQHandler);
|
||||
assert_always(info->chip != NULL, "Error creating YM2612 chip");
|
||||
|
||||
device->machine().save().register_postload(save_prepost_delegate(FUNC(ym2612_intf_postload), info));
|
||||
m_chip = ym2612_init(this,this,clock(),rate,timer_handler,IRQHandler);
|
||||
assert_always(m_chip != NULL, "Error creating YM2612 chip");
|
||||
}
|
||||
|
||||
|
||||
static DEVICE_STOP( ym2612 )
|
||||
//-------------------------------------------------
|
||||
// device_stop - device-specific stop
|
||||
//-------------------------------------------------
|
||||
|
||||
void ym2612_device::device_stop()
|
||||
{
|
||||
ym2612_state *info = get_safe_token(device);
|
||||
ym2612_shutdown(info->chip);
|
||||
ym2612_shutdown(m_chip);
|
||||
}
|
||||
|
||||
static DEVICE_RESET( ym2612 )
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void ym2612_device::device_reset()
|
||||
{
|
||||
ym2612_state *info = get_safe_token(device);
|
||||
ym2612_reset_chip(info->chip);
|
||||
ym2612_reset_chip(m_chip);
|
||||
}
|
||||
|
||||
|
||||
READ8_DEVICE_HANDLER( ym2612_r )
|
||||
READ8_MEMBER( ym2612_device::read )
|
||||
{
|
||||
ym2612_state *info = get_safe_token(device);
|
||||
return ym2612_read(info->chip, offset & 3);
|
||||
return ym2612_read(m_chip, offset & 3);
|
||||
}
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ym2612_w )
|
||||
WRITE8_MEMBER( ym2612_device::write )
|
||||
{
|
||||
ym2612_state *info = get_safe_token(device);
|
||||
ym2612_write(info->chip, offset & 3, data);
|
||||
ym2612_write(m_chip, offset & 3, data);
|
||||
}
|
||||
|
||||
|
||||
READ8_DEVICE_HANDLER( ym2612_status_port_a_r ) { return ym2612_r(device, space, 0); }
|
||||
READ8_DEVICE_HANDLER( ym2612_status_port_b_r ) { return ym2612_r(device, space, 2); }
|
||||
READ8_DEVICE_HANDLER( ym2612_data_port_a_r ) { return ym2612_r(device, space, 1); }
|
||||
READ8_DEVICE_HANDLER( ym2612_data_port_b_r ) { return ym2612_r(device, space, 3); }
|
||||
|
||||
WRITE8_DEVICE_HANDLER( ym2612_control_port_a_w ) { ym2612_w(device, space, 0, data); }
|
||||
WRITE8_DEVICE_HANDLER( ym2612_control_port_b_w ) { ym2612_w(device, space, 2, data); }
|
||||
WRITE8_DEVICE_HANDLER( ym2612_data_port_a_w ) { ym2612_w(device, space, 1, data); }
|
||||
WRITE8_DEVICE_HANDLER( ym2612_data_port_b_w ) { ym2612_w(device, space, 3, data); }
|
||||
|
||||
const device_type YM2612 = &device_creator<ym2612_device>;
|
||||
|
||||
ym2612_device::ym2612_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, YM2612, "YM2612", tag, owner, clock),
|
||||
device_sound_interface(mconfig, *this)
|
||||
device_sound_interface(mconfig, *this),
|
||||
m_irq_handler(*this)
|
||||
{
|
||||
m_token = global_alloc_clear(ym2612_state);
|
||||
}
|
||||
|
||||
ym2612_device::ym2612_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)
|
||||
device_sound_interface(mconfig, *this),
|
||||
m_irq_handler(*this)
|
||||
{
|
||||
m_token = global_alloc_clear(ym2612_state);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -184,43 +173,6 @@ void ym2612_device::device_config_complete()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void ym2612_device::device_start()
|
||||
{
|
||||
DEVICE_START_NAME( ym2612 )(this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void ym2612_device::device_reset()
|
||||
{
|
||||
DEVICE_RESET_NAME( ym2612 )(this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_stop - device-specific stop
|
||||
//-------------------------------------------------
|
||||
|
||||
void ym2612_device::device_stop()
|
||||
{
|
||||
DEVICE_STOP_NAME( ym2612 )(this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void ym2612_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");
|
||||
}
|
||||
|
||||
|
||||
const device_type YM3438 = &device_creator<ym3438_device>;
|
||||
|
||||
@ -228,13 +180,3 @@ ym3438_device::ym3438_device(const machine_config &mconfig, const char *tag, dev
|
||||
: ym2612_device(mconfig, YM3438, "YM3438", tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
||||
void ym3438_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");
|
||||
}
|
||||
|
@ -3,28 +3,12 @@
|
||||
#ifndef __2612INTF_H__
|
||||
#define __2612INTF_H__
|
||||
|
||||
#include "devlegcy.h"
|
||||
#include "emu.h"
|
||||
|
||||
void ym2612_update_request(void *param);
|
||||
|
||||
struct ym2612_interface
|
||||
{
|
||||
devcb_write_line irqhandler;
|
||||
};
|
||||
|
||||
DECLARE_READ8_DEVICE_HANDLER( ym2612_r );
|
||||
DECLARE_WRITE8_DEVICE_HANDLER( ym2612_w );
|
||||
|
||||
DECLARE_READ8_DEVICE_HANDLER( ym2612_status_port_a_r );
|
||||
DECLARE_READ8_DEVICE_HANDLER( ym2612_status_port_b_r );
|
||||
DECLARE_READ8_DEVICE_HANDLER( ym2612_data_port_a_r );
|
||||
DECLARE_READ8_DEVICE_HANDLER( ym2612_data_port_b_r );
|
||||
|
||||
DECLARE_WRITE8_DEVICE_HANDLER( ym2612_control_port_a_w );
|
||||
DECLARE_WRITE8_DEVICE_HANDLER( ym2612_control_port_b_w );
|
||||
DECLARE_WRITE8_DEVICE_HANDLER( ym2612_data_port_a_w );
|
||||
DECLARE_WRITE8_DEVICE_HANDLER( ym2612_data_port_b_w );
|
||||
|
||||
#define MCFG_YM2612_IRQ_HANDLER(_devcb) \
|
||||
devcb = &ym2612_device::set_irq_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
class ym2612_device : public device_t,
|
||||
public device_sound_interface
|
||||
@ -32,55 +16,44 @@ class ym2612_device : public device_t,
|
||||
public:
|
||||
ym2612_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
ym2612_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
|
||||
~ym2612_device() { global_free(m_token); }
|
||||
|
||||
// access to legacy token
|
||||
void *token() const { assert(m_token != NULL); return m_token; }
|
||||
// static configuration helpers
|
||||
template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<ym2612_device &>(device).m_irq_handler.set_callback(object); }
|
||||
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
|
||||
void _IRQHandler(int irq);
|
||||
void _timer_handler(int c,int count,int clock);
|
||||
void _ym2612_update_request();
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_post_load();
|
||||
virtual void device_stop();
|
||||
virtual void device_reset();
|
||||
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
private:
|
||||
// internal state
|
||||
void *m_token;
|
||||
sound_stream * m_stream;
|
||||
emu_timer * m_timer[2];
|
||||
void * m_chip;
|
||||
devcb2_write_line m_irq_handler;
|
||||
};
|
||||
|
||||
extern const device_type YM2612;
|
||||
|
||||
|
||||
|
||||
struct ym3438_interface
|
||||
{
|
||||
devcb_write_line irqhandler;
|
||||
};
|
||||
|
||||
|
||||
#define ym3438_r ym2612_r
|
||||
#define ym3438_w ym2612_w
|
||||
|
||||
#define ym3438_status_port_a_r ym2612_status_port_a_r
|
||||
#define ym3438_status_port_b_r ym2612_status_port_b_r
|
||||
#define ym3438_data_port_a_r ym2612_data_port_a_r
|
||||
#define ym3438_data_port_b_r ym2612_data_port_b_r
|
||||
|
||||
#define ym3438_control_port_a_w ym2612_control_port_a_w
|
||||
#define ym3438_control_port_b_w ym2612_control_port_b_w
|
||||
#define ym3438_data_port_a_w ym2612_data_port_a_w
|
||||
#define ym3438_data_port_b_w ym2612_data_port_b_w
|
||||
|
||||
|
||||
class ym3438_device : public ym2612_device
|
||||
{
|
||||
public:
|
||||
ym3438_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 YM3438;
|
||||
|
@ -1038,7 +1038,7 @@ static ADDRESS_MAP_START( model1_snd, AS_PROGRAM, 16, model1_state )
|
||||
AM_RANGE(0xc50000, 0xc50001) AM_WRITE(m1_snd_mpcm_bnk1_w )
|
||||
AM_RANGE(0xc60000, 0xc60007) AM_DEVREADWRITE8_LEGACY("sega2", multipcm_r, multipcm_w, 0x00ff )
|
||||
AM_RANGE(0xc70000, 0xc70001) AM_WRITE(m1_snd_mpcm_bnk2_w )
|
||||
AM_RANGE(0xd00000, 0xd00007) AM_DEVREADWRITE8_LEGACY("ymsnd", ym3438_r, ym3438_w, 0x00ff )
|
||||
AM_RANGE(0xd00000, 0xd00007) AM_DEVREADWRITE8("ymsnd", ym3438_device, read, write, 0x00ff )
|
||||
AM_RANGE(0xf00000, 0xf0ffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
@ -1836,7 +1836,7 @@ static ADDRESS_MAP_START( model1_snd, AS_PROGRAM, 16, model2_state )
|
||||
AM_RANGE(0xc50000, 0xc50001) AM_WRITE(m1_snd_mpcm_bnk1_w )
|
||||
AM_RANGE(0xc60000, 0xc60007) AM_DEVREADWRITE8_LEGACY("sega2", multipcm_r, multipcm_w, 0x00ff )
|
||||
AM_RANGE(0xc70000, 0xc70001) AM_WRITE(m1_snd_mpcm_bnk2_w )
|
||||
AM_RANGE(0xd00000, 0xd00007) AM_DEVREADWRITE8_LEGACY("ymsnd", ym3438_r, ym3438_w, 0x00ff )
|
||||
AM_RANGE(0xd00000, 0xd00007) AM_DEVREADWRITE8("ymsnd", ym3438_device, read, write, 0x00ff )
|
||||
AM_RANGE(0xf00000, 0xf0ffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
@ -599,7 +599,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, segac2_state )
|
||||
AM_RANGE(0x800000, 0x800001) AM_MIRROR(0x13fdfe) AM_READWRITE(prot_r, prot_w)
|
||||
AM_RANGE(0x800200, 0x800201) AM_MIRROR(0x13fdfe) AM_WRITE(control_w)
|
||||
AM_RANGE(0x840000, 0x84001f) AM_MIRROR(0x13fee0) AM_READWRITE(io_chip_r, io_chip_w)
|
||||
AM_RANGE(0x840100, 0x840107) AM_MIRROR(0x13fef8) AM_DEVREADWRITE8_LEGACY("ymsnd", ym3438_r, ym3438_w, 0x00ff)
|
||||
AM_RANGE(0x840100, 0x840107) AM_MIRROR(0x13fef8) AM_DEVREADWRITE8("ymsnd", ym3438_device, read, write, 0x00ff)
|
||||
AM_RANGE(0x880100, 0x880101) AM_MIRROR(0x13fefe) AM_WRITE(counter_timer_w)
|
||||
AM_RANGE(0x8c0000, 0x8c0fff) AM_MIRROR(0x13f000) AM_READWRITE(palette_r, palette_w) AM_SHARE("paletteram")
|
||||
AM_RANGE(0xc00000, 0xc0001f) AM_MIRROR(0x18ff00) AM_DEVREADWRITE("gen_vdp", sega_genesis_vdp_device, megadriv_vdp_r,megadriv_vdp_w)
|
||||
@ -1225,10 +1225,6 @@ WRITE_LINE_MEMBER(segac2_state::segac2_irq2_interrupt)
|
||||
//printf("sound irq %d\n", state);
|
||||
m_maincpu->set_input_line(2, state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
static const ym3438_interface ym3438_intf =
|
||||
{
|
||||
DEVCB_DRIVER_LINE_MEMBER(segac2_state,segac2_irq2_interrupt) /* IRQ handler */
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -1387,7 +1383,7 @@ static MACHINE_CONFIG_START( segac, segac2_state )
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_SOUND_ADD("ymsnd", YM3438, XL2_CLOCK/7)
|
||||
MCFG_SOUND_CONFIG(ym3438_intf)
|
||||
MCFG_YM2612_IRQ_HANDLER(WRITELINE(segac2_state, segac2_irq2_interrupt))
|
||||
MCFG_SOUND_ROUTE(0, "mono", 0.50)
|
||||
/* right channel not connected */
|
||||
|
||||
|
@ -628,8 +628,8 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, segas18_state )
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ym1", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ym2", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE("ym1", ym3438_device, read, write)
|
||||
AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE("ym2", ym3438_device, read, write)
|
||||
AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1f) AM_WRITE(soundbank_w)
|
||||
AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_READ(soundlatch_byte_r) AM_WRITE(mcu_data_w)
|
||||
ADDRESS_MAP_END
|
||||
|
@ -1230,8 +1230,8 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( system32_sound_portmap, AS_IO, 8, segas32_state )
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ym1", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ym2", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE("ym1", ym3438_device, read, write)
|
||||
AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE("ym2", ym3438_device, read, write)
|
||||
AM_RANGE(0xa0, 0xaf) AM_WRITE(sound_bank_lo_w)
|
||||
AM_RANGE(0xb0, 0xbf) AM_WRITE(sound_bank_hi_w)
|
||||
AM_RANGE(0xc0, 0xcf) AM_WRITE(sound_int_control_lo_w)
|
||||
@ -1250,7 +1250,7 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( multi32_sound_portmap, AS_IO, 8, segas32_state )
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE_LEGACY("ymsnd", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0x80, 0x83) AM_MIRROR(0x0c) AM_DEVREADWRITE("ymsnd", ym3438_device, read, write)
|
||||
AM_RANGE(0xa0, 0xaf) AM_WRITE(sound_bank_lo_w)
|
||||
AM_RANGE(0xb0, 0xbf) AM_WRITE(multipcm_bank_w)
|
||||
AM_RANGE(0xc0, 0xcf) AM_WRITE(sound_int_control_lo_w)
|
||||
@ -2128,19 +2128,6 @@ GFXDECODE_END
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Sound interfaces
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const ym3438_interface ym3438_config =
|
||||
{
|
||||
DEVCB_DRIVER_LINE_MEMBER(segas32_state,ym3438_irq_handler)
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Dual PCB shared memory comms
|
||||
@ -2212,7 +2199,7 @@ static MACHINE_CONFIG_START( system32, segas32_state )
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
MCFG_SOUND_ADD("ym1", YM3438, MASTER_CLOCK/4)
|
||||
MCFG_SOUND_CONFIG(ym3438_config)
|
||||
MCFG_YM2612_IRQ_HANDLER(WRITELINE(segas32_state, ym3438_irq_handler))
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 0.40)
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 0.40)
|
||||
|
||||
@ -2278,7 +2265,7 @@ static MACHINE_CONFIG_START( multi32, segas32_state )
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
MCFG_SOUND_ADD("ymsnd", YM3438, MASTER_CLOCK/4)
|
||||
MCFG_SOUND_CONFIG(ym3438_config)
|
||||
MCFG_YM2612_IRQ_HANDLER(WRITELINE(segas32_state, ym3438_irq_handler))
|
||||
MCFG_SOUND_ROUTE(1, "lspeaker", 0.40)
|
||||
MCFG_SOUND_ROUTE(0, "rspeaker", 0.40)
|
||||
|
||||
|
@ -1492,11 +1492,6 @@ WRITE_LINE_MEMBER(seta_state::utoukond_ym3438_interrupt)
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, state);
|
||||
}
|
||||
|
||||
static const ym3438_interface utoukond_ym3438_intf =
|
||||
{
|
||||
DEVCB_DRIVER_LINE_MEMBER(seta_state,utoukond_ym3438_interrupt) // IRQ handler
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
|
||||
@ -3217,7 +3212,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( utoukond_sound_io_map, AS_IO, 8, seta_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ymsnd", ym3438_device, read, write)
|
||||
AM_RANGE(0x80, 0x80) AM_WRITENOP //?
|
||||
AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r)
|
||||
ADDRESS_MAP_END
|
||||
@ -8909,7 +8904,7 @@ static MACHINE_CONFIG_START( utoukond, seta_state )
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
||||
|
||||
MCFG_SOUND_ADD("ymsnd", YM3438, 16000000/4) /* 4 MHz */
|
||||
MCFG_SOUND_CONFIG(utoukond_ym3438_intf)
|
||||
MCFG_YM2612_IRQ_HANDLER(WRITELINE(seta_state, utoukond_ym3438_interrupt))
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 0.30)
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 0.30)
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -184,7 +184,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( heberpop_sound_io_map, AS_IO, 8, shangha3_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x03) AM_DEVREADWRITE_LEGACY("ymsnd", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ymsnd", ym3438_device, read, write)
|
||||
AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki", okim6295_device, read, write)
|
||||
AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r)
|
||||
ADDRESS_MAP_END
|
||||
@ -470,11 +470,6 @@ WRITE_LINE_MEMBER(shangha3_state::irqhandler)
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, state);
|
||||
}
|
||||
|
||||
static const ym3438_interface ym3438_config =
|
||||
{
|
||||
DEVCB_DRIVER_LINE_MEMBER(shangha3_state,irqhandler)
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( shangha3, shangha3_state )
|
||||
|
||||
@ -542,7 +537,7 @@ static MACHINE_CONFIG_START( heberpop, shangha3_state )
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_SOUND_ADD("ymsnd", YM3438, MASTER_CLOCK/6) /* 8 MHz? */
|
||||
MCFG_SOUND_CONFIG(ym3438_config)
|
||||
MCFG_YM2612_IRQ_HANDLER(WRITELINE(shangha3_state,irqhandler))
|
||||
MCFG_SOUND_ROUTE(0, "mono", 0.40)
|
||||
MCFG_SOUND_ROUTE(1, "mono", 0.40)
|
||||
|
||||
@ -582,7 +577,7 @@ static MACHINE_CONFIG_START( blocken, shangha3_state )
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_SOUND_ADD("ymsnd", YM3438, MASTER_CLOCK/6) /* 8 MHz? */
|
||||
MCFG_SOUND_CONFIG(ym3438_config)
|
||||
MCFG_YM2612_IRQ_HANDLER(WRITELINE(shangha3_state,irqhandler))
|
||||
MCFG_SOUND_ROUTE(0, "mono", 0.40)
|
||||
MCFG_SOUND_ROUTE(1, "mono", 0.40)
|
||||
|
||||
|
@ -1035,8 +1035,8 @@ WRITE8_MEMBER(segas1x_bootleg_state::sys18_soundbank_w)
|
||||
|
||||
static ADDRESS_MAP_START( sound_18_io_map, AS_IO, 8, segas1x_bootleg_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x80, 0x83) AM_DEVREADWRITE_LEGACY("3438.0", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0x90, 0x93) AM_DEVREADWRITE_LEGACY("3438.1", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("3438.0", ym3438_device, read, write)
|
||||
AM_RANGE(0x90, 0x93) AM_DEVREADWRITE("3438.1", ym3438_device, read, write)
|
||||
AM_RANGE(0xa0, 0xa0) AM_WRITE(sys18_soundbank_w)
|
||||
AM_RANGE(0xc0, 0xc0) AM_READ(soundlatch_byte_r)
|
||||
ADDRESS_MAP_END
|
||||
@ -1211,8 +1211,8 @@ static ADDRESS_MAP_START(shdancbl_sound_map, AS_PROGRAM, 8, segas1x_bootleg_stat
|
||||
AM_RANGE(0xc000, 0xc00f) AM_WRITENOP
|
||||
AM_RANGE(0xc400, 0xc400) AM_READ(soundlatch_byte_r)
|
||||
AM_RANGE(0xc800, 0xc800) AM_WRITE(shdancbl_msm5205_data_w)
|
||||
AM_RANGE(0xcc00, 0xcc03) AM_DEVREADWRITE_LEGACY("3438.0", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0xd000, 0xd003) AM_DEVREADWRITE_LEGACY("3438.1", ym3438_r, ym3438_w)
|
||||
AM_RANGE(0xcc00, 0xcc03) AM_DEVREADWRITE("3438.0", ym3438_device, read, write)
|
||||
AM_RANGE(0xd000, 0xd003) AM_DEVREADWRITE("3438.1", ym3438_device, read, write)
|
||||
AM_RANGE(0xd400, 0xd400) AM_WRITE(shdancbl_bankctrl_w)
|
||||
AM_RANGE(0xdf00, 0xdfff) AM_NOP
|
||||
AM_RANGE(0xe000, 0xffff) AM_RAM
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
{ }
|
||||
required_device<cpu_device> m_maincpu;
|
||||
optional_device<cpu_device> m_z80snd;
|
||||
optional_device<device_t> m_ymsnd;
|
||||
optional_device<ym2612_device> m_ymsnd;
|
||||
required_device<sega_genesis_vdp_device> m_vdp;
|
||||
optional_device<sega_32x_device> m_32x;
|
||||
optional_device<sega_segacd_device> m_segacd;
|
||||
|
@ -66,7 +66,7 @@ READ8_MEMBER(md_base_state::megadriv_68k_YM2612_read)
|
||||
//mame_printf_debug("megadriv_68k_YM2612_read %02x %04x\n",offset,mem_mask);
|
||||
if ((m_genz80.z80_has_bus == 0) && (m_genz80.z80_is_reset == 0))
|
||||
{
|
||||
return ym2612_r(m_ymsnd, space, offset);
|
||||
return m_ymsnd->read(space, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -83,7 +83,7 @@ WRITE8_MEMBER(md_base_state::megadriv_68k_YM2612_write)
|
||||
//mame_printf_debug("megadriv_68k_YM2612_write %02x %04x %04x\n",offset,data,mem_mask);
|
||||
if ((m_genz80.z80_has_bus == 0) && (m_genz80.z80_is_reset == 0))
|
||||
{
|
||||
ym2612_w(m_ymsnd, space, offset, data);
|
||||
m_ymsnd->write(space, offset, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -774,7 +774,7 @@ READ8_MEMBER(md_base_state::megadriv_z80_unmapped_read )
|
||||
|
||||
static ADDRESS_MAP_START( megadriv_z80_map, AS_PROGRAM, 8, md_base_state )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_RAMBANK("bank1") AM_MIRROR(0x2000) // RAM can be accessed by the 68k
|
||||
AM_RANGE(0x4000, 0x4003) AM_DEVREADWRITE_LEGACY("ymsnd", ym2612_r,ym2612_w)
|
||||
AM_RANGE(0x4000, 0x4003) AM_DEVREADWRITE("ymsnd", ym2612_device, read, write)
|
||||
|
||||
AM_RANGE(0x6000, 0x6000) AM_WRITE(megadriv_z80_z80_bank_w)
|
||||
AM_RANGE(0x6001, 0x6001) AM_WRITE(megadriv_z80_z80_bank_w) // wacky races uses this address
|
||||
@ -1288,7 +1288,7 @@ WRITE8_MEMBER(md_base_state::z80_unmapped_w )
|
||||
/* sets the megadrive z80 to it's normal ports / map */
|
||||
void mtech_state::megatech_set_megadrive_z80_as_megadrive_z80(const char* tag)
|
||||
{
|
||||
device_t *ym = machine().device("ymsnd");
|
||||
ym2612_device *ym2612 = machine().device<ym2612_device>("ymsnd");
|
||||
|
||||
/* INIT THE PORTS *********************************************************************************************/
|
||||
machine().device(tag)->memory().space(AS_IO).install_readwrite_handler(0x0000, 0xffff, read8_delegate(FUNC(mtech_state::z80_unmapped_port_r),this), write8_delegate(FUNC(mtech_state::z80_unmapped_port_w),this));
|
||||
@ -1303,7 +1303,7 @@ void mtech_state::megatech_set_megadrive_z80_as_megadrive_z80(const char* tag)
|
||||
machine().device(tag)->memory().space(AS_PROGRAM).install_ram(0x0000, 0x1fff, m_genz80.z80_prgram);
|
||||
|
||||
|
||||
machine().device(tag)->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(*ym, 0x4000, 0x4003, FUNC(ym2612_r), FUNC(ym2612_w));
|
||||
machine().device(tag)->memory().space(AS_PROGRAM).install_readwrite_handler(0x4000, 0x4003, read8_delegate(FUNC(ym2612_device::read),ym2612), write8_delegate(FUNC(ym2612_device::write),ym2612));
|
||||
machine().device(tag)->memory().space(AS_PROGRAM).install_write_handler (0x6000, 0x6000, write8_delegate(FUNC(mtech_state::megadriv_z80_z80_bank_w),this));
|
||||
machine().device(tag)->memory().space(AS_PROGRAM).install_write_handler (0x6001, 0x6001, write8_delegate(FUNC(mtech_state::megadriv_z80_z80_bank_w),this));
|
||||
machine().device(tag)->memory().space(AS_PROGRAM).install_read_handler (0x6100, 0x7eff, read8_delegate(FUNC(mtech_state::megadriv_z80_unmapped_read),this));
|
||||
|
Loading…
Reference in New Issue
Block a user