MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / _rcntTestOverflow

Function _rcntTestOverflow

pcsx2/IopCounters.cpp:265–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263
264
265static __fi void _rcntTestOverflow(int i)
266{
267 u64 maxTarget = (i < 3) ? 0xffff : 0xfffffffful;
268 if (psxCounters[i].count <= maxTarget)
269 return;
270
271 PSXCNT_LOG("IOP Counter[%d] overflow 0x%I64x >= 0x%I64x (mode: %x)",
272 i, psxCounters[i].count, maxTarget, psxCounters[i].mode.modeval);
273
274 if (psxCounters[i].mode.overflIntr)
275 {
276 // Overflow interrupt
277 _rcntFireInterrupt(i, true);
278 }
279
280 psxCounters[i].mode.overflowFlag = true;
281
282 // Update count.
283 // Count wraps around back to zero, while the target is restored (if not in one shot mode).
284 // (high bit of the target gets set by rcntWtarget when the target is behind
285 // the counter value, and thus should not be flagged until after an overflow)
286 psxCounters[i].count -= maxTarget + 1;
287 psxCounters[i].target &= maxTarget;
288}
289
290/*
291Gate:

Callers 2

psxHBlankStartFunction · 0.85
psxRcntUpdateFunction · 0.85

Calls 1

_rcntFireInterruptFunction · 0.85

Tested by

no test coverage detected