Ostatnio aktywny 1733017220

capitalex's Avatar capitalex zrewidował ten Gist 1733017219. Przejdź do rewizji

1 file changed, 53 insertions

cups-bytecode-interpreter.nv(stworzono plik)

@@ -0,0 +1,53 @@
1 + |move instruction pointer|
2 + @instruction pointer
3 +
4 + |fetch next instruction|
5 + @decode instruction
6 +
7 + |@current instruction is halt|
8 +
9 + |@current instruction is inc|
10 + , @increment source register
11 + , @check if port was triggered
12 + , move instruction pointer:2
13 + , fetch next instruction
14 +
15 + |@current instruction is dec|
16 + , @decrement source register
17 + , move instruction pointer:2
18 + , fetch next instruction
19 +
20 + |@current instruction is cpy|
21 + , @copy source register to destination register
22 + , @check if port was triggered
23 + , move instruction pointer:3
24 + , fetch next instruction
25 +
26 + |@current instruction is mov|
27 + , @copy source register to destination register
28 + , @check if port was triggered
29 + , move instruction pointer:3
30 + , fetch next instruction
31 +
32 + |@current instruction is jze|
33 + , @check source register is zero
34 + , move to next instruction for jze
35 +
36 + |move to next instruction for jze, @soure register is zero|
37 + , @copy next bytecode to instruction pointer
38 +
39 + |move to next instruction for jze|
40 + , move instruction pointer:3
41 + , fetch next instruction
42 +
43 + |@current instruction is jmp|
44 + , @copy next bytecode to instruction pointer
45 +
46 + |@current instruction is set|
47 + , @set destination register to next bytecode
48 + , move instruction pointer:3
49 + , fetch next instruction
50 +
51 + |@current instruction is unknown|
52 + , move instruction pointer
53 + , fetch next instruction
Nowsze Starsze