import { OpCodes } from '../opcodes' ; export function printCode ( code ) { let ip = 0 ; while ( ip < code . length ) { const byte = code [ ip ] ; const opCode = OpCodes [ byte ] ; if ( ! opCode ) { console . log ( `Unknown opcode 0x${ byte . toString ( 16 ) }` ) ; ip += 1 ; continue ; } const opCodeParams = code . slice ( ip + 1 , ip + opCode . bytes ) ; console . log ( opCode . toString ( opCodeParams ) ) ; ip += opCode . bytes ; } }