My try to implement a virtual CPU in C
More details on my blog article.
This VM implements the following features:
-
mov reg, reg/val
-
add reg, reg/val
-
sub reg, reg/val
-
exit
-
cmp reg, reg/val
-
push reg/val
-
pop reg
-
jmp addr
-
call label
- Registers
-
a b c d
: common operations
-
- Flags (one register with flags in it)
- Zero flag
0x10000000
- Zero flag
- Virtual stack
- Virtual heap