SCRYMAMEReferenceSessionrom_check
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
start was given.Check again that the ROM at 0xa000 is still the image I gave you.
rom_check(reference_rom="./tmp/demos/tour/gridlee.ref", reference_addr="0xa000",
reference_base="0xa000"){
"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
{
"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
0xstring. 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
truewhen 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
- The machine is running (
not_stopped). - The bytes differ. The refusal names the cpu that was read, and the session stays open (
readback_refused). - On a MAME without the gdbstub thread patch, which gives each cpu its own debugger thread, a cpu other than the first (
bad_argument).
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.
Related tools
The contract your client receives
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.