Hello Mirar,
thank you again for your answer.
I also thought that it would be easier to generate byte code for a
register based VM.
But then the interpreter, would be slower and more comlicated.
For example for an i386 style asm code: "mov ax, bx" in the byte code
i should generate
- the opcode for move
- then bitfields where i specify that the move is between ax and bx
(in our case)
Decoding this in the interpreter would take more processing time than
in a stack based machine.
There I don't need to decode anything in this way, only to make a
switch by the opcodes and do the corresponding operations.
Do you have an idea how i could encode/decode the registers/immediate
values, without too much processing time?