summaryrefslogtreecommitdiff
path: root/vm/opcodes.go
diff options
context:
space:
mode:
authorstefan <stefan@s00.xyz>2023-05-24 08:32:08 -0400
committerstefan <stefan@s00.xyz>2023-05-24 08:32:08 -0400
commitba2b9c8a1bb1876b6eb4c9783fde798b19de4418 (patch)
tree9b49307112b0f489189cf65c1b50dd281f8e430f /vm/opcodes.go
parentc30e7f5f99f9ad4d9552b645d7b89d7385972f99 (diff)
downloadevm-ba2b9c8a1bb1876b6eb4c9783fde798b19de4418.tar.gz
init
Diffstat (limited to 'vm/opcodes.go')
-rw-r--r--vm/opcodes.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/vm/opcodes.go b/vm/opcodes.go
new file mode 100644
index 0000000..b3d4229
--- /dev/null
+++ b/vm/opcodes.go
@@ -0,0 +1,57 @@
+package main
+
+type Opcode byte
+
+const (
+ STOP = iota
+ ADD
+ MUL
+ SUB
+ DIV
+ SDIV
+ MOD
+ SMOD
+ ADDMOD
+ MULMOD
+ POP = 0x50
+ MLOAD = 0x51
+ MSTORE = 0x52
+ MSTORE8 = 0x53
+ PUSH1 = 0x60
+ PUSH2 = 0x61
+ PUSH3 = 0x62
+ PUSH4 = 0x63
+ PUSH5 = 0x64
+ PUSH6 = 0x65
+ PUSH7 = 0x66
+ PUSH8 = 0x67
+ PUSH9 = 0x68
+ PUSH10 = 0x69
+ PUSH11 = 0x6a
+ PUSH12 = 0x6b
+ PUSH13 = 0x6c
+ PUSH14 = 0x6d
+ PUSH15 = 0x6e
+ PUSH16 = 0x6f
+ PUSH17 = 0x70
+ PUSH18 = 0x71
+ PUSH19 = 0x72
+ PUSH20 = 0x73
+ PUSH21 = 0x74
+ PUSH22 = 0x75
+ PUSH23 = 0x76
+ PUSH24 = 0x77
+ PUSH25 = 0x78
+ PUSH26 = 0x79
+ PUSH27 = 0x7a
+ PUSH28 = 0x7b
+ PUSH29 = 0x7c
+ PUSH30 = 0x7d
+ PUSH31 = 0x7e
+ PUSH32 = 0x7f
+ //...
+)
+
+func (op *Opcode) String() string {
+ return Instructions[*op].name
+}