44 Companion zmachine.js (23/28)
case 0x06: return v <= 3 ? this.branch(this.doRestore()) : this.store(this.doRestore() ? 2 : 0);
case 0x07: { const rng = this.rng; this.reset(); this.rng = rng; return; }
case 0x08: return this.ret(this.readVar(0));
case 0x09:
if (v <= 4) { this.readVar(0); return; }
return this.store(this.frames.length);
case 0x0a: this.quit = true; return;
case 0x0b: return this.print('\n');
case 0x0c: if (v <= 3) this.showStatusV3(); return;
case 0x0d: return this.branch(true); // verify
case 0x0f: return this.branch(true); // piracy
}
} else if (form === 'var') {
switch (num) {
case 0x00: return this.call(o[0], o.slice(1), this.mem[this.pc++]);
case 0x01: return this.wwChecked(u16(o[0] + 2 * s16(o[1])), o[2]);
case 0x02: return this.wb(u16(o[0] + s16(o[1])), o[2]);
case 0x03: {
const p = this.findProp(o[0], o[1]);
if (!p) throw new ZError(`put_prop: object ${o[0]} has no property ${o[1]}`);
if (p.len === 1) this.mem[p.addr] = o[2] & 0xff; else this.ww(p.addr, o[2]);
return;
}
case 0x04: { // sread / aread
if (v <= 3) this.showStatusV3();
const store = v >= 5 ? this.mem[this.pc++] : -1;
this.waiting = { kind: 'line', text: o[0], parse: o[1] || 0, store };
return;
}
case 0x05: return this.print(this.zsciiToChar(o[0]));