make the NES APU device get added with the N2A03 rather than needing to be added in every driver.

(I believe this to be correct, it's internal to the CPU?)

note, DERIVED_CLOCK doesn't work in cases where MCFG_CPU_MODIFY is used to modify the clock, so I've had to use MCFG_CPU_REPLACE in those cases instead.
note2, sound routing seems a bit messy, but this seems a general MAME thing, we still have an issue where if you add too many devices with their own speaker / sound additions things you get sound overflows, in this case all drivers except NES were set to a 0.50 sound level output, NES was set to 0.90, I see no clean way to do this with the sound chip inside the CPU?
This commit is contained in:
David Haywood 2015-11-02 23:36:21 +00:00
parent 9478f1eb73
commit 43881b4c24
16 changed files with 119 additions and 275 deletions

View File

@ -466,7 +466,7 @@ WRITE8_MEMBER(nes_exrom_device::write_l)
if ((offset >= 0x1000) && (offset <= 0x1015))
{
// SOUND
nesapu_device *m_sound = machine().device<nesapu_device>("nessound");
nesapu_device *m_sound = machine().device<nesapu_device>("maincpu::nessound");
m_sound->write(space, offset & 0x1f, data);
return;
}

View File

@ -13,8 +13,46 @@
const device_type N2A03 = &device_creator<n2a03_device>;
READ8_MEMBER(n2a03_device::psg1_4014_r)
{
return m_apu->read(space, 0x14);
}
READ8_MEMBER(n2a03_device::psg1_4015_r)
{
return m_apu->read(space, 0x15);
}
WRITE8_MEMBER(n2a03_device::psg1_4015_w)
{
m_apu->write(space, 0x15, data);
}
WRITE8_MEMBER(n2a03_device::psg1_4017_w)
{
m_apu->write(space, 0x17, data);
}
// on various drivers output port 0x4014 is used for external hardware (not used by APU?)
// input/output port 0x4016 ^ (not used by APU?)
// input port 0x4017 ^ ( APU_IRQCTRL )
// is there a fall through where every write is seen by other hw, or do these addresses really not touch the APU?? APU_IRQCTRL can definitely be written by can it be read back?
static ADDRESS_MAP_START( n2a03_map, AS_PROGRAM, 8, n2a03_device )
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu", nesapu_device, read, write)
AM_RANGE(0x4014, 0x4014) AM_READ(psg1_4014_r) // AM_WRITE(sprite_dma_0_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg1_4015_r, psg1_4015_w) /* PSG status / first control register */
//AM_RANGE(0x4016, 0x4016) AM_READWRITE(vsnes_in0_r, vsnes_in0_w)
AM_RANGE(0x4017, 0x4017) /*AM_READ(vsnes_in1_r)*/ AM_WRITE(psg1_4017_w)
ADDRESS_MAP_END
n2a03_device::n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
m6502_device(mconfig, N2A03, "N2A03", tag, owner, clock, "n2a03", __FILE__)
m6502_device(mconfig, N2A03, "N2A03", tag, owner, clock, "n2a03", __FILE__),
m_apu(*this, "nesapu"),
m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0, ADDRESS_MAP_NAME(n2a03_map))
{
}
@ -25,11 +63,16 @@ offs_t n2a03_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *op
void n2a03_device::device_start()
{
if(!m_apu->started())
throw device_missing_dependencies();
if(direct_disabled)
mintf = new mi_2a03_nd;
else
mintf = new mi_2a03_normal;
m_apu->set_tag_memory(tag());
init();
}
@ -73,4 +116,27 @@ void n2a03_device::mi_2a03_nd::write(UINT16 adr, UINT8 val)
program->write_byte(adr, val);
}
const address_space_config *n2a03_device::memory_space_config(address_spacenum spacenum) const
{
switch(spacenum)
{
case AS_PROGRAM: return &m_program_config;
case AS_DECRYPTED_OPCODES: return has_configured_map(AS_DECRYPTED_OPCODES) ? &sprogram_config : NULL;
default: return NULL;
}
}
static MACHINE_CONFIG_FRAGMENT( n2a03_device )
MCFG_SOUND_ADD("nesapu", NES_APU, DERIVED_CLOCK(1,1) )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":mono", 0.50)
MACHINE_CONFIG_END
machine_config_constructor n2a03_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( n2a03_device );
}
#include "cpu/m6502/n2a03.inc"

View File

@ -12,17 +12,25 @@
#define __N2A03_H__
#include "m6502.h"
#include "sound/nes_apu.h"
class n2a03_device : public m6502_device {
public:
n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
required_device<nesapu_device> m_apu;
static const disasm_entry disasm_entries[0x100];
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
virtual void do_exec_full();
virtual void do_exec_partial();
READ8_MEMBER(psg1_4014_r);
READ8_MEMBER(psg1_4015_r);
WRITE8_MEMBER(psg1_4015_w);
WRITE8_MEMBER(psg1_4017_w);
protected:
class mi_2a03_normal : public memory_interface {
public:
@ -54,6 +62,13 @@ protected:
O(sbc_nd_aba); O(sbc_nd_abx); O(sbc_nd_aby); O(sbc_nd_idx); O(sbc_nd_idy); O(sbc_nd_imm); O(sbc_nd_zpg); O(sbc_nd_zpx);
#undef O
virtual machine_config_constructor device_mconfig_additions() const;
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
private:
address_space_config m_program_config;
};
#define N2A03_DEFAULTCLOCK (21477272.724 / 12)

View File

@ -134,6 +134,13 @@ nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, dev
}
}
void nesapu_device::set_tag_memory(const char *tag)
{
/* Initialize individual chips */
if (tag)
(m_APU.dpcm).memory = &machine().device(tag)->memory().space(AS_PROGRAM);
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@ -156,8 +163,7 @@ void nesapu_device::device_start()
/* Adjust buffer size if 16 bits */
m_buffer_size+=m_samps_per_sync;
/* Initialize individual chips */
(m_APU.dpcm).memory = &machine().device(m_cpu_tag)->memory().space(AS_PROGRAM);
set_tag_memory(m_cpu_tag);
m_stream = machine().sound().stream_alloc(*this, 0, 1, rate);

View File

@ -51,6 +51,7 @@ public:
~nesapu_device() {}
static void set_cpu_tag(device_t &device, const char *tag) { downcast<nesapu_device &>(device).m_cpu_tag = tag; }
void set_tag_memory(const char *tag);
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );

View File

@ -2,7 +2,6 @@
// copyright-holders:Couriersud
#include "emu.h"
#include "cpu/mcs48/mcs48.h"
#include "sound/nes_apu.h"
#include "sound/discrete.h"
#include "sound/tms5110.h"
@ -1317,16 +1316,12 @@ static ADDRESS_MAP_START( dkong3_sound1_map, AS_PROGRAM, 8, dkong_state )
AM_RANGE(0x0000, 0x01ff) AM_RAM
AM_RANGE(0x4016, 0x4016) AM_LATCH8_READ("latch1") /* overwrite default */
AM_RANGE(0x4017, 0x4017) AM_LATCH8_READ("latch2")
AM_RANGE(0x4000, 0x4017) AM_DEVREAD("nesapu1", nesapu_device, read)
AM_RANGE(0x4000, 0x4017) AM_DEVWRITE("nesapu1", nesapu_device, write)
AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START( dkong3_sound2_map, AS_PROGRAM, 8, dkong_state )
AM_RANGE(0x0000, 0x01ff) AM_RAM
AM_RANGE(0x4016, 0x4016) AM_LATCH8_READ("latch3") /* overwrite default */
AM_RANGE(0x4000, 0x4017) AM_DEVREAD("nesapu2", nesapu_device, read)
AM_RANGE(0x4000, 0x4017) AM_DEVWRITE("nesapu2", nesapu_device, write)
AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END
@ -1454,12 +1449,4 @@ MACHINE_CONFIG_FRAGMENT( dkong3_audio )
MCFG_LATCH8_ADD( "latch3")
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("nesapu1", NES_APU, N2A03_DEFAULTCLOCK)
MCFG_NES_APU_CPU("n2a03a")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_SOUND_ADD("nesapu2", NES_APU, N2A03_DEFAULTCLOCK)
MCFG_NES_APU_CPU("n2a03b")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_CONFIG_END

View File

@ -58,8 +58,6 @@ Notes:
#include "emu.h"
#include "cpu/m6502/n2a03.h"
#include "sound/dac.h"
#include "sound/nes_apu.h"
#include "video/ppu2c0x.h"
@ -69,11 +67,9 @@ public:
cham24_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_nesapu(*this, "nesapu"),
m_ppu(*this, "ppu") { }
required_device<cpu_device> m_maincpu;
required_device<nesapu_device> m_nesapu;
required_device<ppu2c0x_device> m_ppu;
UINT8* m_nt_ram;
@ -89,9 +85,6 @@ public:
DECLARE_WRITE8_MEMBER(cham24_IN0_w);
DECLARE_READ8_MEMBER(cham24_IN1_r);
DECLARE_WRITE8_MEMBER(cham24_mapper_w);
DECLARE_READ8_MEMBER(psg_4015_r);
DECLARE_WRITE8_MEMBER(psg_4015_w);
DECLARE_WRITE8_MEMBER(psg_4017_w);
DECLARE_DRIVER_INIT(cham24);
virtual void machine_start();
virtual void machine_reset();
@ -155,22 +148,6 @@ WRITE8_MEMBER(cham24_state::sprite_dma_w)
m_ppu->spriteram_dma(space, source);
}
READ8_MEMBER(cham24_state::psg_4015_r)
{
return m_nesapu->read(space,0x15);
}
WRITE8_MEMBER(cham24_state::psg_4015_w)
{
m_nesapu->write(space,0x15, data);
}
WRITE8_MEMBER(cham24_state::psg_4017_w)
{
m_nesapu->write(space,0x17, data);
}
READ8_MEMBER(cham24_state::cham24_IN0_r)
{
return ((m_in_0 >> m_in_0_shift++) & 0x01) | 0x40;
@ -244,11 +221,9 @@ WRITE8_MEMBER(cham24_state::cham24_mapper_w)
static ADDRESS_MAP_START( cham24_map, AS_PROGRAM, 8, cham24_state )
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu", nesapu_device, read, write) /* PSG primary registers */
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(cham24_IN0_r, cham24_IN0_w) /* IN0 - input port 1 */
AM_RANGE(0x4017, 0x4017) AM_READ(cham24_IN1_r) AM_WRITE(psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4017, 0x4017) AM_READ(cham24_IN1_r) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x8000, 0xffff) AM_ROM AM_WRITE(cham24_mapper_w)
ADDRESS_MAP_END
@ -356,13 +331,6 @@ static MACHINE_CONFIG_START( cham24, cham24_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("nesapu", NES_APU, N2A03_DEFAULTCLOCK)
MCFG_NES_APU_CPU("maincpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DAC_ADD("dac")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_CONFIG_END
ROM_START( cham24 )

View File

@ -62,7 +62,6 @@ Notes/ToDo:
#include "emu.h"
#include "video/ppu2c0x.h"
#include "cpu/m6502/n2a03.h"
#include "sound/nes_apu.h"
#include "sound/dac.h"
#include "debugger.h"
@ -73,12 +72,10 @@ public:
famibox_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_nesapu(*this, "nesapu"),
m_ppu(*this, "ppu") { }
required_device<cpu_device> m_maincpu;
required_device<nesapu_device> m_nesapu;
required_device<ppu2c0x_device> m_ppu;
UINT8* m_nt_ram;
@ -111,9 +108,6 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(famibox_coin_r);
DECLARE_INPUT_CHANGED_MEMBER(famibox_keyswitch_changed);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
DECLARE_READ8_MEMBER(psg_4015_r);
DECLARE_WRITE8_MEMBER(psg_4015_w);
DECLARE_WRITE8_MEMBER(psg_4017_w);
virtual void machine_start();
virtual void machine_reset();
virtual void video_start();
@ -192,20 +186,7 @@ WRITE8_MEMBER(famibox_state::sprite_dma_w)
m_ppu->spriteram_dma(space, source);
}
READ8_MEMBER(famibox_state::psg_4015_r)
{
return m_nesapu->read(space, 0x15);
}
WRITE8_MEMBER(famibox_state::psg_4015_w)
{
m_nesapu->write(space, 0x15, data);
}
WRITE8_MEMBER(famibox_state::psg_4017_w)
{
m_nesapu->write(space, 0x17, data);
}
/******************************************************
@ -396,11 +377,9 @@ WRITE8_MEMBER(famibox_state::famibox_system_w)
static ADDRESS_MAP_START( famibox_map, AS_PROGRAM, 8, famibox_state )
AM_RANGE(0x0000, 0x1fff) AM_RAM
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu", nesapu_device, read, write) /* PSG primary registers */
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(famibox_IN0_r, famibox_IN0_w) /* IN0 - input port 1 */
AM_RANGE(0x4017, 0x4017) AM_READ(famibox_IN1_r) AM_WRITE(psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4017, 0x4017) AM_READ(famibox_IN1_r) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x5000, 0x5fff) AM_READWRITE(famibox_system_r, famibox_system_w)
AM_RANGE(0x6000, 0x7fff) AM_RAM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("cpubank1")
@ -588,13 +567,6 @@ static MACHINE_CONFIG_START( famibox, famibox_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("nesapu", NES_APU, N2A03_DEFAULTCLOCK)
MCFG_NES_APU_CPU("maincpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DAC_ADD("dac")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_CONFIG_END

View File

@ -109,7 +109,6 @@ Eproms are 27512,27010,274001
#include "emu.h"
#include "cpu/m6502/n2a03.h"
#include "sound/dac.h"
#include "sound/nes_apu.h"
#include "video/ppu2c0x.h"
@ -119,11 +118,9 @@ public:
multigam_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_nesapu(*this, "nesapu"),
m_ppu(*this, "ppu") { }
required_device<cpu_device> m_maincpu;
required_device<nesapu_device> m_nesapu;
required_device<ppu2c0x_device> m_ppu;
UINT8* m_nt_ram;
@ -179,9 +176,6 @@ public:
DECLARE_WRITE8_MEMBER(supergm3_prg_bank_w);
DECLARE_WRITE8_MEMBER(supergm3_chr_bank_w);
void set_mirroring(int mirroring);
DECLARE_READ8_MEMBER(psg_4015_r);
DECLARE_WRITE8_MEMBER(psg_4015_w);
DECLARE_WRITE8_MEMBER(psg_4017_w);
DECLARE_DRIVER_INIT(multigmt);
DECLARE_DRIVER_INIT(multigam);
DECLARE_DRIVER_INIT(multigm3);
@ -296,20 +290,6 @@ WRITE8_MEMBER(multigam_state::sprite_dma_w)
m_ppu->spriteram_dma(space, source);
}
READ8_MEMBER(multigam_state::psg_4015_r)
{
return m_nesapu->read(space, 0x15);
}
WRITE8_MEMBER(multigam_state::psg_4015_w)
{
m_nesapu->write(space, 0x15, data);
}
WRITE8_MEMBER(multigam_state::psg_4017_w)
{
m_nesapu->write(space, 0x17, data);
}
/******************************************************
@ -411,11 +391,9 @@ static ADDRESS_MAP_START( multigam_map, AS_PROGRAM, 8, multigam_state )
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu", nesapu_device, read, write) /* PSG primary registers */
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(multigam_IN0_r, multigam_IN0_w) /* IN0 - input port 1 */
AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) AM_WRITE(psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x5002, 0x5002) AM_WRITENOP
AM_RANGE(0x5000, 0x5ffe) AM_ROM
AM_RANGE(0x5fff, 0x5fff) AM_READ_PORT("IN0")
@ -431,11 +409,9 @@ static ADDRESS_MAP_START( multigmt_map, AS_PROGRAM, 8, multigam_state )
AM_RANGE(0x3000, 0x3000) AM_WRITE(multigam_switch_prg_rom)
AM_RANGE(0x3fff, 0x3fff) AM_WRITE(multigam_switch_gfx_rom)
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu", nesapu_device, read, write) /* PSG primary registers */
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(multigam_IN0_r, multigam_IN0_w) /* IN0 - input port 1 */
AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) AM_WRITE(psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x5002, 0x5002) AM_WRITENOP
AM_RANGE(0x5000, 0x5ffe) AM_ROM
AM_RANGE(0x5fff, 0x5fff) AM_READ_PORT("IN0")
@ -694,11 +670,9 @@ static ADDRESS_MAP_START( multigm3_map, AS_PROGRAM, 8, multigam_state )
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu", nesapu_device, read, write) /* PSG primary registers */
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(multigam_IN0_r, multigam_IN0_w) /* IN0 - input port 1 */
AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) AM_WRITE(psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x5001, 0x5001) AM_WRITE(multigm3_switch_prg_rom)
AM_RANGE(0x5002, 0x5002) AM_WRITENOP
AM_RANGE(0x5003, 0x5003) AM_WRITE(multigm3_switch_gfx_rom)
@ -996,11 +970,9 @@ static ADDRESS_MAP_START( supergm3_map, AS_PROGRAM, 8, multigam_state )
AM_RANGE(0x0000, 0x07ff) AM_RAM /* NES RAM */
AM_RANGE(0x0800, 0x0fff) AM_RAM /* additional RAM */
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu", nesapu_device, read, write) /* PSG primary registers */
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(multigam_IN0_r, multigam_IN0_w) /* IN0 - input port 1 */
AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) AM_WRITE(psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4017, 0x4017) AM_READ(multigam_IN1_r) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4fff, 0x4fff) AM_READ_PORT("IN0")
AM_RANGE(0x5000, 0x5fff) AM_ROM
AM_RANGE(0x5000, 0x5000) AM_WRITENOP
@ -1257,13 +1229,6 @@ static MACHINE_CONFIG_START( multigam, multigam_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("nesapu", NES_APU, N2A03_DEFAULTCLOCK)
MCFG_NES_APU_CPU("maincpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DAC_ADD("dac")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( multigm3, multigam )

View File

@ -16,20 +16,6 @@
#include "includes/nes.h"
#include "cpu/m6502/n2a03.h"
READ8_MEMBER(nes_state::psg_4015_r)
{
return m_sound->read(space, 0x15);
}
WRITE8_MEMBER(nes_state::psg_4015_w)
{
m_sound->write(space, 0x15, data);
}
WRITE8_MEMBER(nes_state::psg_4017_w)
{
m_sound->write(space, 0x17, data);
}
WRITE8_MEMBER(nes_state::nes_vh_sprite_dma_w)
{
@ -39,12 +25,9 @@ WRITE8_MEMBER(nes_state::nes_vh_sprite_dma_w)
static ADDRESS_MAP_START( nes_map, AS_PROGRAM, 8, nes_state )
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_MIRROR(0x1800) /* RAM */
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write) /* PPU registers */
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nessound", nesapu_device, read, write) /* PSG primary registers */
AM_RANGE(0x4014, 0x4014) AM_WRITE(nes_vh_sprite_dma_w) /* stupid address space hole */
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(nes_in0_r, nes_in0_w) /* IN0 - input port 1 */
AM_RANGE(0x4017, 0x4017) AM_READ(nes_in1_r) /* IN1 - input port 2 */
AM_RANGE(0x4017, 0x4017) AM_WRITE(psg_4017_w) /* PSG second control register */
// 0x4100-0x5fff -> LOW HANDLER defined on a pcb base
// 0x6000-0x7fff -> MID HANDLER defined on a pcb base
// 0x8000-0xffff -> HIGH HANDLER defined on a pcb base
@ -108,9 +91,8 @@ static MACHINE_CONFIG_START( nes, nes_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("nessound", NES_APU, NTSC_CLOCK)
MCFG_NES_APU_CPU("maincpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
// note APU sound level here was specified as 0.90, not 0.50 like the others
// not sure how to adjust it when it's inside the CPU?
MCFG_NES_CONTROL_PORT_ADD("ctrl1", nes_control_port1_devices, "joypad")
MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel)
@ -128,8 +110,12 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( nespal, nes )
/* basic machine hardware */
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_CLOCK(PAL_CLOCK)
// MCFG_CPU_MODIFY("maincpu")
// MCFG_CPU_CLOCK(PAL_CLOCK) // this doesn't get inherited by the APU with DERIVED_CLOCK!
MCFG_CPU_REPLACE("maincpu", N2A03, PAL_CLOCK)
MCFG_CPU_PROGRAM_MAP(nes_map)
MCFG_DEVICE_REMOVE("ppu")
MCFG_PPU2C07_ADD("ppu")
@ -143,17 +129,17 @@ static MACHINE_CONFIG_DERIVED( nespal, nes )
MCFG_SCREEN_SIZE(32*8, 312)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1)
/* sound hardware */
MCFG_SOUND_REPLACE("nessound", NES_APU, PAL_CLOCK)
MCFG_NES_APU_CPU("maincpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( dendy, nes )
/* basic machine hardware */
MCFG_CPU_MODIFY( "maincpu" )
MCFG_CPU_CLOCK( 26601712/15 ) /* 26.601712MHz / 15 == 1.77344746666... MHz */
// MCFG_CPU_MODIFY( "maincpu" )
// MCFG_CPU_CLOCK( 26601712/15 ) // this doesn't get inherited by the APU with DERIVED_CLOCK!
MCFG_CPU_REPLACE("maincpu", N2A03, 26601712/15 )/* 26.601712MHz / 15 == 1.77344746666... MHz */
MCFG_CPU_PROGRAM_MAP(nes_map)
MCFG_DEVICE_REMOVE("ppu")
MCFG_PPU2C07_ADD("ppu")
@ -165,10 +151,6 @@ static MACHINE_CONFIG_DERIVED( dendy, nes )
MCFG_SCREEN_REFRESH_RATE(50.00697796827)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((106.53/(PAL_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_PAL-PPU_VBLANK_FIRST_SCANLINE+1+2)))
/* sound hardware */
MCFG_SOUND_REPLACE("nessound", NES_APU, 26601712/15) /* 26.601712MHz / 15 == 1.77344746666... MHz */
MCFG_NES_APU_CPU("maincpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( famicom, nes )

View File

@ -346,20 +346,6 @@ WRITE8_MEMBER(playch10_state::time_w)
popmessage("Time: %d%d%d%d",m_timedata[3],m_timedata[2],m_timedata[1],m_timedata[0]);
}
READ8_MEMBER(playch10_state::psg_4015_r)
{
return m_nesapu->read(space, 0x15);
}
WRITE8_MEMBER(playch10_state::psg_4015_w)
{
m_nesapu->write(space, 0x15, data);
}
WRITE8_MEMBER(playch10_state::psg_4017_w)
{
m_nesapu->write(space, 0x17, data);
}
/******************************************************************************/
@ -393,12 +379,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cart_map, AS_PROGRAM, 8, playch10_state )
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_MIRROR(0x1800) AM_SHARE("work_ram")
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)
AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac", dac_device, write_unsigned8)
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu", nesapu_device, read, write)
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(pc10_in0_r, pc10_in0_w)
AM_RANGE(0x4017, 0x4017) AM_READ(pc10_in1_r) AM_WRITE(psg_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4017, 0x4017) AM_READ(pc10_in1_r) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@ -698,15 +681,8 @@ static MACHINE_CONFIG_START( playch10, playch10_state )
MCFG_PPU2C0X_CPU("cart")
MCFG_PPU2C0X_COLORBASE(256)
MCFG_PPU2C0X_SET_NMI(playch10_state, ppu_irq)
// sound hardware
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("nesapu", NES_APU, N2A03_DEFAULTCLOCK)
MCFG_NES_APU_CPU("cart")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DAC_ADD("dac")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_RP5H01_ADD("rp5h01")
MACHINE_CONFIG_END

View File

@ -118,7 +118,6 @@ DIP locations verified for:
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m6502/n2a03.h"
#include "sound/nes_apu.h"
#include "machine/nvram.h"
#include "rendlay.h"
#include "includes/punchout.h"
@ -271,7 +270,6 @@ static ADDRESS_MAP_START( punchout_sound_map, AS_PROGRAM, 8, punchout_state )
AM_RANGE(0x0000, 0x07ff) AM_RAM
AM_RANGE(0x4016, 0x4016) AM_READ(soundlatch_byte_r)
AM_RANGE(0x4017, 0x4017) AM_READ(soundlatch2_byte_r)
AM_RANGE(0x4000, 0x4017) AM_DEVREADWRITE("nesapu", nesapu_device, read, write)
AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END
@ -674,11 +672,7 @@ static MACHINE_CONFIG_START( punchout, punchout_state )
MCFG_SCREEN_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_SOUND_ADD("nesapu", NES_APU, XTAL_21_4772MHz/12)
MCFG_NES_APU_CPU("audiocpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "mono")
MCFG_SOUND_ADD("vlm", VLM5030, XTAL_21_4772MHz/6)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)

View File

@ -144,7 +144,6 @@ Changes:
#include "cpu/z80/z80.h"
#include "sound/sn76496.h"
#include "rendlay.h"
#include "sound/dac.h"
#include "includes/vsnes.h"
/******************************************************************************/
@ -192,44 +191,13 @@ WRITE8_MEMBER(vsnes_state::vsnes_coin_counter_1_w)
}
/******************************************************************************/
READ8_MEMBER(vsnes_state::psg1_4015_r)
{
return m_nesapu1->read(space, 0x15);
}
WRITE8_MEMBER(vsnes_state::psg1_4015_w)
{
m_nesapu1->write(space, 0x15, data);
}
WRITE8_MEMBER(vsnes_state::psg1_4017_w)
{
m_nesapu1->write(space, 0x17, data);
}
READ8_MEMBER(vsnes_state::psg2_4015_r)
{
return m_nesapu2->read(space, 0x15);
}
WRITE8_MEMBER(vsnes_state::psg2_4015_w)
{
m_nesapu2->write(space, 0x15, data);
}
WRITE8_MEMBER(vsnes_state::psg2_4017_w)
{
m_nesapu2->write(space, 0x17, data);
}
static ADDRESS_MAP_START( vsnes_cpu1_map, AS_PROGRAM, 8, vsnes_state )
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_SHARE("work_ram")
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu1", ppu2c0x_device, read, write)
AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac1", dac_device, write_unsigned8)
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu1", nesapu_device, read, write)
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_0_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg1_4015_r, psg1_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(vsnes_in0_r, vsnes_in0_w)
AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_r) AM_WRITE(psg1_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_r) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4020, 0x4020) AM_READWRITE(vsnes_coin_counter_r, vsnes_coin_counter_w)
AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("extra1")
AM_RANGE(0x8000, 0xffff) AM_ROM
@ -238,12 +206,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( vsnes_cpu2_map, AS_PROGRAM, 8, vsnes_state )
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_SHARE("work_ram_1")
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu2", ppu2c0x_device, read, write)
AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac2", dac_device, write_unsigned8)
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu2", nesapu_device, read, write)
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_1_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg2_4015_r, psg2_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(vsnes_in0_1_r, vsnes_in0_1_w)
AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_1_r) AM_WRITE(psg2_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_1_r) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4020, 0x4020) AM_WRITE(vsnes_coin_counter_1_w)
AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("extra2")
AM_RANGE(0x8000, 0xffff) AM_ROM
@ -255,12 +220,9 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( vsnes_cpu1_bootleg_map, AS_PROGRAM, 8, vsnes_state )
AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_SHARE("work_ram")
AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu1", ppu2c0x_device, read, write)
AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac1", dac_device, write_unsigned8)
AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nesapu1", nesapu_device, read, write)
AM_RANGE(0x4014, 0x4014) AM_WRITE(sprite_dma_0_w)
AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg1_4015_r, psg1_4015_w) /* PSG status / first control register */
AM_RANGE(0x4016, 0x4016) AM_READWRITE(vsnes_in0_r, vsnes_in0_w)
AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_r) AM_WRITE(psg1_4017_w) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4017, 0x4017) AM_READ(vsnes_in1_r) /* IN1 - input port 2 / PSG second control register */
AM_RANGE(0x4020, 0x4020) AM_READWRITE(vsnes_coin_counter_r, vsnes_coin_counter_w)
AM_RANGE(0x6000, 0x7fff) AM_RAMBANK("extra1")
AM_RANGE(0x8000, 0xffff) AM_ROM
@ -1727,13 +1689,6 @@ static MACHINE_CONFIG_START( vsnes, vsnes_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("nesapu1", NES_APU, N2A03_DEFAULTCLOCK)
MCFG_NES_APU_CPU("maincpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DAC_ADD("dac1")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( jajamaru, vsnes )
@ -1819,20 +1774,6 @@ static MACHINE_CONFIG_START( vsdual, vsnes_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("nesapu1", NES_APU, N2A03_DEFAULTCLOCK)
MCFG_NES_APU_CPU("maincpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_SOUND_ADD("nesapu2", NES_APU, N2A03_DEFAULTCLOCK)
MCFG_NES_APU_CPU("sub")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DAC_ADD("dac1")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_DAC_ADD("dac2")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END
@ -1870,13 +1811,6 @@ static MACHINE_CONFIG_START( vsnes_bootleg, vsnes_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("nesapu1", NES_APU, N2A03_DEFAULTCLOCK)
MCFG_NES_APU_CPU("maincpu")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DAC_ADD("dac1")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
// instead of the above?
MCFG_SOUND_ADD("sn1", SN76489A, 4000000) // ?? Mhz
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)

View File

@ -16,7 +16,6 @@
#include "bus/nes/nes_slot.h"
#include "bus/nes/nes_carts.h"
#include "bus/nes_ctrl/ctrl.h"
#include "sound/nes_apu.h"
/***************************************************************************
CONSTANTS
@ -57,7 +56,6 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_ppu(*this, "ppu"),
m_sound(*this, "nessound"),
m_ctrl1(*this, "ctrl1"),
m_ctrl2(*this, "ctrl2"),
m_exp(*this, "exp"),
@ -76,7 +74,6 @@ public:
required_device<cpu_device> m_maincpu;
required_device<ppu2c0x_device> m_ppu;
required_device<nesapu_device> m_sound;
required_device<nes_control_port_device> m_ctrl1;
required_device<nes_control_port_device> m_ctrl2;
optional_device<nes_control_port_device> m_exp;
@ -99,9 +96,6 @@ public:
virtual void video_reset();
DECLARE_PALETTE_INIT(nes);
UINT32 screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(psg_4015_r);
DECLARE_WRITE8_MEMBER(psg_4015_w);
DECLARE_WRITE8_MEMBER(psg_4017_w);
NESCTRL_BRIGHTPIXEL_CB(bright_pixel);
DECLARE_DRIVER_INIT(famicom);

View File

@ -1,7 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Ernesto Corvi,Brad Oliver
#include "machine/rp5h01.h"
#include "sound/nes_apu.h"
#include "video/ppu2c0x.h"
struct chr_bank
@ -16,7 +15,6 @@ public:
playch10_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_nesapu(*this, "nesapu"),
m_ppu(*this, "ppu"),
m_rp5h01(*this, "rp5h01"),
m_ram_8w(*this, "ram_8w"),
@ -27,7 +25,6 @@ public:
{ }
required_device<cpu_device> m_maincpu;
required_device<nesapu_device> m_nesapu;
required_device<ppu2c0x_device> m_ppu;
optional_device<rp5h01_device> m_rp5h01;
@ -107,9 +104,6 @@ public:
void pc10_set_mirroring(int mirroring);
DECLARE_WRITE8_MEMBER(playch10_videoram_w);
DECLARE_CUSTOM_INPUT_MEMBER(pc10_int_detect_r);
DECLARE_READ8_MEMBER(psg_4015_r);
DECLARE_WRITE8_MEMBER(psg_4015_w);
DECLARE_WRITE8_MEMBER(psg_4017_w);
DECLARE_DRIVER_INIT(playch10);
DECLARE_DRIVER_INIT(pc_gun);
DECLARE_DRIVER_INIT(pcaboard);

View File

@ -1,6 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Pierpaolo Prazzoli
#include "sound/nes_apu.h"
#include "video/ppu2c0x.h"
class vsnes_state : public driver_device
@ -10,8 +9,6 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_subcpu(*this, "sub"),
m_nesapu1(*this, "nesapu1"),
m_nesapu2(*this, "nesapu2"),
m_ppu1(*this, "ppu1"),
m_ppu2(*this, "ppu2"),
m_work_ram(*this, "work_ram"),
@ -20,8 +17,6 @@ public:
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_subcpu;
required_device<nesapu_device> m_nesapu1;
optional_device<nesapu_device> m_nesapu2;
required_device<ppu2c0x_device> m_ppu1;
optional_device<ppu2c0x_device> m_ppu2;
@ -91,12 +86,7 @@ public:
DECLARE_WRITE8_MEMBER(vsdual_vrom_banking_main);
DECLARE_WRITE8_MEMBER(vsdual_vrom_banking_sub);
void v_set_mirroring(int ppu, int mirroring);
DECLARE_READ8_MEMBER(psg1_4015_r);
DECLARE_WRITE8_MEMBER(psg1_4015_w);
DECLARE_WRITE8_MEMBER(psg1_4017_w);
DECLARE_READ8_MEMBER(psg2_4015_r);
DECLARE_WRITE8_MEMBER(psg2_4015_w);
DECLARE_WRITE8_MEMBER(psg2_4017_w);
DECLARE_DRIVER_INIT(vskonami);
DECLARE_DRIVER_INIT(vsvram);
DECLARE_DRIVER_INIT(bnglngby);