diff --git a/src/engine/platform/su.cpp b/src/engine/platform/su.cpp index 7acab357..2dca4b3c 100644 --- a/src/engine/platform/su.cpp +++ b/src/engine/platform/su.cpp @@ -32,6 +32,62 @@ const char** DivPlatformSoundUnit::getRegisterSheet() { } const char* DivPlatformSoundUnit::getEffectName(unsigned char effect) { + switch (effect) { + case 0x10: + return "10xx: Set waveform (0 to 7)"; + break; + case 0x12: + return "12xx: Set pulse width (0 to 7F)"; + break; + case 0x13: + return "13xx: Set resonance (0 to F)"; + break; + case 0x14: + return "14xx: Set filter mode (bit 0: ring mod; bit 1: low pass; bit 2: band pass; bit 3: high pass)"; + break; + case 0x15: + return "15xx: Set frequency sweep period low byte"; + break; + case 0x16: + return "16xx: Set frequency sweep period high byte"; + break; + case 0x17: + return "17xx: Set volume sweep period low byte"; + break; + case 0x18: + return "18xx: Set volume sweep period high byte"; + break; + case 0x19: + return "19xx: Set cutoff sweep period low byte"; + break; + case 0x1a: + return "1Axx: Set cutoff sweep period high byte"; + break; + case 0x1b: + return "1Bxx: Set frequency sweep boundary"; + break; + case 0x1c: + return "1Cxx: Set volume sweep boundary"; + break; + case 0x1d: + return "1Dxx: Set cutoff sweep boundary"; + break; + case 0x20: + return "20xx: Toggle frequency sweep (bit 0-6: speed; bit 7: direction is up)"; + break; + case 0x21: + return "21xx: Toggle volume sweep (bit 0-4: speed; bit 5: direciton is up; bit 6: loop; bit 7: alternate)"; + break; + case 0x22: + return "22xx: Toggle cutoff sweep (bit 0-6: speed; bit 7: direction is up)"; + break; + case 0x40: case 0x41: case 0x42: case 0x43: + case 0x44: case 0x45: case 0x46: case 0x47: + case 0x48: case 0x49: case 0x4a: case 0x4b: + case 0x4c: case 0x4d: case 0x4e: case 0x4f: + return "4xxx: Set cutoff (0 to FFF)"; + break; + } return NULL; } @@ -50,6 +106,12 @@ void DivPlatformSoundUnit::writeControl(int ch) { chWrite(ch,0x04,(chan[ch].wave&7)|(chan[ch].pcm<<3)|(chan[ch].control<<4)); } +void DivPlatformSoundUnit::writeControlUpper(int ch) { + chWrite(ch,0x05,((int)chan[ch].phaseReset)|(chan[ch].filterPhaseReset<<1)|(chan[ch].pcmLoop<<2)|(chan[ch].timerSync<<3)|(chan[ch].freqSweep<<4)|(chan[ch].volSweep<<5)|(chan[ch].cutSweep<<6)); + chan[ch].phaseReset=false; + chan[ch].filterPhaseReset=false; +} + void DivPlatformSoundUnit::tick(bool sysTick) { for (int i=0; i<8; i++) { chan[i].std.next(); @@ -80,6 +142,10 @@ void DivPlatformSoundUnit::tick(bool sysTick) { chan[i].wave=chan[i].std.wave.val&7; writeControl(i); } + if (chan[i].std.phaseReset.had) { + chan[i].phaseReset=chan[i].std.phaseReset.val; + writeControlUpper(i); + } if (chan[i].std.panL.had) { chan[i].pan=chan[i].std.panL.val; chWrite(i,0x03,chan[i].pan); diff --git a/src/engine/platform/su.h b/src/engine/platform/su.h index 5baf13f0..6291d453 100644 --- a/src/engine/platform/su.h +++ b/src/engine/platform/su.h @@ -31,7 +31,8 @@ class DivPlatformSoundUnit: public DivDispatch { int ins, cutoff, res, control; signed char pan; unsigned char duty; - bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise, pcm; + bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise, pcm, phaseReset, filterPhaseReset; + bool pcmLoop, timerSync, freqSweep, volSweep, cutSweep; signed char vol, outVol, wave; DivMacroInt std; Channel(): @@ -53,9 +54,16 @@ class DivPlatformSoundUnit: public DivDispatch { inPorta(false), noise(false), pcm(false), + phaseReset(false), + filterPhaseReset(false), + pcmLoop(false), + timerSync(false), + freqSweep(false), + volSweep(false), + cutSweep(false), vol(127), outVol(127), - wave(-1) {} + wave(0) {} }; Channel chan[8]; bool isMuted[8]; @@ -74,6 +82,7 @@ class DivPlatformSoundUnit: public DivDispatch { SoundUnit* su; unsigned char regPool[128]; void writeControl(int ch); + void writeControlUpper(int ch); friend void putDispatchChan(void*,int,int); public: diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 7039f164..8631e74f 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -2890,7 +2890,8 @@ void FurnaceGUI::drawInsEdit() { ins->type==DIV_INS_OPLL || ins->type==DIV_INS_AY || ins->type==DIV_INS_AY8930 || - ins->type==DIV_INS_SWAN) { + ins->type==DIV_INS_SWAN || + ins->type==DIV_INS_SU) { NORMAL_MACRO(ins->std.phaseResetMacro,0,1,"phaseReset","Phase Reset",32,ins->std.phaseResetMacro.open,true,NULL,false,NULL,0,0,0,0,false,0,macroDummyMode,uiColors[GUI_COLOR_MACRO_OTHER],mmlString[16],0,1,NULL,false); } if (ex1Max>0) {