diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-15 21:09:00 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-15 21:09:00 +0100 |
commit | 00517fddd68c3d46ad09bebe2c3ac38e791576f7 (patch) | |
tree | 33c71a2d59f402ad3cc996b0319e62da1bad6ce0 /src/inst.h | |
parent | 2bc20f07d3fcaf95e2e86dd03e44f8437489c352 (diff) | |
download | ovm-00517fddd68c3d46ad09bebe2c3ac38e791576f7.tar.gz ovm-00517fddd68c3d46ad09bebe2c3ac38e791576f7.tar.bz2 ovm-00517fddd68c3d46ad09bebe2c3ac38e791576f7.zip |
Added instructions for popping differing types
Bit mask is 100.
Diffstat (limited to 'src/inst.h')
-rw-r--r-- | src/inst.h | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -19,19 +19,22 @@ typedef enum { OP_NOOP = 0, - OP_PUSH_BYTE = 0b0001, - OP_PUSH_WORD = 0b0101, - OP_PUSH_FLOAT = 0b1001, - - OP_MOV_BYTE = 0b0010, - OP_MOV_WORD = 0b0110, - OP_MOV_FLOAT = 0b1010, + OP_PUSH_BYTE = 0b00000001, + OP_PUSH_WORD = 0b00000101, + OP_PUSH_FLOAT = 0b00001001, + OP_MOV_BYTE = 0b00000010, + OP_MOV_WORD = 0b00000110, + OP_MOV_FLOAT = 0b00001010, + OP_POP_BYTE = 0b00000100, + OP_POP_WORD = 0b00001100, + OP_POP_FLOAT = 0b00010100, OP_HALT, } opcode_t; #define OPCODE_IS_PUSH(OPCODE) (((OPCODE)&0b1) == 0b1) #define OPCODE_IS_MOV(OPCODE) (((OPCODE)&0b10) == 0b10) +#define OPCODE_IS_POP(OPCODE) (((OPCODE)&0b100) == 0b100) typedef struct { @@ -58,4 +61,13 @@ typedef struct #define INST_FMOV(FLOAT, REG) \ ((inst_t){.opcode = OP_MOV_FLOAT, .operand = DFLOAT(FLOAT), .reg = (REG)}) +#define INST_BPOP(BYTE) \ + ((inst_t){.opcode = OP_POP_BYTE, .operand = DBYTE(BYTE)}) + +#define INST_WPOP(WORD) \ + ((inst_t){.opcode = OP_POP_WORD, .operand = DWORD(WORD)}) + +#define INST_FPOP(FLOAT) \ + ((inst_t){.opcode = OP_POP_FLOAT, .operand = DFLOAT(FLOAT)}) + #endif |