summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2021-06-05 11:24:50 -0700
committer Aaron Giles <aaron@aarongiles.com>2021-06-05 11:24:50 -0700
commitd3397e05d67f8668a40b5541b0e7141e31235f34 (patch)
treec26ea137803eb3b7e6462ca48a373526f393ea88
parent9bce41a5ed3d253fea11d7965aa691d9f620c420 (diff)
ym2154: Decode real sample data, which is ulaw-ish.
ympsr60: Update to use real ROM data.
-rw-r--r--src/devices/sound/ym2154.cpp18
-rw-r--r--src/mame/drivers/ympsr60.cpp8
2 files changed, 17 insertions, 9 deletions
diff --git a/src/devices/sound/ym2154.cpp b/src/devices/sound/ym2154.cpp
index 2ad1bbac1fa..83613506833 100644
--- a/src/devices/sound/ym2154.cpp
+++ b/src/devices/sound/ym2154.cpp
@@ -284,13 +284,21 @@ void ym2154_device::sound_stream_update(sound_stream &stream, std::vector<read_s
rvol += 4 * (7 - channel.m_panpot);
rvol = voltable[rvol & 7] >> (rvol >> 3);
+ auto &source = space(chan / 6);
for (int sampindex = 0; sampindex < outl.samples() && (channel.m_pos >> ADDR_SHIFT) <= channel.m_end; sampindex++)
{
- // unsure what the real data is; for now guessing 8-bit PCM but could
- // be ADPCM-A or some other format
- int8_t data = space(chan / 6).read_byte(channel.m_pos++);
- outl.add_int(sampindex, data * lvol, 0x80 * 0x800);
- outr.add_int(sampindex, data * rvol, 0x80 * 0x800);
+ uint8_t raw = source.read_byte(channel.m_pos++);
+
+ // seems to be ulaw encoded (but with no inversion); this might
+ // also be able to be folded into the volume calculations but
+ // since it's all guesswork leave them separate for now
+ int16_t sample = 0x21 | ((raw & 0x0f) << 1);
+ sample <<= (raw >> 4) & 7;
+ if (BIT(raw, 7))
+ sample = -sample;
+
+ outl.add_int(sampindex, sample * lvol, 0x2000 * 0x800);
+ outr.add_int(sampindex, sample * rvol, 0x2000 * 0x800);
}
}
}
diff --git a/src/mame/drivers/ympsr60.cpp b/src/mame/drivers/ympsr60.cpp
index 48293bbf2e3..520e7d71c86 100644
--- a/src/mame/drivers/ympsr60.cpp
+++ b/src/mame/drivers/ympsr60.cpp
@@ -711,10 +711,10 @@ ROM_START( psr60 )
ROM_LOAD("yamaha_psr60_pgm_ic110.bin", 0x000000, 0x008000, CRC(39db8c74) SHA1(7750104d1e5df3357aa553ac58768dbc34051cd8))
ROM_REGION(0x8000, "ryp4:group0", 0)
- ROM_LOAD("ym21908.bin", 0x0000, 0x8000, CRC(4ed0d9dc) SHA1(aed7ab6f1c9e28fdf259cb932136b12845040d79) BAD_DUMP)
+ ROM_LOAD("ym21908.bin", 0x0000, 0x8000, CRC(5d0e1d9f) SHA1(dec735ed3df6dc0d81d532186b1073d4ea6290e2))
ROM_REGION(0x8000, "ryp4:group1", 0)
- ROM_LOAD("ym21909.bin", 0x0000, 0x8000, CRC(bb9bb698) SHA1(76563d1f25152cd54041019ef7bc264ede0d8b2b) BAD_DUMP)
+ ROM_LOAD("ym21909.bin", 0x0000, 0x8000, CRC(a555b42a) SHA1(f96cdea88ffc0af4cf6009529398a0181a91a70c))
ROM_END
ROM_START(psr70)
@@ -725,10 +725,10 @@ ROM_START(psr70)
ROM_LOAD("yamaha_psr60_pgm_ic110.bin", 0x000000, 0x008000, CRC(39db8c74) SHA1(7750104d1e5df3357aa553ac58768dbc34051cd8))
ROM_REGION(0x8000, "ryp4:group0", 0)
- ROM_LOAD("ym21908.bin", 0x0000, 0x8000, CRC(4ed0d9dc) SHA1(aed7ab6f1c9e28fdf259cb932136b12845040d79) BAD_DUMP)
+ ROM_LOAD("ym21908.bin", 0x0000, 0x8000, CRC(5d0e1d9f) SHA1(dec735ed3df6dc0d81d532186b1073d4ea6290e2))
ROM_REGION(0x8000, "ryp4:group1", 0)
- ROM_LOAD("ym21909.bin", 0x0000, 0x8000, CRC(bb9bb698) SHA1(76563d1f25152cd54041019ef7bc264ede0d8b2b) BAD_DUMP)
+ ROM_LOAD("ym21909.bin", 0x0000, 0x8000, CRC(a555b42a) SHA1(f96cdea88ffc0af4cf6009529398a0181a91a70c))
ROM_END
CONS(1985, psr60, 0, 0, psr60, psr60, psr60_state, empty_init, "Yamaha", "PSR-60 PortaSound", MACHINE_IMPERFECT_SOUND | MACHINE_CLICKABLE_ARTWORK)