From 671e7f60d2cb2e12cacf26ce97b79df93511addc Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Sat, 14 Mar 2026 19:17:28 +0000 Subject: [PATCH] Add a bunch of opcodes --- asm.js | 55 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/asm.js b/asm.js index d10eedb..3668b19 100644 --- a/asm.js +++ b/asm.js @@ -127,21 +127,46 @@ const types = { }; const opcodes = { - "block": 0x02, - "loop": 0x03, - "if": 0x04, - "else": 0x05, - "end": 0x0b, - "br": 0x0c, - "br_if": 0x0d, - "local.get": 0x20, - "local.set": 0x21, - "local.tee": 0x22, - "global.get": 0x23, - "global.set": 0x24, - "i32.const": 0x41, - "i32.gt_u": 0x4b, - "i32.mul": 0x6c, + "block": 0x02, + "loop": 0x03, + "if": 0x04, + "else": 0x05, + "end": 0x0b, + "br": 0x0c, + "br_if": 0x0d, + "call": 0x10, + "call_indirect": 0x11, + "drop": 0x0a, + "local.get": 0x20, + "local.set": 0x21, + "local.tee": 0x22, + "global.get": 0x23, + "global.set": 0x24, + "i32.load": 0x28, + "i32.load8_u": 0x2d, + "i32.store": 0x36, + "i32.store8": 0x3a, + "i32.const": 0x41, + "i32.eqz": 0x45, + "i32.eq": 0x46, + "i32.ne": 0x47, + "i32.lt_s": 0x48, + "i32.lt_u": 0x49, + "i32.gt_s": 0x4a, + "i32.gt_u": 0x4b, + "i32.le_s": 0x4c, + "i32.le_u": 0x4d, + "i32.ge_s": 0x4e, + "i32.ge_u": 0x4f, + "i32.add": 0x6a, + "i32.sub": 0x6b, + "i32.mul": 0x6c, + "i32.and": 0x71, + "i32.or": 0x72, + "i32.xor": 0x73, + "i32.shl": 0x74, + "i32.shr_s": 0x75, + "i32.shr_u": 0x76, }; const mem_flags = {