From 3761383f8dfd9669ff51f63571cd7fd69d32b7db Mon Sep 17 00:00:00 2001 From: cam900 Date: Mon, 3 Oct 2022 11:02:34 +0900 Subject: [PATCH] Fix 1701 command for AYPCM --- src/engine/platform/ay.cpp | 4 +++- src/engine/platform/ay8930.cpp | 4 +++- src/engine/sysDef.cpp | 8 ++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index b01d6a9f5..eeeb54853 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -441,12 +441,14 @@ int DivPlatformAY8910::dispatch(DivCommand c) { } chan[c.chan].dac.pos=0; chan[c.chan].dac.period=0; - chan[c.chan].dac.rate=parent->getSample(chan[c.chan].dac.sample)->rate*2048; + chan[c.chan].dac.rate=parent->getSample(chan[c.chan].dac.sample)->rate; if (dumpWrites) { rWrite(0x08+c.chan,0); addWrite(0xffff0001+(c.chan<<8),chan[c.chan].dac.rate); } chan[c.chan].dac.furnaceDAC=false; + chan[c.chan].active=true; + //chan[c.chan].keyOn=true; } chan[c.chan].curPSGMode.dac=chan[c.chan].nextPSGMode.dac; break; diff --git a/src/engine/platform/ay8930.cpp b/src/engine/platform/ay8930.cpp index 821fa4fe4..3d658e031 100644 --- a/src/engine/platform/ay8930.cpp +++ b/src/engine/platform/ay8930.cpp @@ -442,12 +442,14 @@ int DivPlatformAY8930::dispatch(DivCommand c) { } chan[c.chan].dac.pos=0; chan[c.chan].dac.period=0; - chan[c.chan].dac.rate=parent->getSample(chan[c.chan].dac.sample)->rate*4096; + chan[c.chan].dac.rate=parent->getSample(chan[c.chan].dac.sample)->rate; if (dumpWrites) { rWrite(0x08+c.chan,0); addWrite(0xffff0001+(c.chan<<8),chan[c.chan].dac.rate); } chan[c.chan].dac.furnaceDAC=false; + chan[c.chan].active=true; + //chan[c.chan].keyOn=true; } chan[c.chan].curPSGMode.dac=chan[c.chan].nextPSGMode.dac; break; diff --git a/src/engine/sysDef.cpp b/src/engine/sysDef.cpp index cb2a3da4b..e97a2b890 100644 --- a/src/engine/sysDef.cpp +++ b/src/engine/sysDef.cpp @@ -422,6 +422,10 @@ void DivEngine::registerSystems() { // Common effect handler maps + EffectHandlerMap ayPreEffectHandlerMap={ + {0x17, {DIV_CMD_SAMPLE_MODE, "17xx: Toggle PCM mode"}}, + }; + EffectHandlerMap ayPostEffectHandlerMap={ {0x20, {DIV_CMD_STD_NOISE_MODE, "20xx: Set channel mode (bit 0: square; bit 1: noise; bit 2: envelope)"}}, {0x21, {DIV_CMD_STD_NOISE_FREQ, "21xx: Set noise frequency (0 to 1F)"}}, @@ -771,7 +775,7 @@ void DivEngine::registerSystems() { {DIV_CH_PULSE, DIV_CH_PULSE, DIV_CH_PULSE}, {DIV_INS_AY, DIV_INS_AY, DIV_INS_AY}, {}, - {}, + ayPreEffectHandlerMap, ayPostEffectHandlerMap ); @@ -851,7 +855,7 @@ void DivEngine::registerSystems() { {DIV_CH_PULSE, DIV_CH_PULSE, DIV_CH_PULSE}, {DIV_INS_AY8930, DIV_INS_AY8930, DIV_INS_AY8930}, {}, - {}, + ayPreEffectHandlerMap, ay8930PostEffectHandlerMap );