diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-16 00:59:30 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-16 01:05:42 +0100 |
commit | 0f37a5994046a06cf086b6ac4af62620c5881fc7 (patch) | |
tree | c1ce6a8704a746fdac104c75e5b95e69d32b3380 /src/inst.h | |
parent | cd19f1e1d30f52c073b6871c436e770ce2ffdda0 (diff) | |
download | ovm-0f37a5994046a06cf086b6ac4af62620c5881fc7.tar.gz ovm-0f37a5994046a06cf086b6ac4af62620c5881fc7.tar.bz2 ovm-0f37a5994046a06cf086b6ac4af62620c5881fc7.zip |
MOV now uses the stack, removed register member in inst_t
Instead of taking an operand and a register, mov just uses the stack
for the operand. Therefore, there's no need for a register member in
inst_t.
As a result, PUSH_*_REGISTER now uses the operand for the register.
Diffstat (limited to 'src/inst.h')
-rw-r--r-- | src/inst.h | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -54,7 +54,6 @@ typedef struct { opcode_t opcode; data_t operand; - byte reg; // At most 255 registers } inst_t; #define INST_BPUSH(BYTE) \ @@ -66,14 +65,11 @@ typedef struct #define INST_FPUSH(FLOAT) \ ((inst_t){.opcode = OP_PUSH_FLOAT, .operand = DFLOAT(FLOAT)}) -#define INST_BMOV(BYTE, REG) \ - ((inst_t){.opcode = OP_MOV_BYTE, .operand = DBYTE(BYTE), .reg = (REG)}) +#define INST_BMOV(REG) ((inst_t){.opcode = OP_MOV_BYTE, .operand = DWORD(REG)}) -#define INST_WMOV(WORD, REG) \ - ((inst_t){.opcode = OP_MOV_WORD, .operand = DWORD(WORD), .reg = (REG)}) +#define INST_WMOV(REG) ((inst_t){.opcode = OP_MOV_WORD, .operand = DWORD(REG)}) -#define INST_FMOV(FLOAT, REG) \ - ((inst_t){.opcode = OP_MOV_FLOAT, .operand = DFLOAT(FLOAT), .reg = (REG)}) +#define INST_FMOV(REG) ((inst_t){.opcode = OP_MOV_FLOAT, .operand = DWORD(REG)}) #define INST_BPOP ((inst_t){.opcode = OP_POP_BYTE}) @@ -82,12 +78,12 @@ typedef struct #define INST_FPOP ((inst_t){.opcode = OP_POP_FLOAT}) #define INST_BPUSH_REG(REG) \ - ((inst_t){.opcode = OP_PUSH_BYTE_REGISTER, .reg = (REG)}) + ((inst_t){.opcode = OP_PUSH_BYTE_REGISTER, .operand = DWORD(REG)}) #define INST_WPUSH_REG(REG) \ - ((inst_t){.opcode = OP_PUSH_WORD_REGISTER, .reg = (REG)}) + ((inst_t){.opcode = OP_PUSH_WORD_REGISTER, .operand = DWORD(REG)}) #define INST_FPUSH_REG(REG) \ - ((inst_t){.opcode = OP_PUSH_FLOAT_REGISTER, .reg = (REG)}) + ((inst_t){.opcode = OP_PUSH_FLOAT_REGISTER, .operand = DWORD(REG)}) #endif |