summary refs log tree commit diff
path: root/src/opcodes.rs
blob: e8ef7fe1ec0ec4858191ae073449e5bc8e864a9f (plain)
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;
            }
        }
    }
);