diff --git a/src/devices/sound/rolandpcm.cpp b/src/devices/sound/rolandpcm.cpp index e9706e8d0ea..af79f20f9aa 100644 --- a/src/devices/sound/rolandpcm.cpp +++ b/src/devices/sound/rolandpcm.cpp @@ -27,12 +27,13 @@ constexpr int clamp16(int16_t val, int16_t min, int16_t max) { return std::min(max, std::max(min, val)); } -DEFINE_DEVICE_TYPE(ROLANDPCM, rolandpcm_device, "rolandpcm", "Roland PCM") +DEFINE_DEVICE_TYPE(MB87419_MB87420, mb87419_mb87420_device, "mb87419_mb87420", "Roland MB87419/MB87420 PCM") -rolandpcm_device::rolandpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ROLANDPCM, tag, owner, clock) +mb87419_mb87420_device::mb87419_mb87420_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, MB87419_MB87420, tag, owner, clock) , device_sound_interface(mconfig, *this) , device_rom_interface(mconfig, *this, 22) + , m_int_callback(*this) , m_clock(0) , m_rate(0) , m_stream(nullptr) @@ -40,13 +41,24 @@ rolandpcm_device::rolandpcm_device(const machine_config &mconfig, const char *ta { } +//------------------------------------------------- +// device_resolve_objects - resolve objects that +// may be needed for other devices to set +// initial conditions at start time +//------------------------------------------------- + +void mb87419_mb87420_device::device_resolve_objects() +{ + m_int_callback.resolve_safe(); +} + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- -void rolandpcm_device::device_start() +void mb87419_mb87420_device::device_start() { - m_clock = clock(); + m_clock = clock() / 2; m_rate = m_clock / 512; // usually 32 KHz m_stream = machine().sound().stream_alloc(*this, 0, 2, m_rate); @@ -54,18 +66,27 @@ void rolandpcm_device::device_start() logerror("Roland PCM: Clock %u, Rate %u\n", m_clock, m_rate); } +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mb87419_mb87420_device::device_reset() +{ + m_int_callback(CLEAR_LINE); +} + //------------------------------------------------- // rom_bank_updated - the rom bank has changed //------------------------------------------------- -void rolandpcm_device::rom_bank_updated() +void mb87419_mb87420_device::rom_bank_updated() { // unused right now m_stream->update(); } -u8 rolandpcm_device::read(offs_t offset) +u8 mb87419_mb87420_device::read(offs_t offset) { // Note: only offset 0x01 is verified, the rest is probably all wrong if (offset != 0x01) @@ -137,7 +158,7 @@ u8 rolandpcm_device::read(offs_t offset) return 0x00; } -void rolandpcm_device::write(offs_t offset, u8 data) +void mb87419_mb87420_device::write(offs_t offset, u8 data) { logerror("Reg %02X = %02X\n", offset, data); if (offset < 0x10) @@ -248,7 +269,7 @@ void rolandpcm_device::write(offs_t offset, u8 data) // sound_stream_update - handle a stream update //------------------------------------------------- -void rolandpcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +void mb87419_mb87420_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { memset(outputs[0], 0, samples * sizeof(stream_sample_t)); memset(outputs[1], 0, samples * sizeof(stream_sample_t)); @@ -340,7 +361,7 @@ void rolandpcm_device::sound_stream_update(sound_stream &stream, stream_sample_t return; } -int16_t rolandpcm_device::decode_sample(int8_t data) +int16_t mb87419_mb87420_device::decode_sample(int8_t data) { int16_t val; int16_t sign; @@ -368,7 +389,7 @@ int16_t rolandpcm_device::decode_sample(int8_t data) return result * sign; } -int16_t rolandpcm_device::sample_interpolate(int16_t smp1, int16_t smp2, uint16_t frac) +int16_t mb87419_mb87420_device::sample_interpolate(int16_t smp1, int16_t smp2, uint16_t frac) { int32_t smpfrac0 = (int32_t)smp1 * (0x4000 - frac); int32_t smpfrac1 = (int32_t)smp2 * frac; diff --git a/src/devices/sound/rolandpcm.h b/src/devices/sound/rolandpcm.h index 1390fb95185..08815f398e7 100644 --- a/src/devices/sound/rolandpcm.h +++ b/src/devices/sound/rolandpcm.h @@ -5,17 +5,21 @@ #pragma once -class rolandpcm_device : public device_t, public device_sound_interface, public device_rom_interface +class mb87419_mb87420_device : public device_t, public device_sound_interface, public device_rom_interface { public: - rolandpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + mb87419_mb87420_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + auto int_callback() { return m_int_callback.bind(); } u8 read(offs_t offset); void write(offs_t offset, u8 data); protected: // device-level overrides + virtual void device_resolve_objects() override; virtual void device_start() override; + virtual void device_reset() override; // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; @@ -49,6 +53,8 @@ private: int16_t smpl_nxt = 0; // next sample }; + devcb_write_line m_int_callback; + uint32_t m_clock; // clock uint32_t m_rate; // sample rate (usually 32000 Hz) sound_stream* m_stream; // stream handle @@ -56,6 +62,6 @@ private: uint8_t m_sel_chn; // selected channel }; -DECLARE_DEVICE_TYPE(ROLANDPCM, rolandpcm_device) +DECLARE_DEVICE_TYPE(MB87419_MB87420, mb87419_mb87420_device) #endif // MAME_SOUND_ROLANDPCM_H diff --git a/src/mame/drivers/roland_cm32p.cpp b/src/mame/drivers/roland_cm32p.cpp index 0c3668decc4..cdf95207816 100644 --- a/src/mame/drivers/roland_cm32p.cpp +++ b/src/mame/drivers/roland_cm32p.cpp @@ -114,7 +114,7 @@ Parts: | CN4 | unpopulated | | CN5 | PCM Card Slot | | X1 | Crystal 12MHz | -| X2 | Crystal 32.768KHz | +| X2 | Crystal 32.768MHz | |-----------------------------------------------------------------------| @@ -282,7 +282,7 @@ protected: private: required_device cpu; - required_device pcm; + required_device pcm; required_device lcd; required_device midi_timer; required_device some_ram; @@ -553,7 +553,8 @@ void cm32p_state::cm32p(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - ROLANDPCM(config, pcm, 16.384_MHz_XTAL); + MB87419_MB87420(config, pcm, 32.768_MHz_XTAL); + //pcm->int_callback().set_inputline(cpu, i8x9x_device::EXTINT_LINE); pcm->add_route(0, "lspeaker", 1.0); pcm->add_route(1, "rspeaker", 1.0); @@ -604,4 +605,4 @@ ROM_START( cm32p ) ROM_REGION( 0x400000, "pcm", ROMREGION_ERASEFF ) // ROMs after descrambling ROM_END -CONS( 1989, cm32p, 0, 0, cm32p, cm32p, cm32p_state, init_cm32p, "Roland", "CM-32P", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +SYST( 1989, cm32p, 0, 0, cm32p, cm32p, cm32p_state, init_cm32p, "Roland", "CM-32P", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/drivers/roland_r8.cpp b/src/mame/drivers/roland_r8.cpp index dec47dfda8d..6792e7928db 100644 --- a/src/mame/drivers/roland_r8.cpp +++ b/src/mame/drivers/roland_r8.cpp @@ -8,6 +8,8 @@ #include "emu.h" #include "cpu/upd78k/upd78k2.h" +#include "sound/rolandpcm.h" +#include "speaker.h" class roland_r8_state : public driver_device { @@ -15,6 +17,7 @@ public: roland_r8_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_pcm(*this, "pcm") { } @@ -25,6 +28,7 @@ private: void mem_map(address_map &map); required_device m_maincpu; + required_device m_pcm; }; @@ -42,12 +46,30 @@ void roland_r8_state::r8(machine_config &config) { UPD78210(config, m_maincpu, 12_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &roland_r8_state::mem_map); + + SPEAKER(config, "lspeaker").front_left(); + SPEAKER(config, "rspeaker").front_right(); + + MB87419_MB87420(config, m_pcm, 33.8688_MHz_XTAL); + //m_pcm->int_callback().set_inputline(m_maincpu, upd78k2_device::INTP1_LINE); + m_pcm->set_device_rom_tag("wavedata"); + m_pcm->add_route(0, "lspeaker", 1.0); + m_pcm->add_route(1, "rspeaker", 1.0); } void roland_r8_state::r8mk2(machine_config &config) { UPD78213(config, m_maincpu, 12_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &roland_r8_state::mem_map); + + SPEAKER(config, "lspeaker").front_left(); + SPEAKER(config, "rspeaker").front_right(); + + MB87419_MB87420(config, m_pcm, 33.8688_MHz_XTAL); + //m_pcm->int_callback().set_inputline(m_maincpu, upd78k2_device::INTP1_LINE); + m_pcm->set_device_rom_tag("wavedata"); + m_pcm->add_route(0, "lspeaker", 1.0); + m_pcm->add_route(1, "rspeaker", 1.0); } @@ -55,24 +77,28 @@ ROM_START(r8) ROM_REGION(0x20000, "maincpu", 0) ROM_LOAD("roland r-8_2.02_27c010.bin", 0x00000, 0x20000, CRC(45d0f64f) SHA1(55f0831db74cbdeae20cd7f1ff28af27dafba9b9)) - ROM_REGION(0x100000, "wavedata", 0) - ROM_LOAD("mn234000rle.ic30", 0x000000, 0x080000, NO_DUMP) - ROM_LOAD("mn234000rlf.ic31", 0x080000, 0x080000, NO_DUMP) + ROM_REGION(0x100000, "wavedata", ROMREGION_ERASE00) + ROM_LOAD("r15179929-mn234000rle.ic30", 0x000000, 0x080000, NO_DUMP) + ROM_LOAD("r15179930-mn234000rlf.ic31", 0x080000, 0x080000, NO_DUMP) ROM_END ROM_START(r8m) ROM_REGION(0x20000, "maincpu", 0) ROM_LOAD("rolandr8mv104.bin", 0x00000, 0x20000, CRC(5e95e2f6) SHA1(b4e1a8f15f72a9db9aa8fd41ee3c3ebd10460587)) + + ROM_REGION(0x100000, "wavedata", ROMREGION_ERASE00) // same ROMs as R-8 assumed + ROM_LOAD("r15179929-mn234000rle.bin", 0x000000, 0x080000, NO_DUMP) + ROM_LOAD("r15179930-mn234000rlf.bin", 0x080000, 0x080000, NO_DUMP) ROM_END ROM_START(r8mk2) ROM_REGION(0x20000, "maincpu", 0) ROM_LOAD("roland r8 mkii eprom v1.0.3.bin", 0x00000, 0x20000, CRC(128a9a0c) SHA1(94bd8c76efe270754219f2899f31b62fc4f9060d)) - ROM_REGION(0x180000, "wavedata", 0) - ROM_LOAD("upd27c8001eacz-025.ic30", 0x000000, 0x080000, NO_DUMP) - ROM_LOAD("upd27c8001eacz-026.ic31", 0x080000, 0x080000, NO_DUMP) - ROM_LOAD("upd27c8001eacz-027.ic82", 0x100000, 0x080000, NO_DUMP) + ROM_REGION(0x200000, "wavedata", ROMREGION_ERASE00) + ROM_LOAD("r15209440-upd27c8001eacz-025.ic30", 0x000000, 0x080000, NO_DUMP) + ROM_LOAD("r15209441-upd27c8001eacz-026.ic31", 0x080000, 0x080000, NO_DUMP) + ROM_LOAD("r15209442-upd27c8001eacz-027.ic82", 0x100000, 0x080000, NO_DUMP) ROM_END diff --git a/src/mame/drivers/roland_u20.cpp b/src/mame/drivers/roland_u20.cpp index e929bb36719..007b4bb58a1 100644 --- a/src/mame/drivers/roland_u20.cpp +++ b/src/mame/drivers/roland_u20.cpp @@ -8,6 +8,8 @@ #include "emu.h" #include "cpu/mcs96/i8x9x.h" +#include "sound/rolandpcm.h" +#include "speaker.h" class roland_u20_state : public driver_device { @@ -15,15 +17,18 @@ public: roland_u20_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_pcm(*this, "pcm") { } void u20(machine_config &config); + void u220(machine_config &config); private: void mem_map(address_map &map); required_device m_maincpu; + required_device m_pcm; }; @@ -43,7 +48,22 @@ void roland_u20_state::u20(machine_config &config) //R15239124(config, "keyscan", 12_MHz_XTAL); - //MB87419(config, "pcm", 32.768_MHz_XTAL); + SPEAKER(config, "lspeaker").front_left(); + SPEAKER(config, "rspeaker").front_right(); + + MB87419_MB87420(config, m_pcm, 32.768_MHz_XTAL); + //m_pcm->int_callback().set_inputline(m_maincpu, i8x9x_device::EXTINT_LINE); + m_pcm->set_device_rom_tag("waverom"); + m_pcm->add_route(0, "lspeaker", 1.0); + m_pcm->add_route(1, "rspeaker", 1.0); +} + +void roland_u20_state::u220(machine_config &config) +{ + u20(config); + + //config.device_remove("keyscan"); + //m_pcm->int_callback().set_inputline(m_maincpu, i8x9x_device::HSI0_LINE); } ROM_START(u20) @@ -53,7 +73,7 @@ ROM_START(u20) ROM_SYSTEM_BIOS(1, "v103", "Version 1.03") ROMX_LOAD("u-20-v103.bin", 0x00000, 0x20000, CRC(eb94054f) SHA1(1127e21ba94cc629eb00355c0be6ace6ca7759d6), ROM_BIOS(1)) // M5M27C100P - ROM_REGION(0x300000, "waverom", 0) + ROM_REGION(0x400000, "waverom", ROMREGION_ERASE00) ROM_LOAD("roland-a_r15179892f_mb834000a-20_226-aa.ic27", 0x000000, 0x080000, NO_DUMP) ROM_LOAD("roland-b_r15179893f_mb834000a-20_227-aa.ic28", 0x080000, 0x080000, NO_DUMP) ROM_LOAD("roland-c_r15179894f_mb834000a-20_228-aa.ic29", 0x100000, 0x080000, NO_DUMP) @@ -69,7 +89,7 @@ ROM_START(u220) ROM_SYSTEM_BIOS(1, "v101", "Version 1.01") ROMX_LOAD("u-220_roland_1-0-1.ic8", 0x00000, 0x20000, CRC(893afa9c) SHA1(d0b66c0ea0e3af284a1806226aed79d8da2f3dd4), ROM_BIOS(1)) // HN27C101G-20 - ROM_REGION(0x300000, "waverom", 0) + ROM_REGION(0x400000, "waverom", ROMREGION_ERASE00) ROM_LOAD("roland-a_r15179892f_mb834000a-20_226-aa.ic19", 0x000000, 0x080000, NO_DUMP) ROM_LOAD("roland-b_r15179893f_mb834000a-20_227-aa.ic20", 0x080000, 0x080000, NO_DUMP) ROM_LOAD("roland-c_r15179894f_mb834000a-20_228-aa.ic21", 0x100000, 0x080000, NO_DUMP) @@ -78,5 +98,5 @@ ROM_START(u220) ROM_LOAD("roland-f_r15179948_mb834000a-20_3a2-aa.ic24", 0x280000, 0x080000, NO_DUMP) ROM_END -SYST(1989, u20, 0, 0, u20, u20, roland_u20_state, empty_init, "Roland", "U-20 RS-PCM Keyboard", MACHINE_IS_SKELETON) -SYST(1989, u220, 0, 0, u20, u20, roland_u20_state, empty_init, "Roland", "U-220 RS-PCM Sound Module", MACHINE_IS_SKELETON) +SYST(1989, u20, 0, 0, u20, u20, roland_u20_state, empty_init, "Roland", "U-20 RS-PCM Keyboard", MACHINE_IS_SKELETON) +SYST(1989, u220, 0, 0, u220, u20, roland_u20_state, empty_init, "Roland", "U-220 RS-PCM Sound Module", MACHINE_IS_SKELETON)