Files
rasp/src/vm/inst.rs

40 lines
849 B
Rust
Raw Normal View History

macro_rules! instructions {
{
$($variant:ident = $value:expr),* $(,)?
} => {
pub type InstOp = u16;
$(
pub const $variant: InstOp = $value;
)*
};
}
instructions! {
ADD = 0x0000,
MUL = 0x0001,
DIV = 0x0002,
MOD = 0x0003,
INEG = 0x0004,
AND = 0x0005,
OR = 0x0006,
INV = 0x0007,
NOT = 0x0008,
XOR = 0x0009,
SHL = 0x000a,
SHR = 0x000b,
CMPEQ = 0x1000,
CMPLT = 0x1001,
JMP = 0x1100,
JZ = 0x1101,
JNZ = 0x1102,
LOAD = 0x2000,
REGCOPY = 0x2001,
STOREIMM64 = 0x2100,
STOREIMM32 = 0x2101,
MEMCOPY = 0x2200,
STORE = 0x2201,
HALT = 0xF000,
NOP = 0xF001,
}