From c5e3ee1d1c445f799e3cdfeee57ae8cfa3412743 Mon Sep 17 00:00:00 2001 From: Wojciech Kosior Date: Mon, 23 Nov 2020 14:56:03 +0100 Subject: write Wasm code, that can print a number on the screen --- tools/stack_machine_instruction.h | 1 + tools/translate_xmacro.h | 1 + tools/wasm.h | 1 + 3 files changed, 3 insertions(+) (limited to 'tools') diff --git a/tools/stack_machine_instruction.h b/tools/stack_machine_instruction.h index 15c870b..529ffae 100644 --- a/tools/stack_machine_instruction.h +++ b/tools/stack_machine_instruction.h @@ -127,6 +127,7 @@ Y(gt, 0x300C) /* 0011_0000_0000_1100 */ Y(ugt, 0x300D) /* 0011_0000_0000_1101 */ Y(ge, 0x300E) /* 0011_0000_0000_1110 */ Y(uge, 0x300F) /* 0011_0000_0000_1111 */ +Y(rem, 0x3010) /* 0011_0000_0001_0000 */ Y(ret, 0x3080) /* 0011_0000_1000_0000 */ X(cond_jump, 0x7080) /* 0111_0000_1xxx_xxxx */ X(cond_jump_n, 0x7100) /* 0111_0001_0xxx_xxxx */ diff --git a/tools/translate_xmacro.h b/tools/translate_xmacro.h index e906261..289bb15 100644 --- a/tools/translate_xmacro.h +++ b/tools/translate_xmacro.h @@ -4,6 +4,7 @@ TS (WASM_I32_ADD, add, i32_i32, i32) TS (WASM_I32_SUB, sub, i32_i32, i32) TS (WASM_I32_DIV_U, div, i32_i32, i32) +TS (WASM_I32_REM_U, rem, i32_i32, i32) TS (WASM_I32_MUL, mul, i32_i32, i32) TS (WASM_I32_EQ, eq, i32_i32, i32) TS (WASM_I32_LT_S, lt, i32_i32, i32) diff --git a/tools/wasm.h b/tools/wasm.h index afa1908..2e3e0c0 100644 --- a/tools/wasm.h +++ b/tools/wasm.h @@ -60,6 +60,7 @@ #define WASM_I32_SUB 0x6B #define WASM_I32_MUL 0x6C #define WASM_I32_DIV_U 0x6E +#define WASM_I32_REM_U 0x70 static inline int is_valid_valtype(char value_type) { -- cgit v1.2.3