diff options
author | R. Belmont <rb6502@users.noreply.github.com> | 2018-11-29 10:43:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-29 10:43:55 -0500 |
commit | 3cdf716d64e9de01fd728e3e2006672ebebacaa4 (patch) | |
tree | 70add154f34b8ce5c6ffef690a60aab554ef05c0 | |
parent | 22955438edc957fb0e72bc3aaa69bb2000884930 (diff) | |
parent | 92966959c259446daae3e3b19239a4d597be3549 (diff) |
Merge pull request #4348 from cam900/scsp
scsp.cpp : Updates
-rw-r--r-- | src/devices/machine/stvcd.cpp | 13 | ||||
-rw-r--r-- | src/devices/machine/stvcd.h | 4 | ||||
-rw-r--r-- | src/devices/sound/scsp.cpp | 123 | ||||
-rw-r--r-- | src/devices/sound/scsp.h | 17 | ||||
-rw-r--r-- | src/devices/sound/scspdsp.cpp | 2 | ||||
-rw-r--r-- | src/mame/drivers/coolridr.cpp | 67 | ||||
-rw-r--r-- | src/mame/drivers/model2.cpp | 14 | ||||
-rw-r--r-- | src/mame/drivers/model3.cpp | 14 | ||||
-rw-r--r-- | src/mame/drivers/saturn.cpp | 17 | ||||
-rw-r--r-- | src/mame/drivers/stv.cpp | 19 |
10 files changed, 142 insertions, 148 deletions
diff --git a/src/devices/machine/stvcd.cpp b/src/devices/machine/stvcd.cpp index fe6343e602c..09323a7deea 100644 --- a/src/devices/machine/stvcd.cpp +++ b/src/devices/machine/stvcd.cpp @@ -2,7 +2,7 @@ // copyright-holders:Angelo Salese, R. Belmont /*************************************************************************** - machine/stvcd.c - Sega Saturn and ST-V CD-ROM handling + machine/stvcd.cpp - Sega Saturn and ST-V CD-ROM handling Another tilt at the windmill in 2011 by R. Belmont. @@ -70,6 +70,7 @@ DEFINE_DEVICE_TYPE(STVCD, stvcd_device, "stvcd", "Sega Saturn/ST-V CD Block HLE" stvcd_device::stvcd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, STVCD, tag, owner, clock) + , device_mixer_interface(mconfig, *this, 2) , m_cdrom_image(*this, "cdrom") , m_sector_timer(*this, "sector_timer") , m_sh1_timer(*this, "sh1_cmd") @@ -85,20 +86,14 @@ MACHINE_CONFIG_START(stvcd_device::device_add_mconfig) MCFG_TIMER_DRIVER_ADD("sh1_cmd", stvcd_device, stv_sh1_sim) MCFG_DEVICE_ADD("cdda", CDDA) - // FIXME: these outputs should not be hardcoded - MCFG_SOUND_ROUTE(0, ":lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, ":rspeaker", 1.0) + MCFG_MIXER_ROUTE(0, *this, 1.0, 0) + MCFG_MIXER_ROUTE(1, *this, 1.0, 1) MACHINE_CONFIG_END void stvcd_device::device_start() { } -READ16_MEMBER(stvcd_device::channel_volume_r) -{ - return m_cdda->get_channel_volume(offset); -} - int stvcd_device::get_timing_command(void) { /* TODO: calculate timings based off command params */ diff --git a/src/devices/machine/stvcd.h b/src/devices/machine/stvcd.h index 6931edec867..12e932ee01c 100644 --- a/src/devices/machine/stvcd.h +++ b/src/devices/machine/stvcd.h @@ -11,7 +11,7 @@ #include "machine/timer.h" #include "sound/cdda.h" -class stvcd_device : public device_t +class stvcd_device : public device_t, public device_mixer_interface { static constexpr unsigned MAX_FILTERS = 24; static constexpr unsigned MAX_BLOCKS = 200; @@ -23,8 +23,6 @@ public: DECLARE_READ32_MEMBER(stvcd_r); DECLARE_WRITE32_MEMBER(stvcd_w); - DECLARE_READ16_MEMBER(channel_volume_r); - void set_tray_open(); void set_tray_close(); diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp index c1cb7df8875..89945492c06 100644 --- a/src/devices/sound/scsp.cpp +++ b/src/devices/sound/scsp.cpp @@ -30,11 +30,14 @@ * June 6, 2011 (AS) Rewrote DMA from scratch, Darius 2 relies on it. */ +// TODO : Envelope/LFO times are based on 44100Hz case? #include "emu.h" #include "scsp.h" +#include <algorithm> -#define ICLIP16(x) (x<-32768)?-32768:((x>32767)?32767:x) +static constexpr int32_t clip16(int x) { return std::min(32767, std::max(-32768, x)); } +static constexpr int32_t clip18(int x) { return std::min(131071, std::max(-131072, x)); } #define SHIFT 12 #define LFO_SHIFT 8 @@ -50,8 +53,8 @@ */ //SLOT PARAMETERS -#define KEYONEX(slot) ((slot->udata.data[0x0]>>0x0)&0x1000) -#define KEYONB(slot) ((slot->udata.data[0x0]>>0x0)&0x0800) +#define KEYONEX(slot) ((slot->udata.data[0x0]>>0x0)&0x1000) +#define KEYONB(slot) ((slot->udata.data[0x0]>>0x0)&0x0800) #define SBCTL(slot) ((slot->udata.data[0x0]>>0x9)&0x0003) #define SSCTL(slot) ((slot->udata.data[0x0]>>0x7)&0x0003) #define LPCTL(slot) ((slot->udata.data[0x0]>>0x5)&0x0003) @@ -65,15 +68,15 @@ #define D2R(slot) ((slot->udata.data[0x4]>>0xB)&0x001F) #define D1R(slot) ((slot->udata.data[0x4]>>0x6)&0x001F) -#define EGHOLD(slot) ((slot->udata.data[0x4]>>0x0)&0x0020) +#define EGHOLD(slot) ((slot->udata.data[0x4]>>0x0)&0x0020) #define AR(slot) ((slot->udata.data[0x4]>>0x0)&0x001F) -#define LPSLNK(slot) ((slot->udata.data[0x5]>>0x0)&0x4000) +#define LPSLNK(slot) ((slot->udata.data[0x5]>>0x0)&0x4000) #define KRS(slot) ((slot->udata.data[0x5]>>0xA)&0x000F) #define DL(slot) ((slot->udata.data[0x5]>>0x5)&0x001F) #define RR(slot) ((slot->udata.data[0x5]>>0x0)&0x001F) -#define STWINH(slot) ((slot->udata.data[0x6]>>0x0)&0x0200) +#define STWINH(slot) ((slot->udata.data[0x6]>>0x0)&0x0200) #define SDIR(slot) ((slot->udata.data[0x6]>>0x0)&0x0100) #define TL(slot) ((slot->udata.data[0x6]>>0x0)&0x00FF) @@ -86,9 +89,9 @@ #define LFORE(slot) ((slot->udata.data[0x9]>>0x0)&0x8000) #define LFOF(slot) ((slot->udata.data[0x9]>>0xA)&0x001F) -#define PLFOWS(slot) ((slot->udata.data[0x9]>>0x8)&0x0003) +#define PLFOWS(slot) ((slot->udata.data[0x9]>>0x8)&0x0003) #define PLFOS(slot) ((slot->udata.data[0x9]>>0x5)&0x0007) -#define ALFOWS(slot) ((slot->udata.data[0x9]>>0x3)&0x0003) +#define ALFOWS(slot) ((slot->udata.data[0x9]>>0x3)&0x0003) #define ALFOS(slot) ((slot->udata.data[0x9]>>0x0)&0x0007) #define ISEL(slot) ((slot->udata.data[0xA]>>0x3)&0x000F) @@ -148,7 +151,6 @@ scsp_device::scsp_device(const machine_config &mconfig, const char *tag, device_ device_rom_interface(mconfig, *this, 20, ENDIANNESS_BIG, 16), m_irq_cb(*this), m_main_irq_cb(*this), - m_exts_cb(*this), m_BUFPTR(0), m_Master(0), m_stream(nullptr), @@ -166,25 +168,28 @@ scsp_device::scsp_device(const machine_config &mconfig, const char *tag, device_ m_mcipd(0), m_bufferl(nullptr), m_bufferr(nullptr), + m_exts0(nullptr), + m_exts1(nullptr), m_length(0), m_RBUFDST(nullptr) { - memset(m_RINGBUF, 0, sizeof(m_RINGBUF)); - memset(m_MidiStack, 0, sizeof(m_MidiStack)); - memset(m_LPANTABLE, 0, sizeof(m_LPANTABLE)); - memset(m_RPANTABLE, 0, sizeof(m_RPANTABLE)); - memset(m_TimPris, 0, sizeof(m_TimPris)); - memset(m_ARTABLE, 0, sizeof(m_ARTABLE)); - memset(m_DRTABLE, 0, sizeof(m_DRTABLE)); - memset(m_EG_TABLE, 0, sizeof(m_EG_TABLE)); - memset(m_PLFO_TRI, 0, sizeof(m_PLFO_TRI)); - memset(m_PLFO_SQR, 0, sizeof(m_PLFO_SQR)); - memset(m_PLFO_SAW, 0, sizeof(m_PLFO_SAW)); - memset(m_PLFO_NOI, 0, sizeof(m_PLFO_NOI)); - memset(m_ALFO_TRI, 0, sizeof(m_ALFO_TRI)); - memset(m_ALFO_SQR, 0, sizeof(m_ALFO_SQR)); - memset(m_ALFO_SAW, 0, sizeof(m_ALFO_SAW)); - memset(m_ALFO_NOI, 0, sizeof(m_ALFO_NOI)); + std::fill(std::begin(m_RINGBUF), std::end(m_RINGBUF), 0); + std::fill(std::begin(m_MidiStack), std::end(m_MidiStack), 0); + std::fill(std::begin(m_LPANTABLE), std::end(m_LPANTABLE), 0); + std::fill(std::begin(m_RPANTABLE), std::end(m_RPANTABLE), 0); + std::fill(std::begin(m_TimPris), std::end(m_TimPris), 0); + std::fill(std::begin(m_ARTABLE), std::end(m_ARTABLE), 0); + std::fill(std::begin(m_DRTABLE), std::end(m_DRTABLE), 0); + std::fill(std::begin(m_EG_TABLE), std::end(m_EG_TABLE), 0); + std::fill(std::begin(m_PLFO_TRI), std::end(m_PLFO_TRI), 0); + std::fill(std::begin(m_PLFO_SQR), std::end(m_PLFO_SQR), 0); + std::fill(std::begin(m_PLFO_SAW), std::end(m_PLFO_SAW), 0); + std::fill(std::begin(m_PLFO_NOI), std::end(m_PLFO_NOI), 0); + std::fill(std::begin(m_ALFO_TRI), std::end(m_ALFO_TRI), 0); + std::fill(std::begin(m_ALFO_SQR), std::end(m_ALFO_SQR), 0); + std::fill(std::begin(m_ALFO_SAW), std::end(m_ALFO_SAW), 0); + std::fill(std::begin(m_ALFO_NOI), std::end(m_ALFO_NOI), 0); + std::fill(std::begin(m_ALFO_NOI), std::end(m_ALFO_NOI), 0); memset(m_PSCALES, 0, sizeof(m_PSCALES)); memset(m_ASCALES, 0, sizeof(m_ASCALES)); memset(&m_Slots, 0, sizeof(m_Slots)); @@ -206,11 +211,16 @@ void scsp_device::device_start() // set up the IRQ callbacks m_irq_cb.resolve_safe(); m_main_irq_cb.resolve_safe(); - m_exts_cb.resolve_safe(0); - m_stream = machine().sound().stream_alloc(*this, 0, 2, clock() / 512); + // Stereo output with EXTS0,1 Input (External digital audio output) + m_stream = machine().sound().stream_alloc(*this, 2, 2, clock() / 512); } +//------------------------------------------------- +// device_clock_changed - called if the clock +// changes +//------------------------------------------------- + void scsp_device::device_clock_changed() { m_stream->set_sample_rate(clock() / 512); @@ -227,6 +237,8 @@ void scsp_device::rom_bank_updated() void scsp_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { + m_exts0 = inputs[0]; + m_exts1 = inputs[1]; m_bufferl = outputs[0]; m_bufferr = outputs[1]; m_length = samples; @@ -589,7 +601,7 @@ void scsp_device::init() t=ARTimes[i]; //In ms if(t!=0.0) { - step=(1023*1000.0)/( double(22'579'200 / 512)*t); + step=(1023*1000.0) / (44100.0*t); scale=(double) (1<<EG_SHIFT); m_ARTABLE[i]=(int) (step*scale); } @@ -597,7 +609,7 @@ void scsp_device::init() m_ARTABLE[i]=1024<<EG_SHIFT; t=DRTimes[i]; //In ms - step=(1023*1000.0)/( double(22'579'200 / 512)*t); + step=(1023*1000.0) / (44100.0*t); scale=(double) (1<<EG_SHIFT); m_DRTABLE[i]=(int) (step*scale); } @@ -611,7 +623,6 @@ void scsp_device::init() } LFO_Init(); - // no "pend" m_udata.data[0x20/2] = 0; m_TimCnt[0] = 0xffff; @@ -722,10 +733,10 @@ void scsp_device::UpdateReg(int reg) if ((m_udata.data[0x18/2]&0xff) != 255) { - time = (clock() / 512 / m_TimPris[0]) / (255-(m_udata.data[0x18/2]&0xff)); + time = (clock() / m_TimPris[0]) / (255-(m_udata.data[0x18/2]&0xff)); if (time) { - m_timerA->adjust(attotime::from_hz(time)); + m_timerA->adjust(attotime::from_ticks(512, time)); } } } @@ -741,10 +752,10 @@ void scsp_device::UpdateReg(int reg) if ((m_udata.data[0x1A/2]&0xff) != 255) { - time = (clock() / 512 / m_TimPris[1]) / (255-(m_udata.data[0x1A/2]&0xff)); + time = (clock() / m_TimPris[1]) / (255-(m_udata.data[0x1A/2]&0xff)); if (time) { - m_timerB->adjust(attotime::from_hz(time)); + m_timerB->adjust(attotime::from_ticks(512, time)); } } } @@ -760,10 +771,10 @@ void scsp_device::UpdateReg(int reg) if ((m_udata.data[0x1C/2]&0xff) != 255) { - time = (clock() / 512 / m_TimPris[2]) / (255-(m_udata.data[0x1C/2]&0xff)); + time = (clock() / m_TimPris[2]) / (255-(m_udata.data[0x1C/2]&0xff)); if (time) { - m_timerC->adjust(attotime::from_hz(time)); + m_timerC->adjust(attotime::from_ticks(512, time)); } } } @@ -1043,10 +1054,8 @@ unsigned short scsp_device::r16(unsigned int addr) 004CB4: 4E75 rts */ logerror("SCSP: Reading from EXTS register %08x\n",addr); - if(addr == 0xee0) - v = m_exts_cb(0); - if(addr == 0xee2) - v = m_exts_cb(1); + if(addr<0xEE4) + v = *((unsigned short *) (m_DSP.EXTS+(addr-0xee0)/2)); } } return v; @@ -1216,10 +1225,13 @@ inline int32_t scsp_device::UpdateSlot(SCSP_SLOT *slot) void scsp_device::DoMasterSamples(int nsamples) { stream_sample_t *bufr,*bufl; + stream_sample_t *exts[2]; int sl, s, i; bufr=m_bufferr; bufl=m_bufferl; + exts[0]=m_exts0; + exts[1]=m_exts1; for(s=0;s<nsamples;++s) { @@ -1275,8 +1287,31 @@ void scsp_device::DoMasterSamples(int nsamples) } } - *bufl++ = ICLIP16(smpl>>2); - *bufr++ = ICLIP16(smpr>>2); + for(i=0;i<2;++i) + { + SCSP_SLOT *slot=m_Slots+i+16; // 100217, 100237 EFSDL, EFPAN for EXTS0/1 + if(EFSDL(slot)) + { + m_DSP.EXTS[i] = exts[i][s]; + unsigned short Enc=((EFPAN(slot))<<0x8)|((EFSDL(slot))<<0xd); + smpl+=(m_DSP.EXTS[i]*m_LPANTABLE[Enc])>>SHIFT; + smpr+=(m_DSP.EXTS[i]*m_RPANTABLE[Enc])>>SHIFT; + } + } + + if (DAC18B()) + { + smpl = clip18(smpl); + smpr = clip18(smpr); + } + else + { + smpl = clip16(smpl>>2); + smpr = clip16(smpr>>2); + } + + *bufl++ = smpl; + *bufr++ = smpr; } } @@ -1359,7 +1394,7 @@ void scsp_device::exec_dma() if(m_udata.data[0x1e/2] & 0x10) { popmessage("SCSP DMA IRQ triggered, contact MAMEdev"); - machine().device("audiocpu")->execute().set_input_line(DecodeSCI(SCIDMA),HOLD_LINE); + m_irq_cb(DecodeSCI(SCIDMA), HOLD_LINE); } } @@ -1523,7 +1558,7 @@ signed int scsp_device::ALFO_Step(SCSP_LFO_t *LFO) void scsp_device::LFO_ComputeStep(SCSP_LFO_t *LFO,uint32_t LFOF,uint32_t LFOWS,uint32_t LFOS,int ALFO) { - float step=(float) LFOFreq[LFOF]*256.0f/float(22'579'200 / 512); + float step=(float) LFOFreq[LFOF]*256.0f/44100.0f; LFO->phase_step=(unsigned int) ((float) (1<<LFO_SHIFT)*step); if(ALFO) { diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h index 2dc780fc9e3..94a9162f15c 100644 --- a/src/devices/sound/scsp.h +++ b/src/devices/sound/scsp.h @@ -15,16 +15,6 @@ // driver code indicates should be 4, but sounds distorted then -#define MCFG_SCSP_IRQ_CB(_devcb) \ - downcast<scsp_device &>(*device).set_irq_callback(DEVCB_##_devcb); - -#define MCFG_SCSP_MAIN_IRQ_CB(_devcb) \ - downcast<scsp_device &>(*device).set_main_irq_callback(DEVCB_##_devcb); - -#define MCFG_SCSP_EXTS_CB(_devcb) \ - downcast<scsp_device &>(*device).set_exts_callback(DEVCB_##_devcb); - - class scsp_device : public device_t, public device_sound_interface, public device_rom_interface @@ -32,12 +22,8 @@ class scsp_device : public device_t, public: scsp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 22'579'200); - template <class Object> devcb_base &set_irq_callback(Object &&cb) { return m_irq_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_main_irq_callback(Object &&cb) { return m_main_irq_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_exts_callback(Object &&cb) { return m_exts_cb.set_callback(std::forward<Object>(cb)); } auto irq_cb() { return m_irq_cb.bind(); } auto main_irq_cb() { return m_main_irq_cb.bind(); } - auto exts_cb() { return m_exts_cb.bind(); } // SCSP register access DECLARE_READ16_MEMBER( read ); @@ -106,7 +92,6 @@ private: devcb_write8 m_irq_cb; /* irq callback */ devcb_write_line m_main_irq_cb; - devcb_read16 m_exts_cb; union { @@ -162,6 +147,8 @@ private: stream_sample_t *m_bufferl; stream_sample_t *m_bufferr; + stream_sample_t *m_exts0; + stream_sample_t *m_exts1; int m_length; diff --git a/src/devices/sound/scspdsp.cpp b/src/devices/sound/scspdsp.cpp index 2183c286957..931a334de52 100644 --- a/src/devices/sound/scspdsp.cpp +++ b/src/devices/sound/scspdsp.cpp @@ -162,7 +162,7 @@ void SCSPDSP::Step() else if (IRA <= 0x2F) INPUTS = MIXS[IRA - 0x20] << 4; //MIXS is 20 bit else if (IRA <= 0x31) - INPUTS = 0; + INPUTS = EXTS[IRA - 0x30] << 8; //EXTS is 16 bit else return; diff --git a/src/mame/drivers/coolridr.cpp b/src/mame/drivers/coolridr.cpp index 49721853676..84cf55e8d5d 100644 --- a/src/mame/drivers/coolridr.cpp +++ b/src/mame/drivers/coolridr.cpp @@ -375,8 +375,7 @@ public: bitmap_ind16 m_bg_bitmap; bitmap_ind16 m_bg_bitmap2; - bitmap_ind16 m_screen1_bitmap; - bitmap_ind16 m_screen2_bitmap; + bitmap_ind16 m_screen_bitmap[2]; uint8_t an_mux_data; uint8_t sound_data, sound_fifo; @@ -566,8 +565,8 @@ void coolridr_state::video_start() m_screen->register_screen_bitmap(m_bg_bitmap); m_screen->register_screen_bitmap(m_bg_bitmap2); - m_screen->register_screen_bitmap(m_screen1_bitmap); - m_screen->register_screen_bitmap(m_screen2_bitmap); + m_screen->register_screen_bitmap(m_screen_bitmap[0]); + m_screen->register_screen_bitmap(m_screen_bitmap[1]); m_gfxdecode->set_gfx(m_gfx_index, std::make_unique<gfx_element>(m_palette, h1_tile_layout, m_h1_pcg.get(), 0, 8, 0)); } @@ -898,30 +897,14 @@ uint32_t coolridr_state::screen_update_coolridr(screen_device &screen, bitmap_in m_fadedpals[i] = (r<<10|g<<5|b); } - if (which==0) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - for (int y=0;y<384;y++) - { - uint16_t* linesrc = &m_screen1_bitmap.pix16(y); - uint16_t* linedest = &bitmap.pix16(y); + uint16_t* linesrc = &m_screen_bitmap[which].pix16(y); + uint16_t* linedest = &bitmap.pix16(y); - for (int x=0;x<496;x++) - { - linedest[x] = m_fadedpals[linesrc[x]]; - } - } - } - else - { - for (int y=0;y<384;y++) + for (int x = cliprect.left(); x<= cliprect.right(); x++) { - uint16_t* linesrc = &m_screen2_bitmap.pix16(y); - uint16_t* linedest = &bitmap.pix16(y); - - for (int x=0;x<496;x++) - { - linedest[x] = m_fadedpals[linesrc[x]]; - } + linedest[x] = m_fadedpals[linesrc[x]]; } } @@ -2543,7 +2526,7 @@ WRITE32_MEMBER(coolridr_state::sysh1_fb_data_w) osd_work_queue_wait(m_work_queue[0], osd_ticks_per_second() * 100); // copy our old buffer to the actual screen - copybitmap(m_screen1_bitmap, m_temp_bitmap_sprites, 0, 0, 0, 0, visarea); + copybitmap(m_screen_bitmap[0], m_temp_bitmap_sprites, 0, 0, 0, 0, visarea); @@ -2591,7 +2574,7 @@ WRITE32_MEMBER(coolridr_state::sysh1_fb_data_w) osd_work_queue_wait(m_work_queue[1], osd_ticks_per_second() * 100); // copy our old buffer to the actual screen - copybitmap(m_screen2_bitmap, m_temp_bitmap_sprites2, 0, 0, 0, 0, visarea); + copybitmap(m_screen_bitmap[1], m_temp_bitmap_sprites2, 0, 0, 0, 0, visarea); @@ -3277,14 +3260,14 @@ WRITE_LINE_MEMBER(coolridr_state::scsp2_to_sh1_irq) #define MAIN_CLOCK XTAL(28'636'363) MACHINE_CONFIG_START(coolridr_state::coolridr) - MCFG_DEVICE_ADD("maincpu", SH2, MAIN_CLOCK) // 28 mhz + MCFG_DEVICE_ADD("maincpu", SH2, MAIN_CLOCK) // 28 MHz MCFG_DEVICE_PROGRAM_MAP(system_h1_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", coolridr_state, system_h1_main, "screen", 0, 1) - MCFG_DEVICE_ADD("soundcpu", M68000, 11289600) //256 x 44100 Hz = 11.2896 MHz + MCFG_DEVICE_ADD("soundcpu", M68000, 22579000/2) // 22.579 MHz XTAL / 2 = 11.2895 MHz MCFG_DEVICE_PROGRAM_MAP(system_h1_sound_map) - MCFG_DEVICE_ADD("sub", SH1, 16000000) // SH7032 HD6417032F20!! 16 mhz + MCFG_DEVICE_ADD("sub", SH1, 16000000) // SH7032 HD6417032F20!! 16 MHz MCFG_DEVICE_PROGRAM_MAP(coolridr_submap) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer2", coolridr_state, system_h1_sub, "screen", 0, 1) @@ -3325,18 +3308,18 @@ MACHINE_CONFIG_START(coolridr_state::coolridr) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("scsp1", SCSP) - MCFG_DEVICE_ADDRESS_MAP(0, scsp1_map) - MCFG_SCSP_IRQ_CB(WRITE8(*this, coolridr_state, scsp_irq)) - MCFG_SCSP_MAIN_IRQ_CB(WRITELINE(*this, coolridr_state, scsp1_to_sh1_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(0, "rspeaker", 1.0) - - MCFG_DEVICE_ADD("scsp2", SCSP) - MCFG_DEVICE_ADDRESS_MAP(0, scsp2_map) - MCFG_SCSP_MAIN_IRQ_CB(WRITELINE(*this, coolridr_state, scsp2_to_sh1_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(0, "rspeaker", 1.0) + scsp_device &scsp1(SCSP(config, "scsp1", 22579000)); // 22.579 MHz XTAL + scsp1.set_addrmap(0, &coolridr_state::scsp1_map); + scsp1.irq_cb().set(FUNC(coolridr_state::scsp_irq)); + scsp1.main_irq_cb().set(FUNC(coolridr_state::scsp1_to_sh1_irq)); + scsp1.add_route(0, "lspeaker", 1.0); + scsp1.add_route(1, "rspeaker", 1.0); + + scsp_device &scsp2(SCSP(config, "scsp2", 22579000)); // 22.579 MHz XTAL + scsp1.set_addrmap(0, &coolridr_state::scsp2_map); + scsp2.main_irq_cb().set(FUNC(coolridr_state::scsp2_to_sh1_irq)); + scsp2.add_route(0, "lspeaker", 1.0); + scsp2.add_route(1, "rspeaker", 1.0); MACHINE_CONFIG_END MACHINE_CONFIG_START(coolridr_state::aquastge) diff --git a/src/mame/drivers/model2.cpp b/src/mame/drivers/model2.cpp index 96d3e8d51bc..0f3901a0f8b 100644 --- a/src/mame/drivers/model2.cpp +++ b/src/mame/drivers/model2.cpp @@ -4,7 +4,7 @@ Sega Model 2: i960KB + (5x TGP) or (2x SHARC) or (2x TGPx4) System 24 tilemaps Custom Sega/Lockheed-Martin rasterization hardware - (68000 + YM3834 + 2x MultiPCM) or (68000 + SCSP) + (68000 + YM3438 + 2x MultiPCM) or (68000 + SCSP) Hardware and protection reverse-engineering and general assistance by ElSemi. MAME driver by R. Belmont, Olivier Galibert, ElSemi and Angelo Salese. @@ -2449,17 +2449,17 @@ MACHINE_CONFIG_START(model2_state::model2_screen) MACHINE_CONFIG_END MACHINE_CONFIG_START(model2_state::model2_scsp) - MCFG_DEVICE_ADD("audiocpu", M68000, 12000000) + MCFG_DEVICE_ADD("audiocpu", M68000, 45158000/4) // SCSP Clock / 2 MCFG_DEVICE_PROGRAM_MAP(model2_snd) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("scsp", SCSP) - MCFG_DEVICE_ADDRESS_MAP(0, scsp_map) - MCFG_SCSP_IRQ_CB(WRITE8(*this, model2_state,scsp_irq)) - MCFG_SOUND_ROUTE(0, "lspeaker", 2.0) - MCFG_SOUND_ROUTE(0, "rspeaker", 2.0) + SCSP(config, m_scsp, 45158000/2); // 45.158MHz XTAL at Video board(Model 2A-CRX) + m_scsp->set_addrmap(0, &model2_state::scsp_map); + m_scsp->irq_cb().set(FUNC(model2_state::scsp_irq)); + m_scsp->add_route(0, "lspeaker", 1.0); + m_scsp->add_route(1, "rspeaker", 1.0); I8251(config, m_uart, 8000000); // uPD71051C, clock unknown // m_uart->rxrdy_handler().set(FUNC(model2_state::sound_ready_w)); diff --git a/src/mame/drivers/model3.cpp b/src/mame/drivers/model3.cpp index c57282d0578..57bde9ef2f0 100644 --- a/src/mame/drivers/model3.cpp +++ b/src/mame/drivers/model3.cpp @@ -6023,7 +6023,7 @@ void model3_state::add_cpu_166mhz(machine_config &config) void model3_state::add_base_devices(machine_config &config) { - M68000(config, m_audiocpu, 12000000); + M68000(config, m_audiocpu, 45158000/4); // SCSP Clock / 2 m_audiocpu->set_addrmap(AS_PROGRAM, &model3_state::model3_snd); EEPROM_93C46_16BIT(config, m_eeprom); @@ -6044,16 +6044,16 @@ void model3_state::add_base_devices(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - SCSP(config, m_scsp1); + SCSP(config, m_scsp1, 45158000/2); // 45.158 MHz XTAL m_scsp1->set_addrmap(0, &model3_state::scsp1_map); m_scsp1->irq_cb().set(FUNC(model3_state::scsp_irq)); - m_scsp1->add_route(0, "lspeaker", 2.0); - m_scsp1->add_route(0, "rspeaker", 2.0); + m_scsp1->add_route(0, "lspeaker", 1.0); + m_scsp1->add_route(1, "rspeaker", 1.0); - scsp_device &scsp2(SCSP(config, "scsp2")); + scsp_device &scsp2(SCSP(config, "scsp2", 45158000/2)); scsp2.set_addrmap(0, &model3_state::scsp2_map); - scsp2.add_route(0, "lspeaker", 2.0); - scsp2.add_route(0, "rspeaker", 2.0); + scsp2.add_route(0, "lspeaker", 1.0); + scsp2.add_route(1, "rspeaker", 1.0); } void model3_state::add_scsi_devices(machine_config &config) diff --git a/src/mame/drivers/saturn.cpp b/src/mame/drivers/saturn.cpp index 96df8a13643..5be32daecd8 100644 --- a/src/mame/drivers/saturn.cpp +++ b/src/mame/drivers/saturn.cpp @@ -846,17 +846,16 @@ MACHINE_CONFIG_START(sat_console_state::saturn) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD(m_scsp, SCSP) - MCFG_DEVICE_ADDRESS_MAP(0, scsp_mem) - MCFG_SCSP_IRQ_CB(WRITE8(*this, saturn_state, scsp_irq)) - MCFG_SCSP_MAIN_IRQ_CB(WRITELINE(m_scu, sega_scu_device, sound_req_w)) - MCFG_SCSP_EXTS_CB(READ16("stvcd", stvcd_device, channel_volume_r)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + SCSP(config, m_scsp, 8467200*8/3); // 8.4672 MHz EXTCLK * 8 / 3 = 22.5792 MHz + m_scsp->set_addrmap(0, &sat_console_state::scsp_mem); + m_scsp->irq_cb().set(FUNC(saturn_state::scsp_irq)); + m_scsp->main_irq_cb().set(m_scu, FUNC(sega_scu_device::sound_req_w)); + m_scsp->add_route(0, "lspeaker", 1.0); + m_scsp->add_route(1, "rspeaker", 1.0); MCFG_DEVICE_ADD("stvcd", STVCD, 0) - //MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - //MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + MCFG_SOUND_ROUTE(0, "scsp", 1.0, 0) + MCFG_SOUND_ROUTE(1, "scsp", 1.0, 1) MCFG_SATURN_CONTROL_PORT_ADD("ctrl1", saturn_controls, "joypad") MCFG_SATURN_CONTROL_PORT_ADD("ctrl2", saturn_controls, "joypad") diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index f77c3014c4e..9a0b476484e 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -1176,12 +1176,12 @@ MACHINE_CONFIG_START(stv_state::stv) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("scsp", SCSP) - MCFG_DEVICE_ADDRESS_MAP(0, scsp_mem) - MCFG_SCSP_IRQ_CB(WRITE8(*this, saturn_state, scsp_irq)) - MCFG_SCSP_MAIN_IRQ_CB(WRITELINE("scu", sega_scu_device, sound_req_w)) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + SCSP(config, m_scsp, 22579200); // TODO : Unknown clock, divider + m_scsp->set_addrmap(0, &stv_state::scsp_mem); + m_scsp->irq_cb().set(FUNC(saturn_state::scsp_irq)); + m_scsp->main_irq_cb().set(m_scu, FUNC(sega_scu_device::sound_req_w)); + m_scsp->add_route(0, "lspeaker", 1.0); + m_scsp->add_route(1, "rspeaker", 1.0); MACHINE_CONFIG_END MACHINE_CONFIG_START(stv_state::stv_5881) @@ -1199,11 +1199,8 @@ MACHINE_CONFIG_START(stv_state::stvcd) MCFG_DEVICE_PROGRAM_MAP(stvcd_mem) MCFG_DEVICE_ADD("stvcd", STVCD, 0) - //MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - //MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - - MCFG_DEVICE_MODIFY("scsp") - MCFG_SCSP_EXTS_CB(READ16("stvcd", stvcd_device, channel_volume_r)) + MCFG_SOUND_ROUTE(0, "scsp", 1.0, 0) + MCFG_SOUND_ROUTE(1, "scsp", 1.0, 1) MACHINE_CONFIG_END |