APU: Move duty cycle swapping during apu writes
This commit is contained in:
@@ -195,6 +195,8 @@ static DECLFW(Write_PSG) {
|
|||||||
DoSQ1();
|
DoSQ1();
|
||||||
EnvUnits[0].Mode = (V & 0x30) >> 4;
|
EnvUnits[0].Mode = (V & 0x30) >> 4;
|
||||||
EnvUnits[0].Speed = (V & 0xF);
|
EnvUnits[0].Speed = (V & 0xF);
|
||||||
|
if (swapDuty)
|
||||||
|
V = (V & 0x3F) | ((V & 0x80) >> 1) | ((V & 0x40) << 1);
|
||||||
break;
|
break;
|
||||||
case 0x1:
|
case 0x1:
|
||||||
DoSQ1();
|
DoSQ1();
|
||||||
@@ -214,6 +216,8 @@ static DECLFW(Write_PSG) {
|
|||||||
DoSQ2();
|
DoSQ2();
|
||||||
EnvUnits[1].Mode = (V & 0x30) >> 4;
|
EnvUnits[1].Mode = (V & 0x30) >> 4;
|
||||||
EnvUnits[1].Speed = (V & 0xF);
|
EnvUnits[1].Speed = (V & 0xF);
|
||||||
|
if (swapDuty)
|
||||||
|
V = (V & 0x3F) | ((V & 0x80) >> 1) | ((V & 0x40) << 1);
|
||||||
break;
|
break;
|
||||||
case 0x5:
|
case 0x5:
|
||||||
DoSQ2();
|
DoSQ2();
|
||||||
@@ -561,8 +565,6 @@ static INLINE void RDoSQ(int x) {
|
|||||||
|
|
||||||
amp <<= 24;
|
amp <<= 24;
|
||||||
dutyCycle = (PSG[(x << 2)] & 0xC0) >> 6;
|
dutyCycle = (PSG[(x << 2)] & 0xC0) >> 6;
|
||||||
if (swapDuty)
|
|
||||||
dutyCycle = ((dutyCycle & 2) >> 1) | ((dutyCycle & 1) << 1);
|
|
||||||
rthresh = RectDuties[dutyCycle];
|
rthresh = RectDuties[dutyCycle];
|
||||||
currdc = RectDutyCount[x];
|
currdc = RectDutyCount[x];
|
||||||
D = &WaveHi[ChannelBC[x]];
|
D = &WaveHi[ChannelBC[x]];
|
||||||
@@ -640,8 +642,6 @@ static void RDoSQLQ(void) {
|
|||||||
if (!inie[x]) amp[x] = 0; /* Correct? Buzzing in MM2, others otherwise... */
|
if (!inie[x]) amp[x] = 0; /* Correct? Buzzing in MM2, others otherwise... */
|
||||||
|
|
||||||
dutyCycle = (PSG[(x << 2)] & 0xC0) >> 6;
|
dutyCycle = (PSG[(x << 2)] & 0xC0) >> 6;
|
||||||
if (swapDuty)
|
|
||||||
dutyCycle = ((dutyCycle & 2) >> 1) | ((dutyCycle & 1) << 1);
|
|
||||||
rthresh[x] = RectDuties[dutyCycle];
|
rthresh[x] = RectDuties[dutyCycle];
|
||||||
|
|
||||||
for (y = 0; y < 8; y++) {
|
for (y = 0; y < 8; y++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user