diff --git a/.gitattributes b/.gitattributes index 371162cf5b4..b74fb3fb6e3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7141,6 +7141,8 @@ src/mame/machine/slapstic.c svneol=native#text/plain src/mame/machine/slikshot.c svneol=native#text/plain src/mame/machine/snes.c svneol=native#text/plain src/mame/machine/spisprit.c svneol=native#text/plain +src/mame/machine/st0016.c svneol=native#text/plain +src/mame/machine/st0016.h svneol=native#text/plain src/mame/machine/starwars.c svneol=native#text/plain src/mame/machine/steppers.c svneol=native#text/plain src/mame/machine/steppers.h svneol=native#text/plain diff --git a/src/emu/sound/st0016.c b/src/emu/sound/st0016.c index 003ad3020c0..84699fa6266 100644 --- a/src/emu/sound/st0016.c +++ b/src/emu/sound/st0016.c @@ -23,7 +23,7 @@ const device_type ST0016 = &device_creator; //------------------------------------------------- st0016_device::st0016_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ST0016, "ST0016", tag, owner, clock, "st0016", __FILE__), + : device_t(mconfig, ST0016, "ST0016 (Audio)", tag, owner, clock, "st0016_audio", __FILE__), device_sound_interface(mconfig, *this), m_stream(NULL), m_sound_ram(NULL) diff --git a/src/mame/drivers/jclub2.c b/src/mame/drivers/jclub2.c index 1aa4571b600..75c8833e1fd 100644 --- a/src/mame/drivers/jclub2.c +++ b/src/mame/drivers/jclub2.c @@ -96,9 +96,8 @@ To do: #include "cpu/m68000/m68000.h" #include "machine/eepromser.h" #include "sound/okim6295.h" -#include "sound/st0016.h" #include "includes/st0016.h" -#include "cpu/z80/z80.h" +#include "machine/st0016.h" #include "video/st0020.h" #include "machine/nvram.h" @@ -1038,7 +1037,7 @@ MACHINE_CONFIG_END static ADDRESS_MAP_START( st0016_mem, AS_PROGRAM, 8, darkhors_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") - AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE("stsnd", st0016_device, st0016_snd_r, st0016_snd_w) + //AM_RANGE(0xe900, 0xe9ff) // sound - internal AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w) AM_RANGE(0xe82f, 0xe830) AM_READNOP AM_RANGE(0xf000, 0xffff) AM_RAM @@ -1055,10 +1054,6 @@ static ADDRESS_MAP_START( st0016_io, AS_IO, 8, darkhors_state ) //AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r) ADDRESS_MAP_END -static const st0016_interface st0016_config = -{ - &st0016_charram -}; VIDEO_START_MEMBER(darkhors_state,jclub2o) { @@ -1075,7 +1070,7 @@ static MACHINE_CONFIG_START( jclub2o, darkhors_state ) MCFG_CPU_PROGRAM_MAP(jclub2o_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", darkhors_state, darkhors_irq, "screen", 0, 1) - MCFG_CPU_ADD("st0016",Z80,8000000) + MCFG_CPU_ADD("st0016",ST0016_CPU,8000000) MCFG_CPU_PROGRAM_MAP(st0016_mem) MCFG_CPU_IO_MAP(st0016_io) MCFG_CPU_VBLANK_INT_DRIVER("screen", darkhors_state, irq0_line_hold) @@ -1104,12 +1099,6 @@ static MACHINE_CONFIG_START( jclub2o, darkhors_state ) MCFG_VIDEO_START_OVERRIDE(darkhors_state,jclub2o) - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_ST0016_ADD("stsnd", 0) - MCFG_SOUND_CONFIG(st0016_config) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/macs.c b/src/mame/drivers/macs.c index d461c89d59f..b0a97912b7e 100644 --- a/src/mame/drivers/macs.c +++ b/src/mame/drivers/macs.c @@ -56,8 +56,7 @@ KISEKAE -- info */ #include "emu.h" -#include "cpu/z80/z80.h" -#include "sound/st0016.h" +#include "machine/st0016.h" #include "includes/st0016.h" @@ -94,7 +93,7 @@ static ADDRESS_MAP_START( macs_mem, AS_PROGRAM, 8, macs_state ) AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w) AM_RANGE(0xe000, 0xe7ff) AM_RAM /* work ram ? */ AM_RANGE(0xe800, 0xe87f) AM_RAM AM_SHARE("ram2") - AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE("stsnd", st0016_device, st0016_snd_r, st0016_snd_w) + //AM_RANGE(0xe900, 0xe9ff) // sound - internal AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w) AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w) AM_RANGE(0xf000, 0xf7ff) AM_RAMBANK("bank3") /* common /backup ram ?*/ @@ -470,14 +469,11 @@ static INPUT_PORTS_START( macs_h ) INPUT_PORTS_END -static const st0016_interface st0016_config = -{ - &st0016_charram -}; + static MACHINE_CONFIG_START( macs, macs_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80,8000000) /* 8 MHz ? */ + MCFG_CPU_ADD("maincpu",ST0016_CPU,8000000) /* 8 MHz ? */ MCFG_CPU_PROGRAM_MAP(macs_mem) MCFG_CPU_IO_MAP(macs_io) @@ -498,13 +494,6 @@ static MACHINE_CONFIG_START( macs, macs_state ) MCFG_PALETTE_ADD("palette", 16*16*4+1) MCFG_VIDEO_START_OVERRIDE(st0016_state,st0016) - - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_ST0016_ADD("stsnd", 0) - MCFG_SOUND_CONFIG(st0016_config) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/speglsht.c b/src/mame/drivers/speglsht.c index 32b4f42bed0..08008490eeb 100644 --- a/src/mame/drivers/speglsht.c +++ b/src/mame/drivers/speglsht.c @@ -104,9 +104,8 @@ Notes: */ #include "emu.h" -#include "cpu/z80/z80.h" +#include "machine/st0016.h" #include "cpu/mips/r3000.h" -#include "sound/st0016.h" #include "includes/st0016.h" @@ -144,7 +143,7 @@ static ADDRESS_MAP_START( st0016_mem, AS_PROGRAM, 8, speglsht_state ) AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w) AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_RANGE(0xe800, 0xe87f) AM_RAM - AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE("stsnd", st0016_device, st0016_snd_r, st0016_snd_w) + //AM_RANGE(0xe900, 0xe9ff) // sound - internal AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w) AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w) AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("shared") @@ -321,10 +320,6 @@ INPUT_PORTS_END static GFXDECODE_START( speglsht ) GFXDECODE_END -static const st0016_interface st0016_config = -{ - &st0016_charram -}; MACHINE_RESET_MEMBER(speglsht_state,speglsht) { @@ -380,7 +375,7 @@ UINT32 speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rgb3 static MACHINE_CONFIG_START( speglsht, speglsht_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80, 8000000) /* 8 MHz ? */ + MCFG_CPU_ADD("maincpu",ST0016_CPU, 8000000) /* 8 MHz ? */ MCFG_CPU_PROGRAM_MAP(st0016_mem) MCFG_CPU_IO_MAP(st0016_io) @@ -407,12 +402,6 @@ static MACHINE_CONFIG_START( speglsht, speglsht_state ) MCFG_VIDEO_START_OVERRIDE(speglsht_state,speglsht) - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_ST0016_ADD("stsnd", 0) - MCFG_SOUND_CONFIG(st0016_config) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END ROM_START( speglsht ) diff --git a/src/mame/drivers/srmp5.c b/src/mame/drivers/srmp5.c index 317c3c10f8f..276c03ef96e 100644 --- a/src/mame/drivers/srmp5.c +++ b/src/mame/drivers/srmp5.c @@ -35,9 +35,8 @@ This is not a bug (real machine behaves the same). #include "emu.h" -#include "cpu/z80/z80.h" +#include "machine/st0016.h" #include "cpu/mips/r3000.h" -#include "sound/st0016.h" #include "includes/st0016.h" #define DEBUG_CHAR @@ -370,7 +369,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( st0016_mem, AS_PROGRAM, 8, srmp5_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") - AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE("stsnd", st0016_device, st0016_snd_r, st0016_snd_w) + //AM_RANGE(0xe900, 0xe9ff) // sound - internal AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w) AM_RANGE(0xf000, 0xffff) AM_RAM ADDRESS_MAP_END @@ -497,10 +496,6 @@ static INPUT_PORTS_START( srmp5 ) INPUT_PORTS_END -static const st0016_interface st0016_config = -{ - &st0016_charram -}; static const gfx_layout tile_16x8x8_layout = { @@ -534,7 +529,7 @@ GFXDECODE_END static MACHINE_CONFIG_START( srmp5, srmp5_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80,8000000) + MCFG_CPU_ADD("maincpu",ST0016_CPU,8000000) MCFG_CPU_PROGRAM_MAP(st0016_mem) MCFG_CPU_IO_MAP(st0016_io) MCFG_CPU_VBLANK_INT_DRIVER("screen", srmp5_state, irq0_line_hold) @@ -559,12 +554,6 @@ static MACHINE_CONFIG_START( srmp5, srmp5_state ) #endif MCFG_VIDEO_START_OVERRIDE(st0016_state,st0016) - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_ST0016_ADD("stsnd", 0) - MCFG_SOUND_CONFIG(st0016_config) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END ROM_START( srmp5 ) diff --git a/src/mame/drivers/st0016.c b/src/mame/drivers/st0016.c index 486ff4a5463..66730eba690 100644 --- a/src/mame/drivers/st0016.c +++ b/src/mame/drivers/st0016.c @@ -14,7 +14,7 @@ Dips verified for Neratte Chu (nratechu) from manual #include "cpu/z80/z80.h" #include "sound/st0016.h" #include "includes/st0016.h" - +#include "machine/st0016.h" UINT32 st0016_rom_bank; @@ -32,7 +32,7 @@ static ADDRESS_MAP_START( st0016_mem, AS_PROGRAM, 8, st0016_state ) AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w) AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_RANGE(0xe800, 0xe87f) AM_RAM /* common ram */ - AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE("stsnd", st0016_device, st0016_snd_r, st0016_snd_w) /* sound regs 8 x $20 bytes, see notes */ + //AM_RANGE(0xe900, 0xe9ff) // sound - internal AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w) AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w) AM_RANGE(0xf000, 0xffff) AM_RAM /* work ram */ @@ -395,10 +395,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(st0016_state::st0016_int) m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE ); } -static const st0016_interface st0016_config = -{ - &st0016_charram -}; + /************************************* @@ -409,7 +406,7 @@ static const st0016_interface st0016_config = static MACHINE_CONFIG_START( st0016, st0016_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu",Z80,8000000) /* 8 MHz ? */ + MCFG_CPU_ADD("maincpu",ST0016_CPU,8000000) /* 8 MHz ? */ MCFG_CPU_PROGRAM_MAP(st0016_mem) MCFG_CPU_IO_MAP(st0016_io) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", st0016_state, st0016_int, "screen", 0, 1) @@ -428,12 +425,6 @@ static MACHINE_CONFIG_START( st0016, st0016_state ) MCFG_VIDEO_START_OVERRIDE(st0016_state,st0016) - MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - - MCFG_ST0016_ADD("stsnd", 0) - MCFG_SOUND_CONFIG(st0016_config) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( mayjinsn, st0016 ) diff --git a/src/mame/machine/st0016.c b/src/mame/machine/st0016.c new file mode 100644 index 00000000000..01f9ca9b7b4 --- /dev/null +++ b/src/mame/machine/st0016.c @@ -0,0 +1,66 @@ +/* ST0016 - CPU (z80) + Sound + Video */ + +#include "st0016.h" + +const device_type ST0016_CPU = &device_creator; + + +static ADDRESS_MAP_START(st0016_cpu_internal_map, AS_PROGRAM, 8, st0016_cpu_device) + AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE("stsnd", st0016_device, st0016_snd_r, st0016_snd_w) /* sound regs 8 x $20 bytes, see notes */ +ADDRESS_MAP_END + + +static ADDRESS_MAP_START(st0016_cpu_internal_io_map, AS_IO, 8, st0016_cpu_device) +ADDRESS_MAP_END + + +st0016_cpu_device::st0016_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : z80_device(mconfig, ST0016_CPU, "ST0016", tag, owner, clock, "st0016_cpu", __FILE__), + m_io_space_config("io", ENDIANNESS_LITTLE, 8, 16, 0, ADDRESS_MAP_NAME(st0016_cpu_internal_io_map)), + m_space_config("regs", ENDIANNESS_LITTLE, 8, 16, 0, ADDRESS_MAP_NAME(st0016_cpu_internal_map)) +{ +} + + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void st0016_cpu_device::device_start() +{ + z80_device::device_start(); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void st0016_cpu_device::device_reset() +{ + z80_device::device_reset(); +} + +static const st0016_interface st0016_config = +{ + &st0016_charram +}; + +/* CPU interface */ +static MACHINE_CONFIG_FRAGMENT( st0016_cpu ) + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + + MCFG_ST0016_ADD("stsnd", 0) + MCFG_SOUND_CONFIG(st0016_config) + MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) + MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + +MACHINE_CONFIG_END + +machine_config_constructor st0016_cpu_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( st0016_cpu ); +} + + diff --git a/src/mame/machine/st0016.h b/src/mame/machine/st0016.h new file mode 100644 index 00000000000..d90aac3509f --- /dev/null +++ b/src/mame/machine/st0016.h @@ -0,0 +1,50 @@ +/* ST0016 - CPU (z80) + Sound + Video */ + +#pragma once + +#ifndef __ST0016_CPU__ +#define __ST0016_CPU__ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "sound/st0016.h" + +extern UINT8 *st0016_charram; + + +class st0016_cpu_device : public z80_device +{ +public: + st0016_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32); + +protected: + // device-level overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual void device_start(); + virtual void device_reset(); + + const address_space_config m_io_space_config; + const address_space_config m_space_config; + + + const address_space_config *memory_space_config(address_spacenum spacenum) const + { + switch (spacenum) + { + case AS_IO: return &m_io_space_config; + case AS_PROGRAM: return &m_space_config; + default: return z80_device::memory_space_config(spacenum); + } + } + + +private: + +}; + + +// device type definition +extern const device_type ST0016_CPU; + + +#endif /// __ST0016_CPU__ diff --git a/src/mame/mame.mak b/src/mame/mame.mak index a5fe946a32c..de0d79f3fd7 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -1791,7 +1791,7 @@ $(MAMEOBJ)/seta.a: \ $(DRIVERS)/srmp6.o \ $(DRIVERS)/ssv.o $(VIDEO)/ssv.o \ $(VIDEO)/st0020.o \ - $(DRIVERS)/st0016.o $(VIDEO)/st0016.o \ + $(MACHINE)/st0016.o $(DRIVERS)/st0016.o $(VIDEO)/st0016.o \ $(VIDEO)/seta001.o \ $(MAMEOBJ)/sigma.a: \