From cc8ae742f01f70d1950cc0aed81414731c14b343 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Thu, 19 Mar 2026 22:01:33 +0000 Subject: [PATCH] Add more opcodes to assembler --- asm.js | 90 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/asm.js b/asm.js index 1b4f60a..b50d741 100644 --- a/asm.js +++ b/asm.js @@ -144,49 +144,52 @@ const types = { }; const opcodes = { - "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, - "i64.const": 0x42, - "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.div_s": 0x6d, - "i32.rem_s": 0x6f, - "i32.and": 0x71, - "i32.or": 0x72, - "i32.xor": 0x73, - "i32.shl": 0x74, - "i32.shr_s": 0x75, - "i32.shr_u": 0x76, + "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, + "i64.const": 0x42, + "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.div_s": 0x6d, + "i32.rem_s": 0x6f, + "i32.and": 0x71, + "i32.or": 0x72, + "i32.xor": 0x73, + "i32.shl": 0x74, + "i32.shr_s": 0x75, + "i32.shr_u": 0x76, + "i64.or": 0x84, + "i64.shl": 0x86, + "i64.extend_i32_u": 0xad, // Threads instructions "memory.atomic.notify": [ 0xfe, 0x00 ], @@ -194,6 +197,7 @@ const opcodes = { "i32.atomic.load": [ 0xfe, 0x10 ], "i32.atomic.load8_u": [ 0xfe, 0x12 ], "i32.atomic.store": [ 0xfe, 0x17 ], + "i64.atomic.store": [ 0xfe, 0x18 ], "i32.atomic.store8": [ 0xfe, 0x19 ], };