Added new experimental VM from Mat. This is the 'faster vm' option.
[retro/experimental.git] / ngaro / c-mat / vm.h
blob7dbd6922715b84b4cb71cd39efc30e1f29df12f6
1 #ifndef NGARO_HEADER
2 #define NGARO_HEADER
4 enum vm_opcode {VM_NOP, VM_LIT, VM_DUP, VM_DROP, VM_SWAP, VM_PUSH, VM_POP,
5 VM_CALL, VM_JUMP, VM_RETURN, VM_GT_JUMP, VM_LT_JUMP,
6 VM_NE_JUMP, VM_EQ_JUMP, VM_FETCH, VM_STORE, VM_ADD,
7 VM_SUB, VM_MUL, VM_DIVMOD, VM_AND, VM_OR, VM_XOR, VM_SHL,
8 VM_SHR, VM_ZERO_EXIT, VM_INC, VM_DEC, VM_IN, VM_OUT,
9 VM_WAIT, VM_PICK, VM_BACK, VM_ROT, VM_SINST, VM_XOP, VM_EXE,
10 VM_LI_IAC, VM_LI_IOP, VM_PICK_IAC, VM_PICK_IOP, VM_RADD,
11 VM_RSUB, VM_RMUL, VM_RAND, VM_ROR, VM_RXOR, VM_LCALL,
12 VM_LRETURN, VM_DEFAULT};
14 #define NUM_OPS 51
16 #define MAX_STREAM 255
17 #define STREAM_LEN 1024
18 #define IMAGE_SIZE 5000000
19 #define STACK_DEPTH 100
20 #define ADDRESSES 1024
22 #define CELL int
24 #define NEXT goto *INST = vm_process_ct_otab[vm.image[ip++]];
25 #define TNEXT goto **TINST++;
27 typedef struct {
28 int sp;
29 int rsp;
30 int ip;
31 int data[STACK_DEPTH];
32 int address[ADDRESSES];
33 int ports[1024];
34 int image[IMAGE_SIZE];
35 int padding;
36 char filename[2048];
37 } VM_STATE;
39 #endif