SCRYMAMEReferenceSessionrom_check

MAMESession

rom_check

Check again that the machine runs the program your image holds, at any address and on any cpu.

rom_check(reference_rom, reference_addr=0, reference_base=0, cpu="")

Try it

On Gridlee, stopped, with the reference image start was given.
Ask

Check again that the ROM at 0xa000 is still the image I gave you.

Call
rom_check(reference_rom="./tmp/demos/tour/gridlee.ref", reference_addr="0xa000",
    reference_base="0xa000")
Reply 4 of 6 fields
{
  "status": "ok",
  "rom_check": "OK",
  "deterministic": true,
  "cpu": ":maincpu"
}

The 16 bytes read from the machine equal the image's, and a second read gave the same bytes (deterministic). cpu names the cpu that was read.

The whole reply
JSON
{
  "summary": "<volatile>",
  "status": "ok",
  "rom_check": "OK",
  "deterministic": true,
  "query_s": "<volatile>",
  "cpu": ":maincpu"
}

Arguments

reference_rom string, required
The binary image to compare the machine's memory with.
reference_addr integer or string, default 0
The address where 16 bytes of the machine are compared with the image: an integer or a 0x string. Left out, 0.
reference_base integer or string, default 0
The address of the image's first byte. Left out, 0.
cpu string, default ""
The cpu whose memory is read. Left empty, the one the debugger shows.

What comes back

rom_check
OK: the 16 bytes read from the machine equal the image's.
deterministic
true when reading the same address again gives the same bytes.
query_s
How long one read through the debugger takes, in seconds.
cpu
The cpu that was read.
All 4 reply fields
  • cpu (string or object)
  • deterministic (boolean)
  • query_s (number)
  • rom_check (string)

What it refuses

Why it works this way

start makes this check once, with the image and address it was given. rom_check takes its arguments again on every call, so you can point it at another address, image or cpu. state_write(method="load") repeats start's own check.

Name cpu once a stop has made another cpu the visible one, because an image is one cpu's program. The check is about the running machine, never about the MAME build. The second read is for deterministic, and query_s is what one read costs.

More on why

A MAME without the gdbstub thread patch reads its first cpu only, whatever the debugger shows.

The contract your client receives
Text
Re-validate the session: 16 bytes at `reference_addr` of `cpu` (empty: the visible one)
against `reference_rom` at `reference_base`. Needs the machine STOPPED (else `not_stopped`).

A mismatch is `readback_refused`.

Reply: `rom_check` (`OK`), `deterministic`, `query_s`, `cpu`.

Reference: REFERENCE.md, The session.
Tools