MCPcopy Create free account
hub / github.com/TASEmulators/fceux / DECLFW

Function DECLFW

src/sound.cpp:222–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222static DECLFW(Write_PSG)
223{
224 A&=0x1F;
225 switch(A)
226 {
227 case 0x0:
228 DoSQ1();
229 EnvUnits[0].Mode=(V&0x30)>>4;
230 EnvUnits[0].Speed=(V&0xF);
231 if (swapDuty)
232 V = (V&0x3F)|((V&0x80)>>1)|((V&0x40)<<1);
233 break;
234 case 0x1:
235 DoSQ1();
236 sweepon[0]=V&0x80;
237 SweepReload[0]=1;
238 break;
239 case 0x2:
240 DoSQ1();
241 curfreq[0]&=0xFF00;
242 curfreq[0]|=V;
243 break;
244 case 0x3:
245 DoSQ1();
246 SQReload(0,V);
247 break;
248 case 0x4:
249 DoSQ2();
250 EnvUnits[1].Mode=(V&0x30)>>4;
251 EnvUnits[1].Speed=(V&0xF);
252 if (swapDuty)
253 V = (V&0x3F)|((V&0x80)>>1)|((V&0x40)<<1);
254 break;
255 case 0x5:
256 DoSQ2();
257 sweepon[1]=V&0x80;
258 SweepReload[1]=1;
259 break;
260 case 0x6:
261 DoSQ2();
262 curfreq[1]&=0xFF00;
263 curfreq[1]|=V;
264 break;
265 case 0x7:
266 DoSQ2();
267 SQReload(1,V);
268 break;
269 case 0xa:
270 DoTriangle();
271 break;
272 case 0xb:
273 DoTriangle();
274 if(EnabledChannels&0x4)
275 lengthcount[2]=lengthtable[(V>>3)&0x1f];
276 TriMode=1; // Load mode
277 break;
278 case 0xC:
279 DoNoise();

Callers

nothing calls this directly

Calls 6

SQReloadFunction · 0.85
LoadDMCPeriodFunction · 0.85
X6502_IRQEndFunction · 0.85
X6502_IRQBeginFunction · 0.85
PrepDPCMFunction · 0.85
FrameSoundUpdateFunction · 0.85

Tested by

no test coverage detected