00; }
        function pop() { self.sp = (self.sp+1)%0x1000; return self.stack[self.stack]; }
        function jump(addr) { self.pc = addr; }
        function flag(bool) { self.v[0xF] = bool ? 0x1 : 0x0; }
        function smem(addr, val) { self.memory[addr%0x1000] = val; }
        function gmem(addr) { return self.memory[addr%0x1000]; }
        function unknown(instr) { console.log("Unknown instruction: ", instr.toString(16)); }

        const instr = this.memory[this.pc] << 8 | this.memory[this.pc + 1];

