AY: fix wave macro and effect

This commit is contained in:
tildearrow 2022-01-18 15:48:40 -05:00
parent a148a04e2c
commit 05fd372728
3 changed files with 34 additions and 6 deletions

View File

@ -61,8 +61,12 @@ void DivPlatformAY8910::tick() {
rWrite(0x06,31-chan[i].std.duty);
}
if (chan[i].std.hadWave) {
chan[i].psgMode&=4;
chan[i].psgMode|=(chan[i].std.wave+1)&3;
chan[i].psgMode=(chan[i].std.wave+1)&7;
if (isMuted[i]) {
rWrite(0x08+i,0);
} else {
rWrite(0x08+i,(chan[i].outVol&15)|((chan[i].psgMode&4)<<2));
}
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true);
@ -197,6 +201,11 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
}
case DIV_CMD_STD_NOISE_MODE:
chan[c.chan].psgMode=(c.value+1)&7;
if (isMuted[c.chan]) {
rWrite(0x08+c.chan,0);
} else if (chan[c.chan].active) {
rWrite(0x08+c.chan,(chan[c.chan].outVol&15)|((chan[c.chan].psgMode&4)<<2));
}
break;
case DIV_CMD_STD_NOISE_FREQ:
rWrite(0x06,31-c.value);

View File

@ -82,8 +82,12 @@ void DivPlatformAY8930::tick() {
rWrite(0x06,chan[i].std.duty);
}
if (chan[i].std.hadWave) {
chan[i].psgMode&=4;
chan[i].psgMode|=(chan[i].std.wave+1)&3;
chan[i].psgMode=(chan[i].std.wave+1)&7;
if (isMuted[i]) {
rWrite(0x08+i,0);
} else {
rWrite(0x08+i,(chan[i].outVol&31)|((chan[i].psgMode&4)<<3));
}
}
if (chan[i].std.hadEx1) { // duty
rWrite(0x16+i,chan[i].std.ex1);
@ -225,6 +229,11 @@ int DivPlatformAY8930::dispatch(DivCommand c) {
case DIV_CMD_STD_NOISE_MODE:
if (c.value<0x10) {
chan[c.chan].psgMode=(c.value+1)&7;
if (isMuted[c.chan]) {
rWrite(0x08+c.chan,0);
} else if (chan[c.chan].active) {
rWrite(0x08+c.chan,(chan[c.chan].outVol&31)|((chan[c.chan].psgMode&4)<<3));
}
} else {
chan[c.chan].duty=c.value&15;
immWrite(0x16,chan[c.chan].duty);

View File

@ -71,8 +71,12 @@ void DivPlatformYM2610::tick() {
rWrite(0x06,31-chan[i].std.duty);
}
if (chan[i].std.hadWave) {
chan[i].psgMode&=4;
chan[i].psgMode|=(chan[i].std.wave+1)&3;
chan[i].psgMode=(chan[i].std.wave+1)&7;
if (isMuted[i]) {
rWrite(0x04+i,0);
} else {
rWrite(0x04+i,(chan[i].outVol&15)|((chan[i].psgMode&4)<<2));
}
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true);
@ -450,7 +454,13 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
break;
}
case DIV_CMD_STD_NOISE_MODE:
if (c.chan<4 || c.chan>6) break;
chan[c.chan].psgMode=(c.value+1)&7;
if (isMuted[c.chan]) {
rWrite(0x04+c.chan,0);
} else if (chan[c.chan].active) {
rWrite(0x04+c.chan,(chan[c.chan].outVol&15)|((chan[c.chan].psgMode&4)<<2));
}
break;
case DIV_CMD_STD_NOISE_FREQ:
if (c.chan<4 || c.chan>6) break;