From cc6766da20200e014e97045aaf96304e379fdcb7 Mon Sep 17 00:00:00 2001 From: crc Date: Wed, 21 Nov 2018 23:47:02 +0000 Subject: [PATCH] muri: add support for new instructions FossilOrigin-Name: c5d5406bc2dad368ba2c935bdb824fcd989c2e215005dfca9a618b562dcadf72 --- literate/Muri.md | 17 +++++++++-------- tools/muri.c | 3 ++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/literate/Muri.md b/literate/Muri.md index b412861..9e8e195 100644 --- a/literate/Muri.md +++ b/literate/Muri.md @@ -22,13 +22,13 @@ You can specify them using the first two characters of the instruction name. For a non operation, use '..' instead of 'no'. - 0 nop 7 jump 14 gt 21 and - 1 lit 8 call 15 fetch 22 or - 2 dup 9 ccall 16 store 23 xor - 3 drop 10 return 17 add 24 shift - 4 swap 11 eq 18 sub 25 zret - 5 push 12 neq 19 mul 26 end - 6 pop 13 lt 20 divmod + 0 nop 7 jump 14 gt 21 and 28 iquery + 1 lit 8 call 15 fetch 22 or 29 iinteract + 2 dup 9 ccall 16 store 23 xor + 3 drop 10 return 17 add 24 shift + 4 swap 11 eq 18 sub 25 zret + 5 push 12 neq 19 mul 26 end + 6 pop 13 lt 20 divmod 27 ienum E.g., for a sequence of dup, multiply, no-op, drop: @@ -172,7 +172,8 @@ int32_t opcode_for(char *s) { if (strcmp(s, "di") == 0) return 20; if (strcmp(s, "an") == 0) return 21; if (strcmp(s, "or") == 0) return 22; if (strcmp(s, "xo") == 0) return 23; if (strcmp(s, "sh") == 0) return 24; if (strcmp(s, "zr") == 0) return 25; - if (strcmp(s, "en") == 0) return 26; + if (strcmp(s, "en") == 0) return 26; if (strcmp(s, "ie") == 0) return 27; + if (strcmp(s, "iq") == 0) return 28; if (strcmp(s, "ii") == 0) return 29; return 0; } ~~~ diff --git a/tools/muri.c b/tools/muri.c index 9db810d..c37a9a7 100644 --- a/tools/muri.c +++ b/tools/muri.c @@ -65,7 +65,8 @@ int32_t opcode_for(char *s) { if (strcmp(s, "di") == 0) return 20; if (strcmp(s, "an") == 0) return 21; if (strcmp(s, "or") == 0) return 22; if (strcmp(s, "xo") == 0) return 23; if (strcmp(s, "sh") == 0) return 24; if (strcmp(s, "zr") == 0) return 25; - if (strcmp(s, "en") == 0) return 26; + if (strcmp(s, "en") == 0) return 26; if (strcmp(s, "ie") == 0) return 27; + if (strcmp(s, "iq") == 0) return 28; if (strcmp(s, "ii") == 0) return 29; return 0; } void pass1(char *fname) {