Skip to content

Commit

Permalink
Fixes/ROMs for Roland stuff (#12555)
Browse files Browse the repository at this point in the history
* Fixed screen

* Added ROMs and GP/LP support

* Fixed rom and prints

* Leftover

* Fix
  • Loading branch information
giulioz authored Jul 8, 2024
1 parent 0a51009 commit 81284c6
Show file tree
Hide file tree
Showing 13 changed files with 286 additions and 33 deletions.
22 changes: 17 additions & 5 deletions scripts/src/sound.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1624,14 +1624,26 @@ if (SOUNDS["XT446"]~=null) then
end

---------------------------------------------------
-- Roland sample players
--@src/devices/sound/rolandpcm.h,SOUNDS["ROLANDPCM"] = true
-- Roland LP-based sample players
--@src/devices/sound/roland_lp.h,SOUNDS["ROLANDLP"] = true
---------------------------------------------------

if (SOUNDS["ROLANDPCM"]~=null) then
if (SOUNDS["ROLANDLP"]~=null) then
files {
MAME_DIR .. "src/devices/sound/rolandpcm.cpp",
MAME_DIR .. "src/devices/sound/rolandpcm.h",
MAME_DIR .. "src/devices/sound/roland_lp.cpp",
MAME_DIR .. "src/devices/sound/roland_lp.h",
}
end

---------------------------------------------------
-- Roland GP-based sample players
--@src/devices/sound/roland_gp.h,SOUNDS["ROLANDGP"] = true
---------------------------------------------------

if (SOUNDS["ROLANDGP"]~=null) then
files {
MAME_DIR .. "src/devices/sound/roland_gp.cpp",
MAME_DIR .. "src/devices/sound/roland_gp.h",
}
end

Expand Down
78 changes: 78 additions & 0 deletions src/devices/sound/roland_gp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// license:BSD-3-Clause
// copyright-holders:giulioz

// Initial skeleton based on the RE work by nukeykt

#include "emu.h"
#include "roland_gp.h"

// Original chip (GP-2) TODO
// DEFINE_DEVICE_TYPE(TC24SC201AF, tc6116_device, "tc24sc201af", "Roland GP TC24SC201AF PCM")

// Newer chip (GP-4) including bugfixes and H8/500 cpu glue logic
DEFINE_DEVICE_TYPE(TC6116, tc6116_device, "tc6116", "Roland GP TC6116 PCM")


tc6116_device::tc6116_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TC6116, tag, owner, clock)
, device_sound_interface(mconfig, *this)
, device_rom_interface(mconfig, *this)
, m_int_callback(*this)
, m_clock(0)
, m_rate(0)
, m_stream(nullptr)
, m_sel_chn(0)
{
}

//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------

void tc6116_device::device_start()
{
m_clock = clock() / 2;
m_rate = m_clock / 512; // usually 32 KHz

m_stream = stream_alloc(0, 2, m_rate);

logerror("Roland GP: Clock %u, Rate %u\n", m_clock, m_rate);
}

//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------

void tc6116_device::device_reset()
{
m_int_callback(CLEAR_LINE);
}

//-------------------------------------------------
// rom_bank_pre_change - refresh the stream if the
// ROM banking changes
//-------------------------------------------------

void tc6116_device::rom_bank_pre_change()
{
// unused right now
m_stream->update();
}


u8 tc6116_device::read(offs_t offset)
{
return 0xff;
}

void tc6116_device::write(offs_t offset, u8 data)
{
}

//-------------------------------------------------
// sound_stream_update - handle a stream update
//-------------------------------------------------

void tc6116_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
}
84 changes: 84 additions & 0 deletions src/devices/sound/roland_gp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// license:BSD-3-Clause
// copyright-holders:giulioz
#ifndef MAME_SOUND_ROLANDGP_H
#define MAME_SOUND_ROLANDGP_H

#pragma once

#include "dirom.h"

class tc6116_device : public device_t, public device_sound_interface, public device_rom_interface<23>
{
public:
tc6116_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_t implementation
virtual void device_start() override;
virtual void device_reset() override;

// device_sound_interface implementation
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;

// device_rom_interface implementation
virtual void rom_bank_pre_change() override;

private:
static constexpr unsigned NUM_CHANNELS = 28;

struct pcm_channel
{
pcm_channel() { }

// registers
uint8_t pitch_coarse;
uint8_t pitch_fine;
uint8_t pan_l;
uint8_t pan_r;
uint8_t rev_send;
uint8_t chorus_send;
uint8_t volume1;
uint8_t volume1_speed;
uint8_t volume2;
uint8_t volume2_speed;
uint8_t cutoff;
uint8_t cutoff_speed;

bool irq_enable; // 0
bool filter_mode; // 1 (0:lpf, 1:hpf)
uint8_t resonance_flags; // 8-15

uint8_t sub_phase_addr; // 0-4
bool key; // 5
bool alt_loop; // 6
bool reverse_play; // 7
uint8_t hiaddr; // 8-11
uint8_t nibble; // 2-15

// work variables
uint16_t sub_phase_state; // 0-13
bool irq_disable; // 14
bool alt_loop_state; // 15

uint16_t volume1_tv;
uint16_t volume2_tv;
uint16_t cutoff_tv;
};

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
pcm_channel m_chns[NUM_CHANNELS]; // channel memory
[[maybe_unused]] uint8_t m_sel_chn; // selected channel
};

DECLARE_DEVICE_TYPE(TC6116, tc6116_device)

#endif // MAME_SOUND_ROLANDGP_H
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
// 02/03 - ?? (read after writing to 10/12)

#include "emu.h"
#include "rolandpcm.h"
#include "roland_lp.h"


DEFINE_DEVICE_TYPE(MB87419_MB87420, mb87419_mb87420_device, "mb87419_mb87420", "Roland MB87419/MB87420 PCM")
DEFINE_DEVICE_TYPE(MB87419_MB87420, mb87419_mb87420_device, "mb87419_mb87420", "Roland LP MB87419/MB87420 PCM")

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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Valley Bell
#ifndef MAME_SOUND_ROLANDPCM_H
#define MAME_SOUND_ROLANDPCM_H
#ifndef MAME_SOUND_ROLANDLP_H
#define MAME_SOUND_ROLANDLP_H

#pragma once

Expand Down Expand Up @@ -66,4 +66,4 @@ class mb87419_mb87420_device : public device_t, public device_sound_interface, p

DECLARE_DEVICE_TYPE(MB87419_MB87420, mb87419_mb87420_device)

#endif // MAME_SOUND_ROLANDPCM_H
#endif // MAME_SOUND_ROLANDLP_H
17 changes: 13 additions & 4 deletions src/devices/video/t6963c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
Toshiba T6963C Dot Matrix LCD Controller
Sharp LM24014H Dot Matrix LCD Unit
TODO:
- cursor
- screen peek
- screen copy
- auto read mode
**********************************************************************/

#include "emu.h"
Expand Down Expand Up @@ -51,6 +57,7 @@ t6963c_device::t6963c_device(const machine_config &mconfig, const char *tag, dev
, m_font_size(6)
, m_number_cols(40)
, m_number_lines(8)
, m_read_data(0)
{
}

Expand Down Expand Up @@ -89,6 +96,7 @@ void t6963c_device::device_start()
save_item(NAME(m_font_size));
save_item(NAME(m_number_cols));
save_item(NAME(m_number_lines));
save_item(NAME(m_read_data));
}


Expand Down Expand Up @@ -117,7 +125,7 @@ void t6963c_device::device_reset()

u8 t6963c_device::read(offs_t offset)
{
return BIT(offset, 0) ? 0x2b : 0x00;
return BIT(offset, 0) ? 0x2b : m_read_data;
}


Expand Down Expand Up @@ -219,7 +227,7 @@ void t6963c_device::do_command(u8 cmd)
if (cmd == 0x90)
LOG("%s: Display off\n", machine().describe_context());
else
LOG("%s: Text %s, graphic %s, cursor %s, blink %s\n",
LOG("%s: Graphic %s, text %s, cursor %s, blink %s\n",
machine().describe_context(),
BIT(cmd, 3) ? "on" : "off",
BIT(cmd, 2) ? "on" : "off",
Expand Down Expand Up @@ -251,6 +259,7 @@ void t6963c_device::do_command(u8 cmd)
: (cmd & 0x0e) == 0x02 ? "decrement"
: (cmd & 0x0e) == 0x04 ? "nonvariable"
: "invalid");
m_read_data = m_display_ram->read_byte(m_adp);
}
else
{
Expand Down Expand Up @@ -327,7 +336,7 @@ uint32_t t6963c_device::screen_update(screen_device &screen, bitmap_ind16 &bitma
bitmap.fill(0, cliprect);

// Text layer
if (BIT(m_display_mode, 3))
if (BIT(m_display_mode, 2))
{
offs = m_text_home;
for(int y=0; y<m_number_lines; y++)
Expand All @@ -354,7 +363,7 @@ uint32_t t6963c_device::screen_update(screen_device &screen, bitmap_ind16 &bitma
}
}
// Graphic layer
if (BIT(m_display_mode, 2))
if (BIT(m_display_mode, 3))
{
offs = m_graphic_home;
for(int y=0; y<m_number_lines*8; y++)
Expand Down
1 change: 1 addition & 0 deletions src/devices/video/t6963c.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class t6963c_device : public device_t, public device_memory_interface
u8 m_font_size;
u8 m_number_cols;
u8 m_number_lines;
u8 m_read_data;
};

// ======================> lm24014h_device
Expand Down
2 changes: 1 addition & 1 deletion src/mame/roland/roland_cm32p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Some routine locations
#include "cpu/mcs96/i8x9x.h"
#include "machine/ram.h"
#include "machine/timer.h"
#include "sound/rolandpcm.h"
#include "sound/roland_lp.h"
#include "video/msm6222b.h"
#include "bus/generic/slot.h"
#include "bus/generic/carts.h"
Expand Down
2 changes: 1 addition & 1 deletion src/mame/roland/roland_d50.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ ROM_START(d50) // Newer PCB with silkscreen "Roland || D-50, D-550 || MAIN BOARD
// missing 2.00

ROM_REGION(0x2000, "maincpu", 0)
ROM_LOAD("d78312g-022_15179266.ic25", 0x0000, 0x2000, NO_DUMP) // 8-digit Roland part number not printed on IC
ROM_LOAD("d78312g-022_15179266.ic25", 0x0000, 0x2000, CRC(9564903f) SHA1(f68ed97a06764ee000fe6e9d7b39017165f0efc4)) // 8-digit Roland part number not printed on IC
ROM_COPY("progrom", 0x0000, 0x0000, 0x2000)

ROM_REGION(0x80000, "pcm", 0)
Expand Down
14 changes: 7 additions & 7 deletions src/mame/roland/roland_d70.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "cpu/mcs96/i8x9x.h"
#include "cpu/mcs96/i8xc196.h"
#include "machine/timer.h"
#include "sound/rolandpcm.h"
#include "sound/roland_lp.h"
#include "video/t6963c.h"

#include "emupal.h"
Expand Down Expand Up @@ -352,12 +352,12 @@ void roland_d70_state::dsp_io_w(offs_t offset, u8 data) {
}

u8 roland_d70_state::tvf_io_r(offs_t offset) {
logerror("tvf read %x\n", offset);
logerror("tvf read %04x\n", offset);
return 0;
}

void roland_d70_state::tvf_io_w(offs_t offset, u8 data) {
logerror("twf write $x= %x\n", offset, data);
logerror("tvf write %04x= %02x\n", offset, data);
}

u8 roland_d70_state::snd_io_r(offs_t offset) {
Expand Down Expand Up @@ -494,11 +494,11 @@ void roland_d70_state::init_d70() {
u8 *dst = reinterpret_cast<u8 *>(memregion("pcm")->base());
// descramble internal ROMs
descramble_rom_internal(&dst[0x000000], &src[0x000000]);
descramble_rom_internal(&dst[0x080000], &src[0x080000]);
descramble_rom_internal(&dst[0x100000], &src[0x100000]);
descramble_rom_internal(&dst[0x180000], &src[0x180000]);
descramble_rom_internal(&dst[0x200000], &src[0x200000]);
descramble_rom_internal(&dst[0x300000], &src[0x300000]);
descramble_rom_internal(&dst[0x400000], &src[0x400000]);
descramble_rom_internal(&dst[0x500000], &src[0x500000]);
}

void roland_d70_state::descramble_rom_internal(u8 *dst, const u8 *src) {
Expand All @@ -515,11 +515,11 @@ ROM_START(d70)

ROM_REGION(0x600000, "pcmorg", 0) // ROMs before descrambling
ROM_LOAD("roland_d70_waverom-a.bin", 0x000000, 0x80000, CRC(8e53b2a3) SHA1(4872530870d5079776e80e477febe425dc0ec1df))
ROM_LOAD("roland_d70_waverom-e.bin", 0x080000, 0x80000, CRC(d46cc7a4) SHA1(d378ac89a5963e37f7c157b3c8e71892c334fd7b))
ROM_LOAD("roland_d70_waverom-b.bin", 0x100000, 0x80000, CRC(c8220761) SHA1(49e55fa672020f95fd9c858ceaae94d6db93df7d))
ROM_LOAD("roland_d70_waverom-f.bin", 0x180000, 0x80000, CRC(d4b01f5e) SHA1(acd867d68e49e5f59f1006ed14a7ca197b6dc4af))
ROM_LOAD("roland_d70_waverom-c.bin", 0x200000, 0x80000, CRC(733c4054) SHA1(9b6b59ab74e5bf838702abb087c408aaa85b7b1f))
ROM_LOAD("roland_d70_waverom-d.bin", 0x300000, 0x80000, CRC(b6c662d2) SHA1(3fcbcfd0d8d0fa419c710304c12482e2f79a907f))
ROM_LOAD("roland_d70_waverom-e.bin", 0x400000, 0x80000, CRC(d46cc7a4) SHA1(d378ac89a5963e37f7c157b3c8e71892c334fd7b))
ROM_LOAD("roland_d70_waverom-f.bin", 0x500000, 0x80000, CRC(d4b01f5e) SHA1(acd867d68e49e5f59f1006ed14a7ca197b6dc4af))
ROM_REGION(0x600000, "pcm", ROMREGION_ERASEFF) // ROMs after descrambling

ROM_REGION(0x400, "lcd:cgrom", 0)
Expand Down
Loading

0 comments on commit 81284c6

Please sign in to comment.