From cdadb9c780c99b9d85f221549510c2970643190d Mon Sep 17 00:00:00 2001 From: Andrew Gardner Date: Fri, 28 Dec 2012 21:26:58 +0000 Subject: [PATCH] Modernize Gaelco sound devices. [Andrew Gardner] Out of whatsnew: These are really simple to do between the inevitable holiday distractions. Zen. Etc. --- src/emu/sound/gaelco.c | 201 +++++++++++++------------------------ src/emu/sound/gaelco.h | 68 +++++++++++-- src/mame/drivers/gaelco2.c | 170 +++++++++++++++---------------- 3 files changed, 212 insertions(+), 227 deletions(-) diff --git a/src/emu/sound/gaelco.c b/src/emu/sound/gaelco.c index 0fa01c919fb..43d1476ebd0 100644 --- a/src/emu/sound/gaelco.c +++ b/src/emu/sound/gaelco.c @@ -42,52 +42,43 @@ Registers per channel: #define LOG_SOUND(x) do { if (VERBOSE_SOUND) logerror x; } while (0) #define LOG_READ_WRITES(x) do { if (VERBOSE_READ_WRITES) logerror x; } while (0) -#define LOG_WAVE 0 //#define ALT_MIX -#define GAELCO_NUM_CHANNELS 0x07 -#define VOLUME_LEVELS 0x10 +#define LOG_WAVE 0 +static wav_file* wavraw; // Raw waveform -/* this structure defines a channel */ -struct gaelco_sound_channel + +/*============================================================================ + Gaelco GAE1 sound device + ============================================================================*/ + +const device_type GAELCO_GAE1 = &device_creator; + +gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, GAELCO_GAE1, "Gaelco GAE1", tag, owner, clock), + device_sound_interface(mconfig, *this), + m_stream(NULL), + m_snd_data(NULL) { - int active; /* is it playing? */ - int loop; /* = 0 no looping, = 1 looping */ - int chunkNum; /* current chunk if looping */ -}; - -/* this structure defines the Gaelco custom sound chip */ -struct gaelco_sound_state -{ - sound_stream *stream; /* our stream */ - UINT8 *snd_data; /* PCM data */ - int banks[4]; /* start of each ROM bank */ - gaelco_sound_channel channel[GAELCO_NUM_CHANNELS]; /* 7 stereo channels */ - - UINT16 sndregs[0x38]; - - /* table for converting from 8 to 16 bits with volume control */ - INT16 volume_table[VOLUME_LEVELS][256]; -}; - -static wav_file * wavraw; /* raw waveform */ - -INLINE gaelco_sound_state *get_safe_token(device_t *device) -{ - assert(device != NULL); - assert(device->type() == GAELCO_GAE1 || device->type() == GAELCO_CG1V); - return (gaelco_sound_state *)downcast(device)->token(); } +gaelco_gae1_device::gaelco_gae1_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_stream(NULL), + m_snd_data(NULL) +{ +} + + /*============================================================================ CG-1V/GAE1 Sound Update Writes length bytes to the sound buffer ============================================================================*/ -static STREAM_UPDATE( gaelco_update ) +void gaelco_gae1_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { - gaelco_sound_state *info = (gaelco_sound_state *)param; int j, ch; /* fill all data needed */ @@ -97,7 +88,7 @@ static STREAM_UPDATE( gaelco_update ) /* for each channel */ for (ch = 0; ch < GAELCO_NUM_CHANNELS; ch ++){ int ch_data_l = 0, ch_data_r = 0; - gaelco_sound_channel *channel = &info->channel[ch]; + gaelco_sound_channel *channel = &m_channel[ch]; /* if the channel is playing */ if (channel->active == 1){ @@ -112,47 +103,47 @@ static STREAM_UPDATE( gaelco_update ) base_offset = ch*8 + chunkNum*4; /* get channel parameters */ - type = ((info->sndregs[base_offset + 1] >> 4) & 0x0f); - bank = info->banks[((info->sndregs[base_offset + 1] >> 0) & 0x03)]; - vol_l = ((info->sndregs[base_offset + 1] >> 12) & 0x0f); - vol_r = ((info->sndregs[base_offset + 1] >> 8) & 0x0f); - end_pos = info->sndregs[base_offset + 2] << 8; + type = ((m_sndregs[base_offset + 1] >> 4) & 0x0f); + bank = m_banks[((m_sndregs[base_offset + 1] >> 0) & 0x03)]; + vol_l = ((m_sndregs[base_offset + 1] >> 12) & 0x0f); + vol_r = ((m_sndregs[base_offset + 1] >> 8) & 0x0f); + end_pos = m_sndregs[base_offset + 2] << 8; /* generates output data (range 0x00000..0xffff) */ if (type == 0x08){ /* PCM, 8 bits mono */ - data = info->snd_data[bank + end_pos + info->sndregs[base_offset + 3]]; - ch_data_l = info->volume_table[vol_l][data]; - ch_data_r = info->volume_table[vol_r][data]; + data = m_snd_data[bank + end_pos + m_sndregs[base_offset + 3]]; + ch_data_l = m_volume_table[vol_l][data]; + ch_data_r = m_volume_table[vol_r][data]; - info->sndregs[base_offset + 3]--; + m_sndregs[base_offset + 3]--; } else if (type == 0x0c){ /* PCM, 8 bits stereo */ - data = info->snd_data[bank + end_pos + info->sndregs[base_offset + 3]]; - ch_data_l = info->volume_table[vol_l][data]; + data = m_snd_data[bank + end_pos + m_sndregs[base_offset + 3]]; + ch_data_l = m_volume_table[vol_l][data]; - info->sndregs[base_offset + 3]--; + m_sndregs[base_offset + 3]--; - if (info->sndregs[base_offset + 3] > 0){ - data = info->snd_data[bank + end_pos + info->sndregs[base_offset + 3]]; - ch_data_r = info->volume_table[vol_r][data]; + if (m_sndregs[base_offset + 3] > 0){ + data = m_snd_data[bank + end_pos + m_sndregs[base_offset + 3]]; + ch_data_r = m_volume_table[vol_r][data]; - info->sndregs[base_offset + 3]--; + m_sndregs[base_offset + 3]--; } } else { - LOG_SOUND(("(GAE1) Playing unknown sample format in channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", ch, type, bank, end_pos, info->sndregs[base_offset + 3])); + LOG_SOUND(("(GAE1) Playing unknown sample format in channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", ch, type, bank, end_pos, m_sndregs[base_offset + 3])); channel->active = 0; } /* check if the current sample has finished playing */ - if (info->sndregs[base_offset + 3] == 0){ + if (m_sndregs[base_offset + 3] == 0){ if (channel->loop == 0){ /* if no looping, we're done */ channel->active = 0; } else { /* if we're looping, swap chunks */ channel->chunkNum = (channel->chunkNum + 1) & 0x01; /* if the length of the next chunk is 0, we're done */ - if (info->sndregs[ch*8 + channel->chunkNum*4 + 3] == 0){ + if (m_sndregs[ch*8 + channel->chunkNum*4 + 3] == 0){ channel->active = 0; } } @@ -189,40 +180,37 @@ static STREAM_UPDATE( gaelco_update ) CG-1V/GAE1 Read Handler ============================================================================*/ -READ16_DEVICE_HANDLER( gaelcosnd_r ) +READ16_MEMBER( gaelco_gae1_device::gaelcosnd_r ) { - gaelco_sound_state *info = get_safe_token(device); + LOG_READ_WRITES(("%s: (GAE1): read from %04x\n", machine().describe_context(), offset)); - LOG_READ_WRITES(("%s: (GAE1): read from %04x\n", device->machine().describe_context(), offset)); - - return info->sndregs[offset]; + return m_sndregs[offset]; } /*============================================================================ CG-1V/GAE1 Write Handler ============================================================================*/ -WRITE16_DEVICE_HANDLER( gaelcosnd_w ) +WRITE16_MEMBER( gaelco_gae1_device::gaelcosnd_w ) { - gaelco_sound_state *info = get_safe_token(device); - gaelco_sound_channel *channel = &info->channel[offset >> 3]; + gaelco_sound_channel *channel = &m_channel[offset >> 3]; - LOG_READ_WRITES(("%s: (GAE1): write %04x to %04x\n", device->machine().describe_context(), data, offset)); + LOG_READ_WRITES(("%s: (GAE1): write %04x to %04x\n", machine().describe_context(), data, offset)); /* first update the stream to this point in time */ - info->stream->update(); + m_stream->update(); - COMBINE_DATA(&info->sndregs[offset]); + COMBINE_DATA(&m_sndregs[offset]); switch(offset & 0x07){ case 0x03: /* trigger sound */ - if ((info->sndregs[offset - 1] != 0) && (data != 0)){ + if ((m_sndregs[offset - 1] != 0) && (data != 0)){ if (!channel->active){ channel->active = 1; channel->chunkNum = 0; channel->loop = 0; - LOG_SOUND(("(GAE1) Playing sample channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", offset >> 3, (info->sndregs[offset - 2] >> 4) & 0x0f, info->sndregs[offset - 2] & 0x03, info->sndregs[offset - 1] << 8, data)); + LOG_SOUND(("(GAE1) Playing sample channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", offset >> 3, (m_sndregs[offset - 2] >> 4) & 0x0f, m_sndregs[offset - 2] & 0x03, m_sndregs[offset - 1] << 8, data)); } } else { channel->active = 0; @@ -231,8 +219,8 @@ WRITE16_DEVICE_HANDLER( gaelcosnd_w ) break; case 0x07: /* enable/disable looping */ - if ((info->sndregs[offset - 1] != 0) && (data != 0)){ - LOG_SOUND(("(GAE1) Looping in channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", offset >> 3, (info->sndregs[offset - 2] >> 4) & 0x0f, info->sndregs[offset - 2] & 0x03, info->sndregs[offset - 1] << 8, data)); + if ((m_sndregs[offset - 1] != 0) && (data != 0)){ + LOG_SOUND(("(GAE1) Looping in channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", offset >> 3, (m_sndregs[offset - 2] >> 4) & 0x0f, m_sndregs[offset - 2] & 0x03, m_sndregs[offset - 1] << 8, data)); channel->loop = 1; } else { channel->loop = 0; @@ -243,29 +231,27 @@ WRITE16_DEVICE_HANDLER( gaelcosnd_w ) } /*============================================================================ - CG-1V/GAE1 Init + CG-1V/GAE1 Init / Close ============================================================================*/ -static DEVICE_START( gaelco ) +void gaelco_gae1_device::device_start() { int j, vol; - const gaelcosnd_interface *intf = (const gaelcosnd_interface *)device->static_config(); - - gaelco_sound_state *info = get_safe_token(device); + const gaelcosnd_interface *intf = (const gaelcosnd_interface *)static_config(); /* copy rom banks */ for (j = 0; j < 4; j++){ - info->banks[j] = intf->banks[j]; + m_banks[j] = intf->banks[j]; } - info->stream = device->machine().sound().stream_alloc(*device, 0, 2, 8000, info, gaelco_update); - info->snd_data = (UINT8 *)device->machine().root_device().memregion(intf->gfxregion)->base(); - if (info->snd_data == NULL) - info->snd_data = *device->region(); + m_stream = stream_alloc(0, 2, 8000); + m_snd_data = (UINT8 *)machine().root_device().memregion(intf->gfxregion)->base(); + if (m_snd_data == NULL) + m_snd_data = *region(); /* init volume table */ for (vol = 0; vol < VOLUME_LEVELS; vol++){ for (j = -128; j <= 127; j++){ - info->volume_table[vol][(j ^ 0x80) & 0xff] = (vol*j*256)/(VOLUME_LEVELS - 1); + m_volume_table[vol][(j ^ 0x80) & 0xff] = (vol*j*256)/(VOLUME_LEVELS - 1); } } @@ -274,7 +260,7 @@ static DEVICE_START( gaelco ) } -static DEVICE_STOP( gaelco ) +void gaelco_gae1_device::device_stop() { if (wavraw) wav_close(wavraw); @@ -282,60 +268,11 @@ static DEVICE_STOP( gaelco ) } -const device_type GAELCO_GAE1 = &device_creator; -gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, GAELCO_GAE1, "Gaelco GAE1", tag, owner, clock), - device_sound_interface(mconfig, *this) -{ - m_token = global_alloc_clear(gaelco_sound_state); -} - -gaelco_gae1_device::gaelco_gae1_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_clear(gaelco_sound_state); -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void gaelco_gae1_device::device_config_complete() -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void gaelco_gae1_device::device_start() -{ - DEVICE_START_NAME( gaelco )(this); -} - -//------------------------------------------------- -// device_stop - device-specific stop -//------------------------------------------------- - -void gaelco_gae1_device::device_stop() -{ - DEVICE_STOP_NAME( gaelco )(this); -} - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void gaelco_gae1_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"); -} +/*============================================================================ + Gaelco CG-1V sound device + ============================================================================*/ const device_type GAELCO_CG1V = &device_creator; diff --git a/src/emu/sound/gaelco.h b/src/emu/sound/gaelco.h index 9a4fe4df54f..f0a6224b539 100644 --- a/src/emu/sound/gaelco.h +++ b/src/emu/sound/gaelco.h @@ -3,7 +3,42 @@ #ifndef __GALELCO_H__ #define __GALELCO_H__ -#include "devlegcy.h" +#define GAELCO_NUM_CHANNELS 0x07 +#define VOLUME_LEVELS 0x10 + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_GAELCO_GAE1_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, GAELCO_GAE1, _clock) \ + +#define MCFG_GAELCO_GAE1_REPLACE(_tag, _clock) \ + MCFG_DEVICE_REPLACE(_tag, GAELCO_GAE1, _clock) \ + +#define MCFG_GAELCO_CG1V_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, GAELCO_CG1V, _clock) \ + +#define MCFG_GAELCO_CG1V_REPLACE(_tag, _clock) \ + MCFG_DEVICE_REPLACE(_tag, GAELCO_CG1V, _clock) \ + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> Sound Channel + +struct gaelco_sound_channel +{ + int active; // is it playing? + int loop; // = 0 no looping, = 1 looping + int chunkNum; // current chunk if looping +}; + + +// ======================> External interface struct gaelcosnd_interface { @@ -11,34 +46,47 @@ struct gaelcosnd_interface int banks[4]; /* start of each ROM bank */ }; -DECLARE_WRITE16_DEVICE_HANDLER( gaelcosnd_w ); -DECLARE_READ16_DEVICE_HANDLER( gaelcosnd_r ); + +// ======================> gaelco_gae1_device class gaelco_gae1_device : public device_t, - public device_sound_interface + public device_sound_interface { public: gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); - ~gaelco_gae1_device() { global_free(m_token); } + ~gaelco_gae1_device() { } - // access to legacy token - void *token() const { assert(m_token != NULL); return m_token; } protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); virtual void device_stop(); // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +public: + DECLARE_WRITE16_MEMBER( gaelcosnd_w ); + DECLARE_READ16_MEMBER( gaelcosnd_r ); + private: - // internal state - void *m_token; + sound_stream *m_stream; /* our stream */ + UINT8 *m_snd_data; /* PCM data */ + int m_banks[4]; /* start of each ROM bank */ + gaelco_sound_channel m_channel[GAELCO_NUM_CHANNELS]; /* 7 stereo channels */ + + UINT16 m_sndregs[0x38]; + + // Table for converting from 8 to 16 bits with volume control + INT16 m_volume_table[VOLUME_LEVELS][256]; }; extern const device_type GAELCO_GAE1; + + +// ======================> gaelco_cg1v_device + class gaelco_cg1v_device : public gaelco_gae1_device { public: diff --git a/src/mame/drivers/gaelco2.c b/src/mame/drivers/gaelco2.c index 9d538b238a6..1491cffca5f 100644 --- a/src/mame/drivers/gaelco2.c +++ b/src/mame/drivers/gaelco2.c @@ -55,17 +55,17 @@ GFXDECODEINFO(0x0400000, 128) ============================================================================*/ static ADDRESS_MAP_START( maniacsq_map, AS_PROGRAM, 16, gaelco2_state ) - AM_RANGE(0x000000, 0x03ffff) AM_ROM /* ROM */ - AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ - AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ - AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ - AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs") /* Video Registers */ - AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0") /* DSW #1 + Input 1P */ - AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1") /* DSW #2 + Input 2P */ - AM_RANGE(0x30004a, 0x30004b) AM_WRITENOP /* Sound muting? */ - AM_RANGE(0x320000, 0x320001) AM_READ_PORT("COIN") /* COINSW + SERVICESW */ - AM_RANGE(0x500000, 0x500001) AM_WRITE(gaelco2_coin_w) /* Coin lockout + counters */ - AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ + AM_RANGE(0x000000, 0x03ffff) AM_ROM /* ROM */ + AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_gae1_device, gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ + AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ + AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ + AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs") /* Video Registers */ + AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0") /* DSW #1 + Input 1P */ + AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1") /* DSW #2 + Input 2P */ + AM_RANGE(0x30004a, 0x30004b) AM_WRITENOP /* Sound muting? */ + AM_RANGE(0x320000, 0x320001) AM_READ_PORT("COIN") /* COINSW + SERVICESW */ + AM_RANGE(0x500000, 0x500001) AM_WRITE(gaelco2_coin_w) /* Coin lockout + counters */ + AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ ADDRESS_MAP_END @@ -178,7 +178,7 @@ static MACHINE_CONFIG_START( maniacsq, gaelco2_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("gaelco", GAELCO_GAE1, 0) + MCFG_GAELCO_GAE1_ADD("gaelco", 0) MCFG_SOUND_CONFIG(maniacsq_snd_interface) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) @@ -212,26 +212,26 @@ READ16_MEMBER(gaelco2_state::p2_gun_x){return (ioport("LIGHT1_X")->read() * 320 READ16_MEMBER(gaelco2_state::p2_gun_y){return (ioport("LIGHT1_Y")->read() * 240 / 0x100) - 4;} static ADDRESS_MAP_START( bang_map, AS_PROGRAM, 16, gaelco2_state ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ - AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ - AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ - AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ + AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ + AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_cg1v_device, gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ + AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ + AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ AM_RANGE(0x218004, 0x218009) AM_READONLY /* Video Registers */ - AM_RANGE(0x218004, 0x218007) AM_WRITEONLY AM_SHARE("vregs") /* Video Registers */ - AM_RANGE(0x218008, 0x218009) AM_WRITENOP /* CLR INT Video */ + AM_RANGE(0x218004, 0x218007) AM_WRITEONLY AM_SHARE("vregs") /* Video Registers */ + AM_RANGE(0x218008, 0x218009) AM_WRITENOP /* CLR INT Video */ AM_RANGE(0x300000, 0x300001) AM_READ_PORT("P1") - AM_RANGE(0x300002, 0x300003) AM_READNOP /* Random number generator? */ - AM_RANGE(0x300000, 0x300003) AM_WRITE(gaelco2_coin2_w) /* Coin Counters */ - AM_RANGE(0x300008, 0x300009) AM_WRITE(gaelco2_eeprom_data_w) /* EEPROM data */ - AM_RANGE(0x30000a, 0x30000b) AM_WRITE(gaelco2_eeprom_sk_w) /* EEPROM serial clock */ - AM_RANGE(0x30000c, 0x30000d) AM_WRITE(gaelco2_eeprom_cs_w) /* EEPROM chip select */ + AM_RANGE(0x300002, 0x300003) AM_READNOP /* Random number generator? */ + AM_RANGE(0x300000, 0x300003) AM_WRITE(gaelco2_coin2_w) /* Coin Counters */ + AM_RANGE(0x300008, 0x300009) AM_WRITE(gaelco2_eeprom_data_w) /* EEPROM data */ + AM_RANGE(0x30000a, 0x30000b) AM_WRITE(gaelco2_eeprom_sk_w) /* EEPROM serial clock */ + AM_RANGE(0x30000c, 0x30000d) AM_WRITE(gaelco2_eeprom_cs_w) /* EEPROM chip select */ AM_RANGE(0x300010, 0x300011) AM_READ_PORT("P2") AM_RANGE(0x300020, 0x300021) AM_READ_PORT("COIN") - AM_RANGE(0x310000, 0x310001) AM_READ(p1_gun_x) AM_WRITE(bang_clr_gun_int_w) /* Gun 1P X */ /* CLR INT Gun */ - AM_RANGE(0x310002, 0x310003) AM_READ(p2_gun_x) /* Gun 2P X */ - AM_RANGE(0x310004, 0x310005) AM_READ(p1_gun_y) /* Gun 1P Y */ - AM_RANGE(0x310006, 0x310007) AM_READ(p2_gun_y) /* Gun 2P Y */ - AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ + AM_RANGE(0x310000, 0x310001) AM_READ(p1_gun_x) AM_WRITE(bang_clr_gun_int_w) /* Gun 1P X */ /* CLR INT Gun */ + AM_RANGE(0x310002, 0x310003) AM_READ(p2_gun_x) /* Gun 2P X */ + AM_RANGE(0x310004, 0x310005) AM_READ(p1_gun_y) /* Gun 1P Y */ + AM_RANGE(0x310006, 0x310007) AM_READ(p2_gun_y) /* Gun 2P Y */ + AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ ADDRESS_MAP_END @@ -311,7 +311,7 @@ static MACHINE_CONFIG_START( bang, gaelco2_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("gaelco", GAELCO_CG1V, 0) + MCFG_GAELCO_CG1V_ADD("gaelco", 0) MCFG_SOUND_CONFIG(bang_snd_interface) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) @@ -430,17 +430,17 @@ ROM_END static ADDRESS_MAP_START( alighunt_map, AS_PROGRAM, 16, gaelco2_state ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ - AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ - AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ - AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ + AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ + AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_gae1_device, gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ + AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ + AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs") /* Video Registers */ - AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0") /* DSW #1 + Input 1P */ - AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1") /* DSW #2 + Input 2P */ - AM_RANGE(0x320000, 0x320001) AM_READ_PORT("COIN") /* COINSW + SERVICESW */ - AM_RANGE(0x500000, 0x500001) AM_WRITE(gaelco2_coin_w) /* Coin lockout + counters */ - AM_RANGE(0x500006, 0x500007) AM_WRITENOP /* ??? */ - AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ + AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0") /* DSW #1 + Input 1P */ + AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1") /* DSW #2 + Input 2P */ + AM_RANGE(0x320000, 0x320001) AM_READ_PORT("COIN") /* COINSW + SERVICESW */ + AM_RANGE(0x500000, 0x500001) AM_WRITE(gaelco2_coin_w) /* Coin lockout + counters */ + AM_RANGE(0x500006, 0x500007) AM_WRITENOP /* ??? */ + AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ ADDRESS_MAP_END @@ -552,7 +552,7 @@ static MACHINE_CONFIG_START( alighunt, gaelco2_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("gaelco", GAELCO_GAE1, 0) + MCFG_GAELCO_GAE1_ADD("gaelco", 0) MCFG_SOUND_CONFIG(alighunt_snd_interface) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) @@ -641,18 +641,18 @@ READ16_MEMBER(gaelco2_state::dallas_kludge_r) } static ADDRESS_MAP_START( touchgo_map, AS_PROGRAM, 16, gaelco2_state ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ - AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ - AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ - AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ - AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs") /* Video Registers */ - AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0") /* DSW #1 + Input 1P */ - AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1") /* DSW #2 + Input 2P */ - AM_RANGE(0x300004, 0x300005) AM_READ_PORT("IN2") /* COINSW + Input 3P */ - AM_RANGE(0x300006, 0x300007) AM_READ_PORT("IN3") /* SERVICESW + Input 4P */ - AM_RANGE(0x500000, 0x50001f) AM_WRITE(touchgo_coin_w) /* Coin counters */ - AM_RANGE(0xfefffa, 0xfefffb) AM_RAM_READ(dallas_kludge_r) /* DS5002FP related patch */ - AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ + AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ + AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_gae1_device, gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ + AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ + AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ + AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs") /* Video Registers */ + AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0") /* DSW #1 + Input 1P */ + AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1") /* DSW #2 + Input 2P */ + AM_RANGE(0x300004, 0x300005) AM_READ_PORT("IN2") /* COINSW + Input 3P */ + AM_RANGE(0x300006, 0x300007) AM_READ_PORT("IN3") /* SERVICESW + Input 4P */ + AM_RANGE(0x500000, 0x50001f) AM_WRITE(touchgo_coin_w) /* Coin counters */ + AM_RANGE(0xfefffa, 0xfefffb) AM_RAM_READ(dallas_kludge_r) /* DS5002FP related patch */ + AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ ADDRESS_MAP_END @@ -802,7 +802,7 @@ static MACHINE_CONFIG_START( touchgo, gaelco2_state ) /* the chip is stereo, but the game sound is mono because the right channel output is for cabinet 1 and the left channel output is for cabinet 2 */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("gaelco", GAELCO_GAE1, 0) + MCFG_GAELCO_GAE1_ADD("gaelco", 0) MCFG_SOUND_CONFIG(touchgo_snd_interface) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) @@ -905,21 +905,21 @@ ROM_END ============================================================================*/ static ADDRESS_MAP_START( snowboar_map, AS_PROGRAM, 16, gaelco2_state ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ - AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ - AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ - AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ - AM_RANGE(0x212000, 0x213fff) AM_RAM /* Extra RAM */ - AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs") /* Video Registers */ + AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ + AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_cg1v_device, gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ + AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ + AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ + AM_RANGE(0x212000, 0x213fff) AM_RAM /* Extra RAM */ + AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs") /* Video Registers */ AM_RANGE(0x300000, 0x300001) AM_READ_PORT("P1") - AM_RANGE(0x300000, 0x300003) AM_WRITE(gaelco2_coin2_w) /* Coin Counters */ - AM_RANGE(0x300008, 0x300009) AM_WRITE(gaelco2_eeprom_data_w) /* EEPROM data */ - AM_RANGE(0x30000a, 0x30000b) AM_WRITE(gaelco2_eeprom_sk_w) /* EEPROM serial clock */ - AM_RANGE(0x30000c, 0x30000d) AM_WRITE(gaelco2_eeprom_cs_w) /* EEPROM chip select */ + AM_RANGE(0x300000, 0x300003) AM_WRITE(gaelco2_coin2_w) /* Coin Counters */ + AM_RANGE(0x300008, 0x300009) AM_WRITE(gaelco2_eeprom_data_w) /* EEPROM data */ + AM_RANGE(0x30000a, 0x30000b) AM_WRITE(gaelco2_eeprom_sk_w) /* EEPROM serial clock */ + AM_RANGE(0x30000c, 0x30000d) AM_WRITE(gaelco2_eeprom_cs_w) /* EEPROM chip select */ AM_RANGE(0x300010, 0x300011) AM_READ_PORT("P2") AM_RANGE(0x300020, 0x300021) AM_READ_PORT("COIN") AM_RANGE(0x310000, 0x31ffff) AM_READWRITE(snowboar_protection_r,snowboar_protection_w) AM_SHARE("snowboar_prot") /* Protection */ - AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ + AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ ADDRESS_MAP_END @@ -988,7 +988,7 @@ static MACHINE_CONFIG_START( snowboar, gaelco2_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("gaelco", GAELCO_CG1V, 0) + MCFG_GAELCO_CG1V_ADD("gaelco", 0) MCFG_SOUND_CONFIG(snowboar_snd_interface) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) @@ -1090,20 +1090,20 @@ ROM_END ============================================================================*/ static ADDRESS_MAP_START( wrally2_map, AS_PROGRAM, 16, gaelco2_state ) - AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ - AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ - AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ - AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ - AM_RANGE(0x212000, 0x213fff) AM_RAM /* Extra RAM */ + AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */ + AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_gae1_device, gaelcosnd_r, gaelcosnd_w) /* Sound Registers */ + AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */ + AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram") /* Palette */ + AM_RANGE(0x212000, 0x213fff) AM_RAM /* Extra RAM */ AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs") /* Video Registers */ - AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0") /* DIPSW #2 + Inputs 1P */ - AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1") /* DIPSW #1 */ - AM_RANGE(0x300004, 0x300005) AM_READ_PORT("IN2") /* Inputs 2P + COINSW */ - AM_RANGE(0x300006, 0x300007) AM_READ_PORT("IN3") /* SERVICESW */ - AM_RANGE(0x400000, 0x400011) AM_WRITE(wrally2_coin_w) /* Coin Counters */ - AM_RANGE(0x400028, 0x400029) AM_WRITE(wrally2_adc_clk) /* ADCs clock-in line */ - AM_RANGE(0x400030, 0x400031) AM_WRITE(wrally2_adc_cs) /* ADCs chip select line */ - AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ + AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0") /* DIPSW #2 + Inputs 1P */ + AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1") /* DIPSW #1 */ + AM_RANGE(0x300004, 0x300005) AM_READ_PORT("IN2") /* Inputs 2P + COINSW */ + AM_RANGE(0x300006, 0x300007) AM_READ_PORT("IN3") /* SERVICESW */ + AM_RANGE(0x400000, 0x400011) AM_WRITE(wrally2_coin_w) /* Coin Counters */ + AM_RANGE(0x400028, 0x400029) AM_WRITE(wrally2_adc_clk) /* ADCs clock-in line */ + AM_RANGE(0x400030, 0x400031) AM_WRITE(wrally2_adc_cs) /* ADCs chip select line */ + AM_RANGE(0xfe0000, 0xfeffff) AM_RAM /* Work RAM */ ADDRESS_MAP_END @@ -1238,7 +1238,7 @@ static MACHINE_CONFIG_START( wrally2, gaelco2_state ) /* the chip is stereo, but the game sound is mono because the right channel output is for cabinet 1 and the left channel output is for cabinet 2 */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_SOUND_ADD("gaelco", GAELCO_GAE1, 0) + MCFG_GAELCO_GAE1_ADD("gaelco", 0) MCFG_SOUND_CONFIG(wrally2_snd_interface) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) @@ -1439,14 +1439,14 @@ ROM_END GAME( 1994, aligator, 0, alighunt, alighunt, gaelco2_state, alighunt, ROT0, "Gaelco", "Alligator Hunt", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) GAME( 1994, aligatorun,aligator,alighunt, alighunt, gaelco2_state, alighunt, ROT0, "Gaelco", "Alligator Hunt (unprotected)", 0 ) -GAME( 1995, touchgo, 0, touchgo, touchgo, gaelco2_state, touchgo, ROT0, "Gaelco", "Touch & Go (World)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1995, touchgon, touchgo, touchgo, touchgo, gaelco2_state, touchgo, ROT0, "Gaelco", "Touch & Go (Non North America)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1995, touchgoe, touchgo, touchgo, touchgo, gaelco2_state, touchgo, ROT0, "Gaelco", "Touch & Go (earlier revision)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1995, wrally2, 0, wrally2, wrally2, driver_device, 0, ROT0, "Gaelco", "World Rally 2: Twin Racing", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1995, touchgo, 0, touchgo, touchgo, gaelco2_state, touchgo, ROT0, "Gaelco", "Touch & Go (World)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1995, touchgon, touchgo, touchgo, touchgo, gaelco2_state, touchgo, ROT0, "Gaelco", "Touch & Go (Non North America)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1995, touchgoe, touchgo, touchgo, touchgo, gaelco2_state, touchgo, ROT0, "Gaelco", "Touch & Go (earlier revision)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1995, wrally2, 0, wrally2, wrally2, driver_device, 0, ROT0, "Gaelco", "World Rally 2: Twin Racing", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) GAME( 1996, maniacsq, 0, maniacsq, maniacsq, driver_device, 0, ROT0, "Gaelco", "Maniac Square (unprotected)", 0 ) GAME( 1996, snowboar, 0, snowboar, snowboar, driver_device, 0, ROT0, "Gaelco", "Snow Board Championship (Version 2.1)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) GAME( 1996, snowboara,snowboar, snowboar, snowboar, gaelco2_state, snowboar, ROT0, "Gaelco", "Snow Board Championship (Version 2.0)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1998, bang, 0, bang, bang, gaelco2_state, bang, ROT0, "Gaelco", "Bang!", 0 ) -GAME( 1998, bangj, bang, bang, bang, gaelco2_state, bang, ROT0, "Gaelco", "Gun Gabacho (Japan)", 0 ) +GAME( 1998, bang, 0, bang, bang, gaelco2_state, bang, ROT0, "Gaelco", "Bang!", 0 ) +GAME( 1998, bangj, bang, bang, bang, gaelco2_state, bang, ROT0, "Gaelco", "Gun Gabacho (Japan)", 0 ) GAME( 1999, grtesoro, 0, maniacsq, maniacsq, driver_device, 0, ROT0, "Nova Desitec", "Gran Tesoro? / Play 2000 (v5.01) (Italy)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) GAME( 1999, grtesoro4, grtesoro,maniacsq, maniacsq, driver_device, 0, ROT0, "Nova Desitec", "Gran Tesoro? / Play 2000 (v4.0) (Italy)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )