ks0164: Correct loop flag and pan swap

This commit is contained in:
Olivier Galibert 2023-10-29 15:51:36 +01:00
parent d14569cb6f
commit 9c01af9fa4

View File

@ -328,7 +328,7 @@ void ks0164_device::voice_w(offs_t offset, u16 data, u16 mem_mask)
m_stream->update();
u16 old = m_sregs[m_voice_select & 0x1f][offset];
COMBINE_DATA(&m_sregs[m_voice_select & 0x1f][offset]);
if(0 && m_sregs[m_voice_select & 0x1f][offset] != old)
if(1 && m_sregs[m_voice_select & 0x1f][offset] != old && offset == 0)
logerror("voice %02x.%02x = %04x @ %04x (%04x)\n", m_voice_select & 0x1f, offset, m_sregs[m_voice_select & 0x1f][offset], mem_mask, m_cpu->pc());
if(offset == 0 && (data & 1) && !(old & 1))
logerror("keyon %02x mode=%04x (%s %c %c %c %c) cur=%02x%04x.%04x loop=%02x%04x.%04x end=%02x%04x.%04x pitch=%02x.%03x 10=%02x/%02x:%02x/%02x 14=%03x/%03x:%03x/%03x 18=%04x/%04x c=%04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x\n",
@ -338,8 +338,8 @@ void ks0164_device::voice_w(offs_t offset, u16 data, u16 mem_mask)
m_sregs[m_voice_select & 0x1f][0x00] & 0x8000 ? " 8" : "16", // 8-bit/16-bit samples
m_sregs[m_voice_select & 0x1f][0x00] & 0x0400 ? 'c' : 'l', // compressed/linear samples
m_sregs[m_voice_select & 0x1f][0x00] & 0x0010 ? 'r' : '-', // loop
m_sregs[m_voice_select & 0x1f][0x00] & 0x0008 ? '3' : '-',
m_sregs[m_voice_select & 0x1f][0x00] & 0x0010 ? '4' : '-',
m_sregs[m_voice_select & 0x1f][0x00] & 0x0008 ? 'l' : '-', // loop
m_sregs[m_voice_select & 0x1f][0x00] & 0x0004 ? '2' : '-',
m_sregs[m_voice_select & 0x1f][0x01], // cur
@ -470,10 +470,6 @@ void ks0164_device::sound_stream_update(sound_stream &stream, std::vector<read_s
if(regs[0] & 0x0001) {
u64 current = (u64(regs[1]) << 32) | (u64(regs[2]) << 16) | regs[3];
if(current & 0xc000000000)
continue;
u32 adr = current >> 16;
s16 samp0, samp1;
switch(regs[0] & 0x8400) {
@ -503,7 +499,7 @@ void ks0164_device::sound_stream_update(sound_stream &stream, std::vector<read_s
current += step;
u64 end = (u64(regs[0xd]) << 32) | (u64(regs[0xe]) << 16) | regs[0xf];
if(current >= end) {
if (!(regs[0] & 0x10)) {
if (regs[0] & 8) {
u64 loop = (u64(regs[9]) << 32) | (regs[0xa] << 16) | regs[0xb];
current = current - end + loop;
} else {
@ -514,8 +510,8 @@ void ks0164_device::sound_stream_update(sound_stream &stream, std::vector<read_s
regs[2] = current >> 16;
regs[3] = current;
suml += (s64(samp) * regs[0x10] * regs[0x14]) >> 32;
sumr += (s64(samp) * regs[0x12] * regs[0x16]) >> 32;
suml += (s64(samp) * regs[0x12] * regs[0x16]) >> 32;
sumr += (s64(samp) * regs[0x10] * regs[0x14]) >> 32;
if(regs[0xc]) {
regs[0x10] += regs[0x11];