SCRYMAMEReferenceReadhistory

MAMERead

history

List the last instructions a cpu ran before the stop, oldest first.

history(limit=32, cpu="")

Try it

On Gridlee, a free ROM from mamedev.org, stopped by a watch right after the game wrote its third credit.
Ask

What were the last eight instructions the cpu ran before this stop?

Call
history(limit=8)
Reply 2 of 5 fields
{
  "summary": "history: 8 instructions of 8 asked",
  "lines": [
    "B579: DEC    $0491",
    "B57C: JSR    $B583",
    "B583: INC    $042B",
    "B586: LDA    #$01",
    "B588: ADDA   $042C",
    "B58B: DAA",
    "... 2 more"
  ]
}

Oldest first: the call at B57C into the coin routine, then the routine's own instructions from B583 on. All eight asked for came back.

The whole reply
JSON
{
  "summary": "history: 8 instructions of 8 asked",
  "status": "ok",
  "asked": 8,
  "lines": ["B579: DEC    $0491", "B57C: JSR    $B583", "B583: INC    $042B", "B586: LDA    #$01", "B588: ADDA   $042C", "B58B: DAA", "... 2 more"],
  "cpu": ":maincpu"
}

Arguments

limit integer (>= 1, <= 256), default 32
How many instructions back: 1 to 256, the most MAME keeps for a cpu. Left out, 32.
cpu string, default ""
The cpu whose instructions are listed. Left empty, the one the debugger is showing.

What comes back

lines
One instruction a line, <address>: <instruction>, oldest first. Fewer than asked means the cpu has run no more.
asked
The limit the call asked for.
cpu
The cpu the instructions belong to.
All 3 reply fields
  • asked (integer)
  • cpu (string or object)
  • lines (array)

What it refuses

Why it works this way

A cpu that has run no instruction yet answers with no lines and a note saying so.

The contract your client receives
Text
The last `limit` (1..256) instructions `cpu` retired before the stop, oldest
first.

Reply: `asked`, `lines` (`<addr>: <instruction>`), `cpu`, `note`. No disassembler:
`no_channel`.

Reference: REFERENCE.md, Reading and writing.
Tools