FDS: prepare for auto mod

This commit is contained in:
tildearrow 2024-08-02 02:21:44 -05:00
parent 0fd72afeb4
commit f50911ea49
5 changed files with 15 additions and 1 deletions

View file

@ -263,6 +263,8 @@ enum DivDispatchCmds {
DIV_CMD_BIFURCATOR_STATE_LOAD,
DIV_CMD_BIFURCATOR_PARAMETER,
DIV_CMD_FDS_MOD_AUTO,
DIV_CMD_MAX
};

View file

@ -342,6 +342,12 @@ int DivPlatformFDS::dispatch(DivCommand c) {
rWrite(0x4087,chan[c.chan].modFreq>>8);
break;
}
case DIV_CMD_FDS_MOD_AUTO:
chan[c.chan].autoModNum=c.value>>4;
chan[c.chan].autoModDen=c.value&15;
chan[c.chan].freqChanged=true;
chan[c.chan].modOn=(chan[c.chan].autoModNum || chan[c.chan].autoModDen);
break;
case DIV_CMD_NOTE_PORTA: {
int destFreq=NOTE_FREQUENCY(c.value2);
bool return2=false;

View file

@ -29,6 +29,7 @@ class DivPlatformFDS: public DivDispatch {
struct Channel: public SharedChannel<signed char> {
int prevFreq, modFreq;
unsigned char duty, sweep, modDepth, modPos;
unsigned char autoModNum, autoModDen;
bool sweepChanged, modOn;
signed short wave;
signed char modTable[32];
@ -40,6 +41,8 @@ class DivPlatformFDS: public DivDispatch {
sweep(8),
modDepth(0),
modPos(0),
autoModNum(0),
autoModDen(0),
sweepChanged(false),
modOn(false),
wave(-1) {

View file

@ -261,7 +261,9 @@ const char* cmdName[]={
"MINMOD_ECHO",
"BIFURCATOR_STATE_LOAD",
"BIFURCATOR_PARAMETER"
"BIFURCATOR_PARAMETER",
"FDS_MOD_AUTO"
};
static_assert((sizeof(cmdName)/sizeof(void*))==DIV_CMD_MAX,"update cmdName!");

View file

@ -1053,6 +1053,7 @@ void DivEngine::registerSystems() {
{0x13, {DIV_CMD_FDS_MOD_LOW, _("13xx: Set modulation speed low byte")}},
{0x14, {DIV_CMD_FDS_MOD_POS, _("14xx: Set modulator position")}},
{0x15, {DIV_CMD_FDS_MOD_WAVE, _("15xx: Set modulator table to waveform")}},
{0x16, {DIV_CMD_FDS_MOD_AUTO, _("16xy: Automatic modulation speed (x: numerator; y: denominator)")}},
}
);