SCRYMAMEReferenceWriteset_registerAlso in DOSBox-X

MAMEWrite

set_register

Force a register to a value you choose, and see what the cpu holds afterwards.

set_register(name, value, cpu="")

Try it

On Gridlee, a free ROM from mamedev.org, at any stop.
Ask

Force register A to 0x42.

Call
set_register(name="A", value="0x42")
Reply 6 of 7 fields
{
  "summary": "set_register A = 0x42, verified True",
  "register": "A",
  "value": "0x42",
  "readback": "0x42",
  "verified": true,
  "cpu": ":maincpu"
}

Register A of :maincpu now holds 0x42. readback is what the register held after the write, and verified says it equals what was asked.

The whole reply
JSON
{
  "summary": "set_register A = 0x42, verified True",
  "status": "ok",
  "register": "A",
  "value": "0x42",
  "readback": "0x42",
  "verified": true,
  "cpu": ":maincpu"
}

Arguments

name string, required
The register, by a name registers lists (D0, PC). A 16-bit register served under an E name takes its short one: AX for EAX on a V30.
value integer or string, required
The value to set: an integer or a 0x string, not negative and no wider than the register.
cpu string, default ""
The cpu whose register is set. Left empty, the one the debugger is showing.

What comes back

register
The register as the debugger names it, which can differ from the name given (EAX for AX).
value
What was asked, as 0x text at the register's width.
readback
What the register holds after the write, in the same spelling.
verified
true when readback equals value.
All 5 reply fields
  • cpu (string)
  • readback (string)
  • register (string)
  • value (string)
  • verified (boolean)

What it refuses

Why it works this way

The value is read back because a register can refuse part of it. verified: false is not always a failure: a register that masks the value, or answers something else, is doing its job.

The write marks the session: the session block of every later reply carries altered, which says this session has written to the machine.

The contract your client receives
Text
Force register `name` of `cpu` to `value` and read it back. Modifies the machine; needs it
stopped.

Refuses an unknown name (listing the cpu's) and a value wider than the register.

Reply: `register`, `value`, `readback`, `verified`, `cpu`. A cpu the stub does not
describe is `no_channel`.

Reference: REFERENCE.md, Reading and writing.
Tools