diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c index e0c9d74c642..63eb1df9f82 100644 --- a/src/emu/sound/samples.c +++ b/src/emu/sound/samples.c @@ -3,7 +3,8 @@ #include "samples.h" -struct sample_channel +typedef struct _sample_channel sample_channel; +struct _sample_channel { sound_stream *stream; const INT16 *source; @@ -17,15 +18,27 @@ struct sample_channel UINT8 paused; }; -struct samples_info + +typedef struct _samples_info samples_info; +struct _samples_info { const device_config *device; int numchannels; /* how many channels */ - struct sample_channel *channel;/* array of channels */ + sample_channel *channel;/* array of channels */ struct loaded_samples *samples;/* array of samples */ }; +INLINE samples_info *get_safe_token(const device_config *device) +{ + assert(device != NULL); + assert(device->token != NULL); + assert(device->type == SOUND); + assert(sound_get_type(device) == SOUND_SAMPLES); + return (samples_info *)device->token; +} + + #define FRAC_BITS 24 #define FRAC_ONE (1 << FRAC_BITS) @@ -228,8 +241,8 @@ struct loaded_samples *readsamples(const char *const *samplenames, const char *b /* mixer_play_sample() */ void sample_start(const device_config *device,int channel,int samplenum,int loop) { - struct samples_info *info = device->token; - struct sample_channel *chan; + samples_info *info = get_safe_token(device); + sample_channel *chan; struct loaded_sample *sample; /* if samples are disabled, just return quietly */ @@ -259,8 +272,8 @@ void sample_start(const device_config *device,int channel,int samplenum,int loop void sample_start_raw(const device_config *device,int channel,const INT16 *sampledata,int samples,int frequency,int loop) { - struct samples_info *info = device->token; - struct sample_channel *chan; + samples_info *info = get_safe_token(device); + sample_channel *chan; assert( channel < info->numchannels ); @@ -283,8 +296,8 @@ void sample_start_raw(const device_config *device,int channel,const INT16 *sampl void sample_set_freq(const device_config *device,int channel,int freq) { - struct samples_info *info = device->token; - struct sample_channel *chan; + samples_info *info = get_safe_token(device); + sample_channel *chan; assert( channel < info->numchannels ); @@ -299,8 +312,8 @@ void sample_set_freq(const device_config *device,int channel,int freq) void sample_set_volume(const device_config *device,int channel,float volume) { - struct samples_info *info = device->token; - struct sample_channel *chan; + samples_info *info = get_safe_token(device); + sample_channel *chan; assert( channel < info->numchannels ); @@ -312,8 +325,8 @@ void sample_set_volume(const device_config *device,int channel,float volume) void sample_set_pause(const device_config *device,int channel,int pause) { - struct samples_info *info = device->token; - struct sample_channel *chan; + samples_info *info = get_safe_token(device); + sample_channel *chan; assert( channel < info->numchannels ); @@ -328,8 +341,8 @@ void sample_set_pause(const device_config *device,int channel,int pause) void sample_stop(const device_config *device,int channel) { - struct samples_info *info = device->token; - struct sample_channel *chan; + samples_info *info = get_safe_token(device); + sample_channel *chan; assert( channel < info->numchannels ); @@ -344,8 +357,8 @@ void sample_stop(const device_config *device,int channel) int sample_get_base_freq(const device_config *device,int channel) { - struct samples_info *info = device->token; - struct sample_channel *chan; + samples_info *info = get_safe_token(device); + sample_channel *chan; assert( channel < info->numchannels ); @@ -359,8 +372,8 @@ int sample_get_base_freq(const device_config *device,int channel) int sample_playing(const device_config *device,int channel) { - struct samples_info *info = device->token; - struct sample_channel *chan; + samples_info *info = get_safe_token(device); + sample_channel *chan; assert( channel < info->numchannels ); @@ -374,7 +387,7 @@ int sample_playing(const device_config *device,int channel) static STREAM_UPDATE( sample_update_sound ) { - struct sample_channel *chan = param; + sample_channel *chan = param; stream_sample_t *buffer = outputs[0]; if (chan->source && !chan->paused) @@ -426,13 +439,13 @@ static STREAM_UPDATE( sample_update_sound ) static STATE_POSTLOAD( samples_postload ) { - struct samples_info *info = param; + samples_info *info = param; int i; /* loop over channels */ for (i = 0; i < info->numchannels; i++) { - struct sample_channel *chan = &info->channel[i]; + sample_channel *chan = &info->channel[i]; /* attach any samples that were loaded and playing */ if (chan->source_num >= 0 && chan->source_num < info->samples->total) @@ -463,7 +476,7 @@ static DEVICE_START( samples ) { int i; const samples_interface *intf = device->static_config; - struct samples_info *info = device->token; + samples_info *info = get_safe_token(device); info->device = device; @@ -512,7 +525,7 @@ DEVICE_GET_INFO( samples ) switch (state) { /* --- the following bits of info are returned as 64-bit signed integers --- */ - case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(struct samples_info); break; + case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(samples_info); break; /* --- the following bits of info are returned as pointers to data or functions --- */ case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( samples ); break; diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c index 3ac4231e57b..9772245dee9 100644 --- a/src/mame/audio/dcs.c +++ b/src/mame/audio/dcs.c @@ -934,7 +934,7 @@ void dcs_init(running_machine *machine) dcs.data = cpu_get_address_space(dcs.cpu, ADDRESS_SPACE_DATA); dcs.rev = 1; dcs.channels = 1; - dcs.dmadac[0] = devtag_get_device(machine, SOUND, "dac1"); + dcs.dmadac[0] = devtag_get_device(machine, SOUND, "dac"); /* configure boot and sound ROMs */ dcs.bootrom = (UINT16 *)memory_region(machine, "dcs"); diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c index 4c6e8802285..5cf0920e774 100644 --- a/src/mame/drivers/dynax.c +++ b/src/mame/drivers/dynax.c @@ -2713,7 +2713,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( mjelct3 ) - PORT_START("DSW2") /* 7c21 (select = 00) */ + PORT_START("DSW0") /* 7c21 (select = 00) */ PORT_DIPNAME( 0x03, 0x03, "Difficulty?" ) PORT_DIPSETTING( 0x03, "0" ) // 20 PORT_DIPSETTING( 0x00, "1" ) // 32 @@ -2838,7 +2838,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( mjelctrn ) - PORT_START("DSW2") /* 7c21 (select = 00) */ + PORT_START("DSW0") /* 7c21 (select = 00) */ PORT_DIPNAME( 0x03, 0x03, "Difficulty?" ) PORT_DIPSETTING( 0x03, "0" ) // 20 PORT_DIPSETTING( 0x00, "1" ) // 32 @@ -2963,7 +2963,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( majxtal7 ) - PORT_START("DSW2") /* select = 00 */ + PORT_START("DSW0") /* select = 00 */ PORT_DIPNAME( 0x03, 0x03, "Difficulty?" ) PORT_DIPSETTING( 0x03, "0" ) // 20 PORT_DIPSETTING( 0x00, "1" ) // 32 @@ -3087,7 +3087,7 @@ static INPUT_PORTS_START( majxtal7 ) INPUT_PORTS_END static INPUT_PORTS_START( neruton ) - PORT_START("DSW2") /* 6a77 (select = 00) */ + PORT_START("DSW0") /* 6a77 (select = 00) */ PORT_DIPNAME( 0x07, 0x07, "Time Setting" ) PORT_DIPSETTING( 0x07, "08:30" ) PORT_DIPSETTING( 0x06, "09:00" ) diff --git a/src/mame/drivers/gaelco3d.c b/src/mame/drivers/gaelco3d.c index cbac0220171..a72a30fb62f 100644 --- a/src/mame/drivers/gaelco3d.c +++ b/src/mame/drivers/gaelco3d.c @@ -207,7 +207,7 @@ static MACHINE_RESET( common ) for (i = 0; i < SOUND_CHANNELS; i++) { char buffer[10]; - sprintf(buffer, "dac%d", i); + sprintf(buffer, "dac%d", i + 1); dmadac[i] = devtag_get_device(machine, SOUND, buffer); } diff --git a/src/mame/drivers/galdrvr.c b/src/mame/drivers/galdrvr.c index 686b5188d3d..3a89ec5a3c7 100644 --- a/src/mame/drivers/galdrvr.c +++ b/src/mame/drivers/galdrvr.c @@ -1319,6 +1319,9 @@ INPUT_PORTS_START( froggrmc ) PORT_DIPSETTING( 0x06, "A 1/1 B 1/1 C 1/1" ) PORT_DIPSETTING( 0x00, "A 1/1 B 1/6 C 1/1" ) PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED ) INPUT_PORTS_END @@ -1859,6 +1862,9 @@ INPUT_PORTS_START( sfx ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */ + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED ) INPUT_PORTS_END @@ -1901,6 +1907,9 @@ INPUT_PORTS_START( scobra ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED ) INPUT_PORTS_END @@ -1913,6 +1922,7 @@ INPUT_PORTS_START( scobras ) PORT_DIPSETTING( 0x02, "5" ) INPUT_PORTS_END + static INPUT_PORTS_START( spdcoin ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -1945,6 +1955,9 @@ static INPUT_PORTS_START( spdcoin ) PORT_DIPSETTING( 0x08, "3" ) PORT_DIPSETTING( 0x00, "5" ) PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED ) INPUT_PORTS_END /* cocktail mode is N/A */ @@ -2004,6 +2017,9 @@ static INPUT_PORTS_START( superbon ) PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED ) INPUT_PORTS_END @@ -2041,6 +2057,9 @@ INPUT_PORTS_START( losttomb ) PORT_DIPSETTING( 0x06, "A 1/4 B 4/1" ) PORT_DIPUNKNOWN( 0x08, 0x00 ) PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED ) INPUT_PORTS_END @@ -2083,6 +2102,9 @@ INPUT_PORTS_START( armorcar ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED ) INPUT_PORTS_END @@ -2125,6 +2147,9 @@ INPUT_PORTS_START( tazmania ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED ) INPUT_PORTS_END @@ -2168,6 +2193,9 @@ INPUT_PORTS_START( anteater ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED ) INPUT_PORTS_END @@ -2211,6 +2239,9 @@ static INPUT_PORTS_START( calipso ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN3") /* need for some PPI accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED ) INPUT_PORTS_END @@ -2282,6 +2313,7 @@ static INPUT_PORTS_START( moonwara ) INPUT_PORTS_END + /************************************* * * ROM definitions diff --git a/src/mame/drivers/go2000.c b/src/mame/drivers/go2000.c index bb0f35b7cd0..9eb304bbc5a 100644 --- a/src/mame/drivers/go2000.c +++ b/src/mame/drivers/go2000.c @@ -57,11 +57,6 @@ static ADDRESS_MAP_START( go2000_map, ADDRESS_SPACE_PROGRAM, 16 ) // AM_RANGE(0xe00020, 0xe00021) AM_WRITENOP ADDRESS_MAP_END -static WRITE8_HANDLER( go2000_dac_w ) -{ - dac_data_w( 0 , data & 0xff ); -} - static WRITE8_HANDLER( go2000_pcm_1_bankswitch_w ) { UINT8 *RAM = memory_region(space->machine, "sound"); @@ -78,7 +73,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( go2000_sound_io, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r) - AM_RANGE(0x00, 0x00) AM_WRITE(go2000_dac_w) + AM_RANGE(0x00, 0x00) AM_DEVWRITE(SOUND, "dac1", dac_w) AM_RANGE(0x03, 0x03) AM_WRITE(go2000_pcm_1_bankswitch_w) ADDRESS_MAP_END diff --git a/src/mame/drivers/lasso.c b/src/mame/drivers/lasso.c index 898ca0aaf5e..94cc4aade18 100644 --- a/src/mame/drivers/lasso.c +++ b/src/mame/drivers/lasso.c @@ -71,10 +71,10 @@ static WRITE8_HANDLER( sound_select_w ) UINT8 to_write = BITSWAP8(*lasso_chip_data, 0, 1, 2, 3, 4, 5, 6, 7); if (~data & 0x01) /* chip #0 */ - sn76496_w(devtag_get_device(space->machine, SOUND, "sn1"), 0, to_write); + sn76496_w(devtag_get_device(space->machine, SOUND, "sn76489.1"), 0, to_write); if (~data & 0x02) /* chip #1 */ - sn76496_w(devtag_get_device(space->machine, SOUND, "sn2"), 0, to_write); + sn76496_w(devtag_get_device(space->machine, SOUND, "sn76489.2"), 0, to_write); } diff --git a/src/mame/drivers/megasys1.c b/src/mame/drivers/megasys1.c index 5a6bcc2f9c8..0911251bf85 100644 --- a/src/mame/drivers/megasys1.c +++ b/src/mame/drivers/megasys1.c @@ -348,7 +348,7 @@ static ADDRESS_MAP_START( readmem_D, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x0e0000, 0x0e0001) AM_READ_PORT("DSW") AM_RANGE(0x0e8000, 0x0ebfff) AM_READ(SMH_RAM) AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("SYSTEM") - AM_RANGE(0x0f8000, 0x0f8001) AM_DEVREAD8(SOUND, "oki", okim6295_r, 0x00ff) + AM_RANGE(0x0f8000, 0x0f8001) AM_DEVREAD8(SOUND, "oki1", okim6295_r, 0x00ff) // { 0x100000, 0x100001 protection AM_RANGE(0x1f0000, 0x1fffff) AM_READ(SMH_RAM) ADDRESS_MAP_END @@ -361,7 +361,7 @@ static ADDRESS_MAP_START( writemem_D, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x0d4000, 0x0d7fff) AM_WRITE(megasys1_scrollram_2_w) AM_BASE(&megasys1_scrollram[2]) AM_RANGE(0x0d8000, 0x0d87ff) AM_MIRROR(0x3000) AM_WRITE(paletteram16_RRRRRGGGGGBBBBBx_word_w) AM_BASE(&paletteram16) AM_RANGE(0x0e8000, 0x0ebfff) AM_WRITE(megasys1_scrollram_0_w) AM_BASE(&megasys1_scrollram[0]) - AM_RANGE(0x0f8000, 0x0f8001) AM_DEVWRITE8(SOUND, "oki", okim6295_w, 0x00ff) + AM_RANGE(0x0f8000, 0x0f8001) AM_DEVWRITE8(SOUND, "oki1", okim6295_w, 0x00ff) // { 0x100000, 0x100001 protection AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE(SMH_RAM) AM_BASE(&megasys1_ram) ADDRESS_MAP_END @@ -1649,7 +1649,7 @@ static MACHINE_DRIVER_START( system_D ) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_SOUND_ADD("oki",OKIM6295, SYS_D_CPU_CLOCK/4) /* 2MHz (8MHz / 4) */ + MDRV_SOUND_ADD("oki1",OKIM6295, SYS_D_CPU_CLOCK/4) /* 2MHz (8MHz / 4) */ MDRV_SOUND_CONFIG(okim6295_interface_pin7high) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_DRIVER_END diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index c9b1f4f30b7..340129a31fe 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -307,19 +307,23 @@ READ8_HANDLER( md_sms_ioport_dd_r ) static void megatech_set_genz80_as_sms_standard_ports(running_machine *machine) { /* INIT THE PORTS *********************************************************************************************/ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x7e, 0x7e, 0, 0, md_sms_vdp_vcounter_r, sms_sn76496_w); - memory_install_write8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x7f, 0x7f, 0, 0, sms_sn76496_w); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xbe, 0xbe, 0, 0, md_sms_vdp_data_r, md_sms_vdp_data_w); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xbf, 0xbf, 0, 0, md_sms_vdp_ctrl_r, md_sms_vdp_ctrl_w); + const address_space *io = cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO); + const device_config *sn = devtag_get_device(machine, SOUND, "sn"); + + memory_install_readwrite8_handler(io, 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x10, 0x10, 0, 0, megatech_sms_ioport_dd_r); // super tetris + memory_install_read8_handler (io, 0x7e, 0x7e, 0, 0, md_sms_vdp_vcounter_r); + memory_install_write8_device_handler(io, sn, 0x7e, 0x7f, 0, 0, sn76496_w); + memory_install_readwrite8_handler(io, 0xbe, 0xbe, 0, 0, md_sms_vdp_data_r, md_sms_vdp_data_w); + memory_install_readwrite8_handler(io, 0xbf, 0xbf, 0, 0, md_sms_vdp_ctrl_r, md_sms_vdp_ctrl_w); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xdc, 0xdc, 0, 0, megatech_sms_ioport_dc_r); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xdd, 0xdd, 0, 0, megatech_sms_ioport_dd_r); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xde, 0xde, 0, 0, megatech_sms_ioport_dd_r); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xdf, 0xdf, 0, 0, megatech_sms_ioport_dd_r); // adams family + memory_install_read8_handler (io, 0x10, 0x10, 0, 0, megatech_sms_ioport_dd_r); // super tetris + + memory_install_read8_handler (io, 0xdc, 0xdc, 0, 0, megatech_sms_ioport_dc_r); + memory_install_read8_handler (io, 0xdd, 0xdd, 0, 0, megatech_sms_ioport_dd_r); + memory_install_read8_handler (io, 0xde, 0xde, 0, 0, megatech_sms_ioport_dd_r); + memory_install_read8_handler (io, 0xdf, 0xdf, 0, 0, megatech_sms_ioport_dd_r); // adams family } static void megatech_set_genz80_as_sms_standard_map(running_machine *machine) diff --git a/src/mame/drivers/meritm.c b/src/mame/drivers/meritm.c index aabb0cfcab2..2d1ee6f92f8 100644 --- a/src/mame/drivers/meritm.c +++ b/src/mame/drivers/meritm.c @@ -618,6 +618,9 @@ static INPUT_PORTS_START(meritm_crt260) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME( "Calibration" ) PORT_CODE(KEYCODE_C) + + PORT_START("DSW") /* need for AY-8910 accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED) INPUT_PORTS_END static INPUT_PORTS_START(meritm_crt250) @@ -636,12 +639,15 @@ static INPUT_PORTS_START(meritm_crt250) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) + + PORT_START("DSW") /* need for AY-8910 accesses */ + PORT_BIT( 0xff, 0x00, IPT_UNUSED) INPUT_PORTS_END static INPUT_PORTS_START(pitbossm) PORT_INCLUDE(meritm_crt250) - PORT_START("DSW") + PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x01, DEF_STR( On ) ) diff --git a/src/mame/drivers/mrflea.c b/src/mame/drivers/mrflea.c index a77fa59112d..705732eba21 100644 --- a/src/mame/drivers/mrflea.c +++ b/src/mame/drivers/mrflea.c @@ -224,8 +224,8 @@ static const ay8910_interface mrflea_ay8910_interface_1 = { AY8910_LEGACY_OUTPUT, AY8910_DEFAULT_LOADS, - DEVCB_INPUT_PORT("DSW1"), - DEVCB_INPUT_PORT("DSW0") + DEVCB_INPUT_PORT("DSW2"), + DEVCB_INPUT_PORT("DSW1") }; static MACHINE_DRIVER_START( mrflea ) diff --git a/src/mame/drivers/ninjakd2.c b/src/mame/drivers/ninjakd2.c index edb02b7435f..2dda4063278 100644 --- a/src/mame/drivers/ninjakd2.c +++ b/src/mame/drivers/ninjakd2.c @@ -204,8 +204,8 @@ static WRITE8_HANDLER( ninjakd2_soundreset_w ) static SAMPLES_START( ninjakd2_init_samples ) { running_machine *machine = device->machine; - const UINT8* const rom = memory_region(machine, "samples"); - const int length = memory_region_length(machine, "samples"); + const UINT8* const rom = memory_region(machine, "pcm"); + const int length = memory_region_length(machine, "pcm"); INT16* const sampledata = auto_malloc(length * sizeof(sampledata[0])); int i; @@ -219,13 +219,13 @@ static SAMPLES_START( ninjakd2_init_samples ) static WRITE8_HANDLER( ninjakd2_pcm_play_w ) { - const device_config *samples = devtag_get_device(space->machine, SOUND, "samples"); - const UINT8* const rom = memory_region(space->machine, "samples"); + const device_config *samples = devtag_get_device(space->machine, SOUND, "pcm"); + const UINT8* const rom = memory_region(space->machine, "pcm"); // only Ninja Kid II uses this if (rom) { - const int length = memory_region_length(space->machine, "samples"); + const int length = memory_region_length(space->machine, "pcm"); const int start = data << 8; @@ -1055,7 +1055,7 @@ ROM_START( ninjakd2 ) ROM_LOAD( "nk2_11.rom", 0x00000, 0x10000, CRC(41a714b3) SHA1(b05f48d71a9837914c12c13e0b479c8a6dc8c25e) ) ROM_LOAD( "nk2_10.rom", 0x10000, 0x10000, CRC(c913c4ab) SHA1(f822c5621b3e32c1a284f6367bdcace81c1c74b3) ) - ROM_REGION( 0x10000, "samples", 0 ) + ROM_REGION( 0x10000, "pcm", 0 ) ROM_LOAD( "nk2_09.rom", 0x0000, 0x10000, CRC(c1d2d170) SHA1(0f325815086fde90fd85360d3660042b0b68ba96) ) // unsigned 8-bit pcm samples ROM_END @@ -1082,7 +1082,7 @@ ROM_START( ninjak2a ) ROM_LOAD( "nk2_11.rom", 0x00000, 0x10000, CRC(41a714b3) SHA1(b05f48d71a9837914c12c13e0b479c8a6dc8c25e) ) ROM_LOAD( "nk2_10.rom", 0x10000, 0x10000, CRC(c913c4ab) SHA1(f822c5621b3e32c1a284f6367bdcace81c1c74b3) ) - ROM_REGION( 0x10000, "samples", 0 ) + ROM_REGION( 0x10000, "pcm", 0 ) ROM_LOAD( "nk2_09.rom", 0x0000, 0x10000, CRC(c1d2d170) SHA1(0f325815086fde90fd85360d3660042b0b68ba96) ) // unsigned 8-bit pcm samples ROM_END @@ -1109,7 +1109,7 @@ ROM_START( ninjak2b ) ROM_LOAD( "nk2_11.rom", 0x00000, 0x10000, CRC(41a714b3) SHA1(b05f48d71a9837914c12c13e0b479c8a6dc8c25e) ) // 11.2m ROM_LOAD( "nk2_10.rom", 0x10000, 0x10000, CRC(c913c4ab) SHA1(f822c5621b3e32c1a284f6367bdcace81c1c74b3) ) // 10.2p - ROM_REGION( 0x10000, "samples", 0 ) + ROM_REGION( 0x10000, "pcm", 0 ) ROM_LOAD( "nk2_09.rom", 0x0000, 0x10000, CRC(c1d2d170) SHA1(0f325815086fde90fd85360d3660042b0b68ba96) ) // 9.6d unsigned 8-bit pcm samples ROM_END @@ -1138,7 +1138,7 @@ ROM_START( rdaction ) ROM_LOAD( "nk2_11.rom", 0x00000, 0x10000, CRC(41a714b3) SHA1(b05f48d71a9837914c12c13e0b479c8a6dc8c25e) ) // 11.2n ROM_LOAD( "nk2_10.rom", 0x10000, 0x10000, CRC(c913c4ab) SHA1(f822c5621b3e32c1a284f6367bdcace81c1c74b3) ) // 10.2r - ROM_REGION( 0x10000, "samples", 0 ) + ROM_REGION( 0x10000, "pcm", 0 ) ROM_LOAD( "nk2_09.rom", 0x0000, 0x10000, CRC(c1d2d170) SHA1(0f325815086fde90fd85360d3660042b0b68ba96) ) // 9.6c unsigned 8-bit pcm samples ROM_END diff --git a/src/mame/drivers/nmk16.c b/src/mame/drivers/nmk16.c index d7d462a14b8..238d376564c 100644 --- a/src/mame/drivers/nmk16.c +++ b/src/mame/drivers/nmk16.c @@ -1001,7 +1001,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ssmissin_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM) - AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki", okim6295_r) + AM_RANGE(0x9800, 0x9800) AM_DEVREAD(SOUND, "oki1", okim6295_r) AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) ADDRESS_MAP_END @@ -1009,7 +1009,7 @@ static ADDRESS_MAP_START( ssmissin_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) AM_RANGE(0x8000, 0x87ff) AM_WRITE(SMH_RAM) AM_RANGE(0x9000, 0x9000) AM_WRITE(ssmissin_soundbank_w) - AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki", okim6295_w) + AM_RANGE(0x9800, 0x9800) AM_DEVWRITE(SOUND, "oki1", okim6295_w) ADDRESS_MAP_END @@ -4093,7 +4093,7 @@ static MACHINE_DRIVER_START( ssmissin ) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_SOUND_ADD("oki", OKIM6295, 8000000/8) /* 1 Mhz, pin 7 high */ + MDRV_SOUND_ADD("oki1", OKIM6295, 8000000/8) /* 1 Mhz, pin 7 high */ MDRV_SOUND_CONFIG(okim6295_interface_pin7high) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_DRIVER_END @@ -4802,7 +4802,7 @@ static ADDRESS_MAP_START( afega_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xf000, 0xf7ff) AM_RAM // RAM AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r) // From Main CPU AM_RANGE(0xf808, 0xf809) AM_DEVREADWRITE(SOUND, "ym", ym2151_r, ym2151_w) // YM2151 - AM_RANGE(0xf80a, 0xf80a) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w) // M6295 + AM_RANGE(0xf80a, 0xf80a) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w) // M6295 ADDRESS_MAP_END static ADDRESS_MAP_START( firehawk_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 ) @@ -4829,8 +4829,8 @@ static WRITE8_DEVICE_HANDLER( twinactn_oki_bank_w ) static ADDRESS_MAP_START( twinactn_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "oki", twinactn_oki_bank_w) - AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki", okim6295_r, okim6295_w) + AM_RANGE(0x9000, 0x9000) AM_DEVWRITE(SOUND, "oki1", twinactn_oki_bank_w) + AM_RANGE(0x9800, 0x9800) AM_DEVREADWRITE(SOUND, "oki1", okim6295_r, okim6295_w) AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r) // From Main CPU ADDRESS_MAP_END @@ -4959,7 +4959,7 @@ static MACHINE_DRIVER_START( stagger1 ) MDRV_SOUND_ROUTE(0, "left", 0.30) MDRV_SOUND_ROUTE(1, "right", 0.30) - MDRV_SOUND_ADD("oki", OKIM6295, XTAL_4MHz/4) /* verified on pcb */ + MDRV_SOUND_ADD("oki1", OKIM6295, XTAL_4MHz/4) /* verified on pcb */ MDRV_SOUND_CONFIG(okim6295_interface_pin7high) /* verified on pcb */ MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.70) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.70) @@ -5069,7 +5069,7 @@ static MACHINE_DRIVER_START( twinactn ) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_SOUND_ADD("oki", OKIM6295, 1000000) + MDRV_SOUND_ADD("oki1", OKIM6295, 1000000) MDRV_SOUND_CONFIG(okim6295_interface_pin7high) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_DRIVER_END @@ -5387,7 +5387,7 @@ ROM_START( mustangb ) ROM_LOAD16_BYTE( "90058-8", 0x00000, 0x80000, CRC(560bff04) SHA1(b005642adc81d878971ecbdead8ef5e604c90ae2) ) ROM_LOAD16_BYTE( "90058-9", 0x00001, 0x80000, CRC(b9d72a03) SHA1(43ee9def1b6c491c6832562d66c1af54d81d9b3c) ) - ROM_REGION( 0x010000, "oki", 0 ) /* OKIM6295 samples */ + ROM_REGION( 0x010000, "oki1", 0 ) /* OKIM6295 samples */ ROM_LOAD( "mustang.17", 0x00000, 0x10000, CRC(f6f6c4bf) SHA1(ea4cf74d968e254ae47c16c2f4c2f4bc1a528808) ) ROM_END @@ -5639,7 +5639,7 @@ ROM_START( tdragonb ) ROM_LOAD16_BYTE( "td_10.bin", 0x000000, 0x080000, CRC(bfd0ec5d) SHA1(7983661f74e8695f56e45c6e5c278d7d86431052) ) /* Sprites */ ROM_LOAD16_BYTE( "td_09.bin", 0x000001, 0x080000, CRC(b6e074eb) SHA1(bdde068f03415391b5edaa42f1389df0f7eef899) ) /* Sprites */ - ROM_REGION( 0x010000, "oki", 0 ) /* OKIM6295 samples */ + ROM_REGION( 0x010000, "oki1", 0 ) /* OKIM6295 samples */ ROM_LOAD( "td_01.bin", 0x00000, 0x10000, CRC(f6f6c4bf) SHA1(ea4cf74d968e254ae47c16c2f4c2f4bc1a528808) ) ROM_END diff --git a/src/mame/drivers/nova2001.c b/src/mame/drivers/nova2001.c index 8f2d4299dfb..5376b19f36f 100644 --- a/src/mame/drivers/nova2001.c +++ b/src/mame/drivers/nova2001.c @@ -529,7 +529,7 @@ static INPUT_PORTS_START( raiders5 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL - PORT_START("DSW1") + PORT_START("IN2") PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) @@ -553,7 +553,7 @@ static INPUT_PORTS_START( raiders5 ) PORT_DIPSETTING( 0x80, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) - PORT_START("DSW2") + PORT_START("DSW1") PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) diff --git a/src/mame/drivers/policetr.c b/src/mame/drivers/policetr.c index f49b36816d1..eae6b36894f 100644 --- a/src/mame/drivers/policetr.c +++ b/src/mame/drivers/policetr.c @@ -163,7 +163,7 @@ static WRITE32_HANDLER( control_w ) /* toggling BSMT off then on causes a reset */ if (!(old & 0x80000000) && (control_data & 0x80000000)) { - const device_config *device = devtag_get_device(space->machine, SOUND, "bmst"); + const device_config *device = devtag_get_device(space->machine, SOUND, "bsmt"); bsmt2000_data_w(device, bsmt_data_bank, 0, 0xffff); device_reset(device); } diff --git a/src/mame/drivers/rungun.c b/src/mame/drivers/rungun.c index 04a80181da5..d5947dbd344 100644 --- a/src/mame/drivers/rungun.c +++ b/src/mame/drivers/rungun.c @@ -641,7 +641,7 @@ static DRIVER_INIT( rng ) static MACHINE_RESET( rng ) { - k054539_init_flags(devtag_get_device(machine, SOUND, "konami"), K054539_REVERSE_STEREO); + k054539_init_flags(devtag_get_device(machine, SOUND, "konami1"), K054539_REVERSE_STEREO); memset(rng_sysreg, 0, 0x20); diff --git a/src/mame/drivers/segae.c b/src/mame/drivers/segae.c index ec8123c2f02..69927c808f8 100644 --- a/src/mame/drivers/segae.c +++ b/src/mame/drivers/segae.c @@ -982,11 +982,6 @@ WRITE8_HANDLER( sms_vdp_ctrl_w ) vdp_ctrl_w(space, data, vdp1); } -WRITE8_HANDLER( sms_sn76496_w ) -{ - sn76496_w(devtag_get_device(space->machine, SOUND, "sn1"), 0, data & 0xff); -} - static void draw_tile_line(int drawxpos, int tileline, UINT16 tiledata, UINT8* linebuf, struct sms_vdp* chip) { int xx; @@ -2157,32 +2152,31 @@ static WRITE8_HANDLER( systeme_bank_w ) } -static WRITE8_HANDLER( sms_sn76496_2_w ) -{ - sn76496_w(devtag_get_device(space->machine, SOUND, "sn2"), 0, data & 0xff); -} - static void init_ports_systeme(running_machine *machine) { /* INIT THE PORTS *********************************************************************************************/ - memory_install_write8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7b, 0x7b, 0, 0, sms_sn76496_2_w); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7e, 0x7e, 0, 0, sms_vcounter_r, sms_sn76496_w); - memory_install_write8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7f, 0x7f, 0, 0, sms_sn76496_w); + const address_space *io = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO); + const device_config *sn1 = devtag_get_device(machine, SOUND, "sn1"); + const device_config *sn2 = devtag_get_device(machine, SOUND, "sn2"); + + memory_install_write8_device_handler(io, sn2, 0x7b, 0x7b, 0, 0, sn76496_w); + memory_install_write8_device_handler(io, sn1, 0x7e, 0x7f, 0, 0, sn76496_w); + memory_install_read8_handler (io, 0x7e, 0x7e, 0, 0, sms_vcounter_r); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xba, 0xba, 0, 0, sms_vdp_data_r, sms_vdp_data_w); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xbb, 0xbb, 0, 0, sms_vdp_ctrl_r, sms_vdp_ctrl_w); + memory_install_readwrite8_handler(io, 0xba, 0xba, 0, 0, sms_vdp_data_r, sms_vdp_data_w); + memory_install_readwrite8_handler(io, 0xbb, 0xbb, 0, 0, sms_vdp_ctrl_r, sms_vdp_ctrl_w); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xbe, 0xbe, 0, 0, sms_vdp_2_data_r, sms_vdp_2_data_w); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xbf, 0xbf, 0, 0, sms_vdp_2_ctrl_r, sms_vdp_2_ctrl_w); + memory_install_readwrite8_handler(io, 0xbe, 0xbe, 0, 0, sms_vdp_2_data_r, sms_vdp_2_data_w); + memory_install_readwrite8_handler(io, 0xbf, 0xbf, 0, 0, sms_vdp_2_ctrl_r, sms_vdp_2_ctrl_w); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xe0, 0xe0, 0, 0, input_port_read_handler8(machine->portconfig, "e0")); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xe1, 0xe1, 0, 0, input_port_read_handler8(machine->portconfig, "e1")); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xe2, 0xe2, 0, 0, input_port_read_handler8(machine->portconfig, "e2")); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf2, 0xf2, 0, 0, input_port_read_handler8(machine->portconfig, "f2")); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf3, 0xf3, 0, 0, input_port_read_handler8(machine->portconfig, "f3")); + memory_install_read8_handler (io, 0xe0, 0xe0, 0, 0, input_port_read_handler8(machine->portconfig, "e0")); + memory_install_read8_handler (io, 0xe1, 0xe1, 0, 0, input_port_read_handler8(machine->portconfig, "e1")); + memory_install_read8_handler (io, 0xe2, 0xe2, 0, 0, input_port_read_handler8(machine->portconfig, "e2")); + memory_install_read8_handler (io, 0xf2, 0xf2, 0, 0, input_port_read_handler8(machine->portconfig, "f2")); + memory_install_read8_handler (io, 0xf3, 0xf3, 0, 0, input_port_read_handler8(machine->portconfig, "f3")); - memory_install_write8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf7, 0xf7, 0, 0, systeme_bank_w ); + memory_install_write8_handler (io, 0xf7, 0xf7, 0, 0, systeme_bank_w ); } diff --git a/src/mame/drivers/williams.c b/src/mame/drivers/williams.c index f9e4d4d9aca..3025c3837e8 100644 --- a/src/mame/drivers/williams.c +++ b/src/mame/drivers/williams.c @@ -1682,9 +1682,6 @@ static MACHINE_DRIVER_START( joust2 ) MDRV_MACHINE_START(joust2) MDRV_MACHINE_RESET(joust2) - /* sound hardware */ - MDRV_SOUND_REMOVE("wmsdac") - /* pia */ MDRV_PIA6821_MODIFY("pia_1", joust2_pia_1_intf) MDRV_PIA6821_ADD("pia_3", joust2_pia_3_intf) diff --git a/src/mame/machine/nmk004.c b/src/mame/machine/nmk004.c index 6c47dba9294..4121f8f3bc4 100644 --- a/src/mame/machine/nmk004.c +++ b/src/mame/machine/nmk004.c @@ -1019,6 +1019,11 @@ static TIMER_CALLBACK( real_nmk004_init ) int i; memset(&NMK004_state, 0, sizeof(NMK004_state)); + + NMK004_state.machine = machine; + NMK004_state.ymdevice = devtag_get_device(machine, SOUND, "ym"); + NMK004_state.oki1device = devtag_get_device(machine, SOUND, "oki1"); + NMK004_state.oki2device = devtag_get_device(machine, SOUND, "oki2"); NMK004_state.rom = memory_region(machine, "audio"); @@ -1042,11 +1047,6 @@ void NMK004_init(running_machine *machine) { /* we have to do this via a timer because we get called before the sound reset */ timer_call_after_resynch(machine, NULL, 0, real_nmk004_init); - - NMK004_state.machine = machine; - NMK004_state.ymdevice = devtag_get_device(machine, SOUND, "ym"); - NMK004_state.oki1device = devtag_get_device(machine, SOUND, "oki1"); - NMK004_state.oki2device = devtag_get_device(machine, SOUND, "oki2"); }