-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstructions.h
42 lines (36 loc) · 874 Bytes
/
instructions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
enum impl_instr {
NOP = 0, /* no-op */
/* Registers/stack */
PUSH, /* push a constant */
POP, /* pop from stack */
POPS, /* pop from the stack into register no. (argument) */
STORE, /* save to register no. (argument) */
LOAD, /* push from register no. (argument) */
/* Arithmetic */
/* pop twice, do operation then push */
ADD,
SUB,
MUL,
DIV,
REM, /* remainder */
/* Bitwise operators */
/* pop, do operation, then push */
NOT,
AND, /* pop twice */
OR, /* pop twice */
XOR, /* pop twice */
LSHFT, /* pop once, shift popped by arg */
RSHFT, /* pop once, shift popped by arg */
/* Flow control */
JMP, /* jump to line arg */
IFEQ, /* pop twice, jump to line arg if equal */
IFNEQ,
IFZ, /* pop once, jump to line arg if zero */
IFNZ,
/* I/O */
PRINT, /* print top of stack */
PRINC,
POPP, /* print top of stack and pop */
POPPC,
DONE
};