Skip to content
PS5PCEM
PartialFirmware and HLE

AMPR counters

AMPR in PS5PCEM is a process-local software model of the console's counter and completion commands. One hundred and twenty-eight counters accept stores, atomic field updates, paired reads and masked waits, in submission order.

Repository notes through October 10, 2026

What a title uses AMPR for

On the console, AMPR is the asynchronous engine that moves file data and updates counters the CPU and the GPU can wait on. Games use it to know that a read has landed, or that a later pass may start, without spinning on a shared variable. PS5PCEM does not emulate the AMPR hardware block. It executes the command stream the title built, inside the process, and reports completion through the AMPR event queue the title registered.

The counter bank holds 128 words of 32 bits. A pair is an even counter plus the next word, read and written as one 64-bit value. A single lock covers both halves and every read-modify-write, so a reader cannot observe a torn pair. Access can name the whole pair, the 32-bit word, either 16-bit half, or one of the four bytes.

Stores, waits and timestamps

A write is a store, a bitwise OR, an AND with the complement, an XOR, or a wrapping add, applied to the selected field. A wait compares that field with a reference under a mask. The comparisons are equal, greater, less, not equal, a reached sequence value, and the signed forms of greater and less. Sequence compares shift the field's sign bit to bit 63, so the same rule works at 8, 16, 32 and 64 bits.

A wait that is already satisfied completes in place. A wait that is not satisfied keeps the submission snapshot and resumes before later writes and events on that stream, including when a later submission on the same guest thread supplies the value. The ordinary API and the _04_00 API have separate argument lists. Timestamps are recorded with the counter commands. Completion-size queries that titles were importing are registered, so those calls resolve.

What this path has been observed to do

Twenty-two focused AMPR tests pass in ReleaseSafe, including calls through the real export surface. Grand Theft Auto III's startup performs more than 10,000 APR file-read submissions and writes more than 350 AMPR completion events, with no matched AMPR error on that path. That startup does not itself call the counter API. The counter work is covered by the tests and by titles that do wait on the values.

This is API coverage for the commands the emulator executes. It is not a cycle-level model of the console's memory controller, and it does not claim the hardware's timing.

What is implemented

  • One hundred and twenty-eight counters, with coherent 64-bit pairs and byte, half and word fields.
  • Store, OR, AND-complement, XOR and wrapping add, plus masked and signed waits.
  • Blocked waits that keep their place in the command stream and resume when the value arrives.
  • Ordered completion delivered through the registered AMPR event queue.

What is still missing

  • WaitOnAddress remains a placeholder.
  • Hardware timing of the real AMPR block is not reproduced.
  • A counter command the decoder does not recognise is not silently treated as success.

Related mechanisms

What these pages are

The text follows the architecture notes and the October 2026 reports in the PS5PCEM repository. A focused test passing is not a new frame rate and not a new playthrough.

All technologies