diff --git a/VaninVM/Main.c b/VaninVM/Main.c index daa0427..85ed4f4 100644 --- a/VaninVM/Main.c +++ b/VaninVM/Main.c @@ -1,5 +1,6 @@ #include "IOcode.h" #include "TOS.h" +#include "OpCode.h" int main(int argc, char** argv) @@ -19,12 +20,32 @@ int main(int argc, char** argv) { switch (code[ip]) { - case 1: - push_double(12.1); - ip++; - break; + case DLOAD0: + // DO(DLOAD0, "Load double 0 on TOS.", 1) + push_double(0); + ip++; break; + case ILOAD0: + //DO(ILOAD0, "Load int 0 on TOS.", 1) + push_int(0); + ip++; break; + case DLOAD1: + //DO(DLOAD1, "Load double 1 on TOS.", 1) + push_double(1); + ip++; break; + case ILOAD1: + //DO(ILOAD1, "Load int 1 on TOS.", 1) + push_int(1); + ip++; break; + case DLOADM1: + //DO(DLOADM1, "Load double -1 on TOS.", 1) + push_double(-1); + ip++; break; + case ILOADM1: + //DO(ILOADM1, "Load int -1 on TOS.", 1) + push_int(-1); + ip++; break; - case 78: + case STOP: exec_status = 0; break; } diff --git a/VaninVM/OpCode.h b/VaninVM/OpCode.h new file mode 100644 index 0000000..ae42a0f --- /dev/null +++ b/VaninVM/OpCode.h @@ -0,0 +1,13 @@ +#ifndef OPCODE_H +#define OPCODE_H +enum opcode +{ + DLOAD0, + ILOAD0, + DLOAD1, + ILOAD1, + DLOADM1, + ILOADM1, + STOP +}; +#endif \ No newline at end of file