aboutsummaryrefslogtreecommitdiffstats
path: root/creole.h
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2023-02-11 20:49:39 +0000
committerGravatar Peter McGoron 2023-02-11 20:49:39 +0000
commit5f3275cf2d3e1f371595f3ef15831e2ee788f780 (patch)
tree97b2bbe678cc5f45aaca568ff5d4c9edd3a41005 /creole.h
parentmore test (diff)
add signed division IDIV
Diffstat (limited to '')
-rw-r--r--creole.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/creole.h b/creole.h
index ba10dda..0e84a72 100644
--- a/creole.h
+++ b/creole.h
@@ -7,11 +7,14 @@
#ifndef CREOLE_WORD
# define CREOLE_WORD unsigned int
# define CREOLE_WORD_MAX UINT_MAX
+# define CREOLE_SIGNED_WORD int
+# define CREOLE_SIGNED_MAX INT_MAX
#endif
#define CREOLE_MAX_ARG 3
typedef CREOLE_WORD creole_word;
+typedef CREOLE_SIGNED_WORD creole_signed;
enum creole_opcode {
CREOLE_NOOP = 0,
@@ -20,9 +23,10 @@ enum creole_opcode {
CREOLE_ADD = 3,
CREOLE_MUL = 4,
CREOLE_DIV = 5,
- CREOLE_JL = 6,
- CREOLE_CLB = 7,
- CREOLE_SYS = 8,
+ CREOLE_IDIV = 6,
+ CREOLE_JL = 7,
+ CREOLE_CLB = 8,
+ CREOLE_SYS = 9,
CREOLE_OPCODE_LEN
};
@@ -56,6 +60,7 @@ enum creole_run_ret {
CREOLE_RUN_LABEL_OVERFLOW,
CREOLE_REGISTER_OVERFLOW,
CREOLE_STEP_UNKNOWN_OPCODE,
+ CREOLE_DIV_BY_ZERO,
CREOLE_RUN_RET_LEN
};