diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-16 01:06:02 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-16 01:06:02 +0100 |
commit | a24a096e2a6fb8c48ae5a71673e82dccb627c2b9 (patch) | |
tree | e3a1cf2945b419247e08b18f489f75a7990e8197 | |
parent | 0f37a5994046a06cf086b6ac4af62620c5881fc7 (diff) | |
download | ovm-a24a096e2a6fb8c48ae5a71673e82dccb627c2b9.tar.gz ovm-a24a096e2a6fb8c48ae5a71673e82dccb627c2b9.tar.bz2 ovm-a24a096e2a6fb8c48ae5a71673e82dccb627c2b9.zip |
Made OP_HALT the only instruction to have the top byte filled
-rw-r--r-- | src/inst.h | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -36,19 +36,20 @@ typedef enum OP_MOV_WORD = 0b00011000, OP_MOV_FLOAT = 0b00101000, - OP_HALT, + OP_HALT = 0b10000000, // top of the byte is a HALT } opcode_t; // Masks and values to check if an opcode is of a type typedef enum { - OP_TYPE_PUSH = 0b1, - OP_TYPE_PUSH_REGISTER = 0b10, - OP_TYPE_POP = 0b100, - OP_TYPE_MOV = 0b1000, + OP_TYPE_PUSH = 0b00000001, + OP_TYPE_PUSH_REGISTER = 0b00000010, + OP_TYPE_POP = 0b00000100, + OP_TYPE_MOV = 0b00001000, + OP_TYPE_HALT = 0b10000000, } opcode_type_t; -#define OPCODE_IS_TYPE(OPCODE, TYPE) ((OPCODE & TYPE) == TYPE) +#define OPCODE_IS_TYPE(OPCODE, OP_TYPE) (((OPCODE) & (OP_TYPE)) == (OP_TYPE)) typedef struct { |