Changed the way jumps are generated to avoid generating jumps to the
[sixpic.git] / tests / general / vm.c
blob55eb8ec45a50d9befb4811da3a150c4e9ba8cfed
1 // little virtual machine
2 int acc1;
3 int acc2;
4 acc1 = 0;
5 acc2 = 0;
7 void dispatch (int instr){
8 switch (instr){
9 case 0:
10 acc1 = 0;
11 acc2 = 0;
12 break;
13 case 1:
14 acc1++;
15 break;
16 case 2:
17 acc2++;
18 break;
19 case 3:
20 acc2 = acc1;
21 break;
22 case 4:
23 acc1 = acc1 + acc2;
24 break;
28 dispatch(1);
29 dispatch(1);
30 dispatch(2);
31 dispatch(4);
32 dispatch(3);