2023-03-31 11:52:04 +02:00
|
|
|
package vm
|
|
|
|
|
|
|
|
const VERSION = 0
|
|
|
|
|
2023-04-02 13:12:06 +02:00
|
|
|
type Opcode uint16
|
|
|
|
|
2023-04-02 00:42:34 +02:00
|
|
|
// VM Opcodes
|
2023-03-31 11:52:04 +02:00
|
|
|
const (
|
2023-04-02 13:20:35 +02:00
|
|
|
NOOP = 0
|
2023-04-01 22:25:20 +02:00
|
|
|
CATCH = 1
|
|
|
|
CROAK = 2
|
|
|
|
LOAD = 3
|
|
|
|
RELOAD = 4
|
|
|
|
MAP = 5
|
|
|
|
MOVE = 6
|
|
|
|
HALT = 7
|
2023-04-01 23:19:12 +02:00
|
|
|
INCMP = 8
|
2023-04-03 00:53:21 +02:00
|
|
|
MSIZE = 9
|
|
|
|
MOUT = 10
|
2023-04-08 10:31:32 +02:00
|
|
|
MNEXT = 11
|
|
|
|
MPREV = 12
|
|
|
|
_MAX = 12
|
2023-03-31 11:52:04 +02:00
|
|
|
)
|
2023-04-02 16:00:56 +02:00
|
|
|
|
|
|
|
var (
|
|
|
|
OpcodeString = map[Opcode]string{
|
|
|
|
NOOP: "NOOP",
|
|
|
|
CATCH: "CATCH",
|
|
|
|
CROAK: "CROAK",
|
|
|
|
LOAD: "LOAD",
|
|
|
|
RELOAD: "RELOAD",
|
|
|
|
MAP: "MAP",
|
|
|
|
MOVE: "MOVE",
|
|
|
|
HALT: "HALT",
|
|
|
|
INCMP: "INCMP",
|
2023-04-03 00:53:21 +02:00
|
|
|
MSIZE: "MSIZE",
|
|
|
|
MOUT: "MOUT",
|
2023-04-08 10:31:32 +02:00
|
|
|
MNEXT: "MNEXT",
|
|
|
|
MPREV: "MPREV",
|
2023-04-02 16:00:56 +02:00
|
|
|
}
|
2023-04-04 11:38:01 +02:00
|
|
|
|
|
|
|
OpcodeIndex = map[string]Opcode {
|
|
|
|
"NOOP": NOOP,
|
|
|
|
"CATCH": CATCH,
|
|
|
|
"CROAK": CROAK,
|
|
|
|
"LOAD": LOAD,
|
|
|
|
"RELOAD": RELOAD,
|
|
|
|
"MAP": MAP,
|
|
|
|
"MOVE": MOVE,
|
|
|
|
"HALT": HALT,
|
|
|
|
"INCMP": INCMP,
|
|
|
|
"MSIZE": MSIZE,
|
|
|
|
"MOUT": MOUT,
|
2023-04-08 10:31:32 +02:00
|
|
|
"MNEXT": MNEXT,
|
|
|
|
"MPREV": MPREV,
|
2023-04-04 11:38:01 +02:00
|
|
|
}
|
|
|
|
|
2023-04-02 16:00:56 +02:00
|
|
|
)
|