forked from perfectconsulting/tile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
op_codes.h
107 lines (92 loc) · 3.1 KB
/
op_codes.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
* op_codes.h
* Version 1.00 (C99)
*
* Copyright 2015 Steven James (www.perfectconsulting.co.uk)
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OP_CODES_H
#define OP_CODES_H
#define VM_OPCODE_NOOP 0x00
#define VM_OPCODE_HAULT VM_OPCODE_NOOP + 1
#define VM_OPCODE_DEBUG VM_OPCODE_NOOP + 2
// NOOP
// NOOP
// NOOP
// NOOP
// NOOP
// NOOP
// NOOP
// NOOP
#define VM_OPCODE_DUP 0x0a
#define VM_OPCODE_SWAP VM_OPCODE_DUP + 1
#define VM_OPCODE_OVER VM_OPCODE_DUP + 2
#define VM_OPCODE_ROT VM_OPCODE_DUP + 3
#define VM_OPCODE_DROP VM_OPCODE_DUP + 4
#define VM_OPCODE_RESET VM_OPCODE_DUP + 5
#define VM_OPCODE_TOR VM_OPCODE_DUP + 6
#define VM_OPCODE_RFROM VM_OPCODE_DUP + 7
#define VM_OPCODE_RAT VM_OPCODE_DUP + 8
// NOOP
#define VM_OPCODE_LIT 0x14
#define VM_OPCODE_ADD VM_OPCODE_LIT + 1
#define VM_OPCODE_SUB VM_OPCODE_LIT + 2
#define VM_OPCODE_MUL VM_OPCODE_LIT + 3
#define VM_OPCODE_DIV VM_OPCODE_LIT + 4
#define VM_OPCODE_MOD VM_OPCODE_LIT + 5
// NOOP
// NOOP
// NOOP
// NOOP
#define VM_OPCODE_AND 0x1e
#define VM_OPCODE_OR VM_OPCODE_AND + 1
#define VM_OPCODE_XOR VM_OPCODE_AND + 2
#define VM_OPCODE_NOT VM_OPCODE_AND + 3
#define VM_OPCODE_EQUAL VM_OPCODE_AND + 4
#define VM_OPCODE_LESS VM_OPCODE_AND + 5
#define VM_OPCODE_GREATER VM_OPCODE_AND + 6
// NOOP
// NOOP
#define VM_OPCODE_FETCH 0x26
#define VM_OPCODE_CFETCH VM_OPCODE_FETCH + 1
#define VM_OPCODE_STORE VM_OPCODE_FETCH + 2
#define VM_OPCODE_CSTORE VM_OPCODE_FETCH + 3
// NOOP
// NOOP
// NOOP
// NOOP
#define VM_OPCODE_BRANCH 0x2e
#define VM_OPCODE_0BRANCH VM_OPCODE_BRANCH + 1
#define VM_OPCODE_JUMP VM_OPCODE_BRANCH + 2
#define VM_OPCODE_CALL VM_OPCODE_BRANCH + 3
#define VM_OPCODE_RET VM_OPCODE_BRANCH + 4
// NOOP
// NOOP
// NOOP
// NOOP
#define VM_OPCODE_EMIT 0x37
#define VM_OPCODE_KEY VM_OPCODE_EMIT + 1
#define VM_OPCODE_QKEY VM_OPCODE_EMIT + 2
#endif /* OP_CODES_H */