38 Companion zmachine.js (17/28)

  fetchOperands(types) {
    const ops = [];
    for (const t of types) {
      if (t === 3) break;
      if (t === 0) { ops.push(this.rw(this.pc)); this.pc += 2; }
      else if (t === 1) ops.push(this.mem[this.pc++]);
      else ops.push(this.readVar(this.mem[this.pc++]));
    }
    return ops;
  }

  typeByte(b) { return [(b >> 6) & 3, (b >> 4) & 3, (b >> 2) & 3, b & 3]; }
‹ PreviousReader file (.txt)Next ›