diff options
Diffstat (limited to 'src/opcodes.rs')
-rw-r--r-- | src/opcodes.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/opcodes.rs b/src/opcodes.rs new file mode 100644 index 0000000..e8ef7fe --- /dev/null +++ b/src/opcodes.rs @@ -0,0 +1,28 @@ +use opcode_proc::generate_opcodes; + +generate_opcodes!( + pub enum OpCodes { + #[code(0x00)] + fn Nop() { + + }, + + #[code(0x10)] + fn Add(a: u32, b: u32) -> u32 { + a + b + }, + + #[code(0x11)] + fn Sub(a: u32, b: u32) -> u32 { + a - b + }, + + #[code(0x23)] + fn Jnz(&mut interpreter, comparison: u32, offset: u32) { + if comparison != 0 { + interpreter.reg_program += offset; + } + } + } +); + |