Added opcode OP_DUP_*
Duplicates the nth datum off the stack, pushing it to the top. Useful for operations such as MOV which eat the stack.
This commit is contained in:
@@ -40,6 +40,10 @@ typedef enum
|
||||
OP_MOV_HWORD,
|
||||
OP_MOV_WORD,
|
||||
|
||||
OP_DUP_BYTE,
|
||||
OP_DUP_HWORD,
|
||||
OP_DUP_WORD,
|
||||
|
||||
// Boolean operations
|
||||
OP_NOT_BYTE,
|
||||
OP_NOT_HWORD,
|
||||
@@ -108,6 +112,9 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *);
|
||||
#define INST_PUSH_REG(TYPE, REG) \
|
||||
((inst_t){.opcode = OP_PUSH_REGISTER_##TYPE, .operand = D##TYPE(REG)})
|
||||
|
||||
#define INST_DUP(TYPE, OP) \
|
||||
((inst_t){.opcode = OP_DUP_##TYPE, .operand = DWORD(OP)})
|
||||
|
||||
#define INST_NOT(TYPE) ((inst_t){.opcode = OP_NOT_##TYPE})
|
||||
#define INST_OR(TYPE) ((inst_t){.opcode = OP_OR_##TYPE})
|
||||
#define INST_AND(TYPE) ((inst_t){.opcode = OP_AND_##TYPE})
|
||||
|
||||
Reference in New Issue
Block a user