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
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; } } } );