aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-11-23 14:56:03 +0100
committerWojciech Kosior <kwojtus@protonmail.com>2020-11-23 14:56:03 +0100
commitc5e3ee1d1c445f799e3cdfeee57ae8cfa3412743 (patch)
tree48da9c1c54cf83a73545f8a27329d281b714726b /tools
parenta0e9d28f2a21cc42dff7ed2fce3e52cb04bc5170 (diff)
downloadAGH-engineering-thesis-c5e3ee1d1c445f799e3cdfeee57ae8cfa3412743.tar.gz
AGH-engineering-thesis-c5e3ee1d1c445f799e3cdfeee57ae8cfa3412743.zip
write Wasm code, that can print a number on the screen
Diffstat (limited to 'tools')
-rw-r--r--tools/stack_machine_instruction.h1
-rw-r--r--tools/translate_xmacro.h1
-rw-r--r--tools/wasm.h1
3 files changed, 3 insertions, 0 deletions
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)
{