Examples > text-adventures COMPANION ZMACHINE.JS (24/28) case 0x06: return this.printNum(o[0]); case 0x07: { const r = s16(o[0]); if (r > 0) return this.store((this.nextRandom() % r) + 1); this.seed(r < 0 ? -r : Date.now()); return this.store(0); } case 0x08: return this.writeVar(0, o[0]); case 0x09: { const x = this.readVar(0); return this.pokeVar(o[0], x); } case 0x0a: // split_window this.upperHeight = o[0]; this.upper.length = Math.min(this.upper.length, o[0]); if (this.cursor.row > o[0]) this.cursor = { row: 1, col: 1 }; return; case 0x0b: // set_window this.window = o[0]; if (o[0] === 1) this.cursor = { row: 1, col: 1 }; return; case 0x0c: return this.call(o[0], o.slice(1), this.mem[this.pc++]); case 0x0d: { // erase_window const w = s16(o[0]); if (w === -1) { this.upperHeight = 0; this.upper = []; this.window = 0; } if (w === -2 || w === 1) this.upper = []; return; } case 0x0e: return; // erase_line case 0x0f: if (this.window === 1) this.cursor = { row: s16(o[0]), col: o[1] || 1 }; return; case 0x10: this.ww(o[0], this.cursor.row); this.ww(o[0] + 2, this.cursor.col); return; case 0x11: return; // set_text_style case 0x12: return; // buffer_mode case 0x13: { // output_stream const n = s16(o[0]); if (n === 1) this.screenOn = true; Next: 46 Companion zmachine.js (25/28)