I'm looking to build a Virtual Machine as a platform independent way to run some game code (essentially scripting).

The Virtual Machines that I'm aware of in games are rather old: Infocom's [Z-Machine](https://en.wikipedia.org/wiki/Z-machine), LucasArts' [SCUMM](https://en.wikipedia.org/wiki/SCUMM), id Software's [Quake 3](https://en.wikipedia.org/wiki/Quake_3). As a .net Developer, I'm familiar with the [CLR](https://en.wikipedia.org/wiki/Common_Language_Runtime) and looked into the [CIL Instructions](https://en.wikipedia.org/wiki/List_of_CIL_instructions) to get an overview of what you actually implement on a VM Level (vs. the language level). I've also dabbled a bit in [6502 Assembler](https://en.wikipedia.org/wiki/6502) during the last year.

The thing is, now that I want¹ to implement one, I need to dig a bit deeper. I know that there are stack based and register based VMs, but I don't really know which one is better at what and if there are more or hybrid approaches. I need to deal with memory management, decide which low level types are part of the VM and need to understand *why* stuff like [ldstr](http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes.ldstr.aspx) works the way it does.

My only reference book (apart from the Z-Machine stuff) is the [CLI Annotated Standard](http://rads.stackoverflow.com/amzn/click/0321154932), but I wonder if there is a better, more general/fundamental lecture for VMs? Basically something like the [Dragon Book](https://en.wikipedia.org/wiki/Compilers%3a_Principles,_Techniques,_and_Tools), but for VMs? I'm aware of Donald Knuth's [Art of Computer Programming](https://en.wikipedia.org/wiki/The_Art_of_Computer_Programming) which uses a register-based VM, but I'm not sure how applicable that series still is, especially since it's still unfinished?

Clarification: The goal is to build a specialized VM. For example, Infocom's Z-Machine contains OpCodes for setting the Background Color or playing a sound. So I need to figure out how much goes into the VM as OpCodes vs. the compiler that takes a script (language TBD) and generates the bytecode from it, but for that I need to understand what I'm really doing.

---

¹ I know, modern technology would allow me to just interpret a high level scripting language on the fly. But where is the fun in that? :) It's also a bit hard to google because Virtual Machines is nowadays often associated with VMWare-type OS Virtualization...