diff --git a/.gitattributes b/.gitattributes index cc424467fe2..589d04add7a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1758,6 +1758,8 @@ src/emu/sound/tms5110r.c svneol=native#text/plain src/emu/sound/tms5220.c svneol=native#text/plain src/emu/sound/tms5220.h svneol=native#text/plain src/emu/sound/tms5220.txt svneol=native#text/plain +src/emu/sound/upd7752.c svneol=native#text/plain +src/emu/sound/upd7752.h svneol=native#text/plain src/emu/sound/upd7759.c svneol=native#text/plain src/emu/sound/upd7759.h svneol=native#text/plain src/emu/sound/vlm5030.c svneol=native#text/plain diff --git a/src/emu/sound/sound.mak b/src/emu/sound/sound.mak index 538278a67f7..5ef5285757b 100644 --- a/src/emu/sound/sound.mak +++ b/src/emu/sound/sound.mak @@ -728,6 +728,15 @@ SOUNDOBJS += $(SOUNDOBJ)/tc8830f.o endif +#------------------------------------------------- +# NEC uPD7752 +#@src/emu/sound/upd7752.h,SOUNDS += UPD7752 +#------------------------------------------------- + +ifneq ($(filter UPD7752,$(SOUNDS)),) +SOUNDOBJS += $(SOUNDOBJ)/upd7752.o +endif + #------------------------------------------------- # VLM5030 speech synthesizer diff --git a/src/emu/sound/upd7752.c b/src/emu/sound/upd7752.c new file mode 100644 index 00000000000..5a44afec7ba --- /dev/null +++ b/src/emu/sound/upd7752.c @@ -0,0 +1,129 @@ +/*************************************************************************** + +Template for skeleton device + +***************************************************************************/ + +#include "emu.h" +#include "sound/upd7752.h" + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type UPD7752 = &device_creator; + +static ADDRESS_MAP_START( upd7752_ram, AS_0, 8, upd7752_device ) + AM_RANGE(0x00000, 0x3ffff) AM_RAM +ADDRESS_MAP_END + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// upd7752_device - constructor +//------------------------------------------------- + +upd7752_device::upd7752_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, UPD7752, "uPD7752", tag, owner, clock, "upd7752", __FILE__), + device_sound_interface(mconfig, *this), + device_memory_interface(mconfig, *this), + m_space_config("ram", ENDIANNESS_LITTLE, 8, 18, 0, NULL, *ADDRESS_MAP_NAME(upd7752_ram)) +{ +} + + +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +const address_space_config *upd7752_device::memory_space_config(address_spacenum spacenum) const +{ + return (spacenum == AS_0) ? &m_space_config : NULL; +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void upd7752_device::device_start() +{ + /* TODO: clock */ + m_stream = stream_alloc(0, 1, clock() / 64); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void upd7752_device::device_reset() +{ +} + + +//------------------------------------------------- +// device_stop - device-specific stop +//------------------------------------------------- + +void upd7752_device::device_stop() +{ + +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void upd7752_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ +} + + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +READ8_MEMBER( upd7752_device::read ) +{ + switch(offset & 3) + { + //[0x00]: status register + //x--- ---- BSY busy status (1) processing (0) stopped + //-x-- ---- REQ audio parameter (1) input request (0) prohibited (???) + //--x- ---- ~INT / EXT message data (1) Outside (0) Inside + //---x ---- ERR error flag + case 0x00: return 0x60; + //[0x02]: port 0xe2 latch? + case 0x02: return 0xff; + //[0x03]: port 0xe3 latch? + case 0x03: return 0xff; + } + return 0xff; +} + +WRITE8_MEMBER( upd7752_device::write ) +{ + switch(offset & 3) + { + // [0x00]: audio parameter transfer + + // [0x02]: mode set + // ---- -x-- Frame periodic analysis (0) 10 ms / frame (1) 20 ms / frame + // ---- --xx Utterance (tempo?) speed + // 00 : NORMAL SPEED + // 01 : SLOW SPEED + // 10 : FAST SPEED + // 11 : Setting prohibited + + // case 0x02: + + // case 0x03: command set + } +} diff --git a/src/emu/sound/upd7752.h b/src/emu/sound/upd7752.h new file mode 100644 index 00000000000..20b8c85abac --- /dev/null +++ b/src/emu/sound/upd7752.h @@ -0,0 +1,65 @@ +/*************************************************************************** + +Template for skeleton device + +***************************************************************************/ + +#pragma once + +#ifndef __UPD7752DEV_H__ +#define __UPD7752DEV_H__ + + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_UPD7752_ADD(_tag,_freq) \ + MCFG_DEVICE_ADD(_tag, UPD7752, _freq) + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> upd7752_device + +class upd7752_device : public device_t, + public device_sound_interface, + public device_memory_interface +{ +public: + // construction/destruction + upd7752_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // I/O operations + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( read ); + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_stop(); + virtual void device_reset(); + + virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); + +private: + sound_stream *m_stream; + const address_space_config m_space_config; +}; + + +// device type definition +extern const device_type UPD7752; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif diff --git a/src/mame/mame.mak b/src/mame/mame.mak index a38e5a4d68c..fbd72cb7f7f 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -198,6 +198,7 @@ SOUNDS += OKIM6258 SOUNDS += OKIM6295 SOUNDS += OKIM6376 SOUNDS += OKIM9810 +#SOUNDS += UPD7752 SOUNDS += UPD7759 SOUNDS += HC55516 SOUNDS += TC8830F diff --git a/src/mess/drivers/pc6001.c b/src/mess/drivers/pc6001.c index b5fcda86416..34512a4202c 100644 --- a/src/mess/drivers/pc6001.c +++ b/src/mess/drivers/pc6001.c @@ -128,6 +128,7 @@ irq vector 0x26: #include "machine/i8251.h" #include "video/mc6847.h" #include "sound/ay8910.h" +#include "sound/upd7752.h" #include "sound/wave.h" #include "imagedev/cassette.h" @@ -217,8 +218,6 @@ public: DECLARE_WRITE8_MEMBER(pc6001m2_system_latch_w); DECLARE_WRITE8_MEMBER(pc6001m2_vram_bank_w); DECLARE_WRITE8_MEMBER(pc6001m2_col_bank_w); - DECLARE_READ8_MEMBER(upd7752_reg_r); - DECLARE_WRITE8_MEMBER(upd7752_reg_w); DECLARE_WRITE8_MEMBER(pc6001m2_0xf3_w); DECLARE_WRITE8_MEMBER(pc6001m2_timer_adj_w); DECLARE_WRITE8_MEMBER(pc6001m2_timer_irqv_w); @@ -1355,44 +1354,6 @@ WRITE8_MEMBER(pc6001_state::pc6001m2_col_bank_w) m_bgcol_bank = (data & 7); } -/* voice synth is a NEC uPD7752 sound chip (currently unemulated) */ -READ8_MEMBER(pc6001_state::upd7752_reg_r) -{ - switch(offset & 3) - { - //[0x00]: status register - //x--- ---- BSY busy status (1) processing (0) stopped - //-x-- ---- REQ audio parameter (1) input request (0) prohibited (???) - //--x- ---- ~INT / EXT message data (1) Outside (0) Inside - //---x ---- ERR error flag - case 0x00: return 0x60; - //[0x02]: port 0xe2 latch? - case 0x02: return 0xff; - //[0x03]: port 0xe3 latch? - case 0x03: return 0xff; - } - return 0xff; -} - -WRITE8_MEMBER(pc6001_state::upd7752_reg_w) -{ - switch(offset & 3) - { - // [0x00]: audio parameter transfer - - // [0x02]: mode set - // ---- -x-- Frame periodic analysis (0) 10 ms / frame (1) 20 ms / frame - // ---- --xx Utterance (tempo?) speed - // 00 : NORMAL SPEED - // 01 : SLOW SPEED - // 10 : FAST SPEED - // 11 : Setting prohibited - - // case 0x02: - - // case 0x03: command set - } -} WRITE8_MEMBER(pc6001_state::pc6001m2_0xf3_w) { @@ -1480,7 +1441,7 @@ static ADDRESS_MAP_START( pc6001m2_io , AS_IO, 8, pc6001_state ) AM_RANGE(0xd0, 0xd3) AM_MIRROR(0x0c) AM_NOP // disk device - AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_READWRITE(upd7752_reg_r,upd7752_reg_w) + AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("upd7752", upd7752_device, read, write) AM_RANGE(0xf0, 0xf0) AM_READWRITE(pc6001m2_bank_r0_r,pc6001m2_bank_r0_w) AM_RANGE(0xf1, 0xf1) AM_READWRITE(pc6001m2_bank_r1_r,pc6001m2_bank_r1_w) @@ -1527,7 +1488,7 @@ static ADDRESS_MAP_START( pc6601_io , AS_IO, 8, pc6001_state ) AM_RANGE(0xd0, 0xdf) AM_READWRITE(pc6601_fdc_r,pc6601_fdc_w) // disk device - AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_READWRITE(upd7752_reg_r,upd7752_reg_w) + AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("upd7752", upd7752_device, read, write) AM_RANGE(0xf0, 0xf0) AM_READWRITE(pc6001m2_bank_r0_r,pc6001m2_bank_r0_w) AM_RANGE(0xf1, 0xf1) AM_READWRITE(pc6001m2_bank_r1_r,pc6001m2_bank_r1_w) @@ -1731,7 +1692,7 @@ static ADDRESS_MAP_START( pc6001sr_io , AS_IO, 8, pc6001_state ) AM_RANGE(0xd0, 0xdf) AM_READWRITE(pc6601_fdc_r,pc6601_fdc_w) // disk device - AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_READWRITE(upd7752_reg_r,upd7752_reg_w) + AM_RANGE(0xe0, 0xe3) AM_MIRROR(0x0c) AM_DEVREADWRITE("upd7752", upd7752_device, read, write) // AM_RANGE(0xf0, 0xf0) AM_READWRITE(pc6001m2_bank_r0_r,pc6001m2_bank_r0_w) // AM_RANGE(0xf1, 0xf1) AM_READWRITE(pc6001m2_bank_r1_r,pc6001m2_bank_r1_w) @@ -2425,6 +2386,9 @@ static MACHINE_CONFIG_DERIVED( pc6001m2, pc6001 ) MCFG_GFXDECODE(pc6001m2) + MCFG_SOUND_ADD("upd7752", UPD7752, PC6001_MAIN_CLOCK/4) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( pc6601, pc6001m2 ) diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 2981bd55658..4856c5fd191 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -182,6 +182,7 @@ SOUNDS += OKIM6258 SOUNDS += OKIM6295 #SOUNDS += OKIM6376 #SOUNDS += OKIM9810 +SOUNDS += UPD7752 SOUNDS += UPD7759 SOUNDS += HC55516 #SOUNDS += TC8830F