News for hackers. Stuff that matters.
Re:Show HN: A small virtual machine written in C by panic on Monday August 04, 2014 @02:18AM (#8130593)
The implementation is really clean! The mixing of general-purpose registers, special-purpose registers and the stack makes the instruction set a bit weird, though.

For example, instead of using registers, why not have OR pick values off the stack like ADD, or vice versa? Why use EAX for the conditional jump instructions when you could look at the top of the stack? Why have REM when you can just MOV from ERX?

Re:Show HN: A small virtual machine written in C by tekknolagi on Monday August 04, 2014 @02:20AM (#8130598)
You know, I was thinking about that this morning actually. All great suggestions! If you could make an issue, that would be fantastic.
Re:Show HN: A small virtual machine written in C by tekknolagi on Monday August 04, 2014 @02:38AM (#8130636)
I just changed OR/XOR/AND to be stack based, and good idea for the jump instructions.