VM code rewriting.

The old code was a disaster, so I rewrote some parts of it.
I think that this code is waaay more readable than the old version.
No major VM behavior changes though - some functions have been renamed
and few things changed but nothing more (see vm_header.pas).