6 ms·
16-Bit VM in JavaScript
- pjmlp 9y agoVery interesting read and props for choosing opcode D, S.
- FrancisStokes 9y agoThanks, I've had mixed feedback about that choice!
- mysterydip 9y agoSomething I've always wanted to do (16 bit as well, even) but never got around to. Thanks for the writeup!
- jasonhansel 9y agoCongratulations! I've been working on a similar (though less well-documented) project in Rust: https://github.com/jasonhansel/kineticvm https://github.com/jasonhansel/kineticvm
- FrancisStokes 9y agoAh very cool! Rust seems like an awesome language, especially for something like this. I'l going to take a dive into your project at some point in the week
- carussell 9y agoProps for choosing `->` instead of either of the historical mistakes `opcode s, d` or `opcode d, s`.
- orionblastar 9y agoThis is in a way that they make emulators in Javascript like that too? Might be possible to emulate Mame and Mess machines if they haven't already?
- khedoros1 9y agoYes, there are some similarities to how you would write an emulator for a real piece of hardware. It would be possible to write an emulator for whatever hardware you can find enough information about.
- FrancisStokes 9y agoIndeed, the core concepts are essentially exactly the same. This is a lot simpler of course because it doesn't need to do anything with drawing or sound. I really like this project https://github.com/juchi/gameboy.js/ https://github.com/juchi/gameboy.js/ . I'd like to do something similar myself but more in the coding style I've used on the 16-bit VM.
- m1dnigh7 9y agoIs this a VM in the sense the JVM is a VM, or is it a VM in the sense of a CPU emulator? It seems to be the former, but I'm not well read in VM implementation.
- gmiller123456 9y agoThat's a very fuzzy, if not non-existent, distinction. The only real difference is the designers' original intention. Of course the Java VM was originally only destined to exist only in software, but hardware versions do exists [1]. And of course x86 was always destined for hardware, but there's more software implementations of that than can be counted. There's also a third type in the LLVM sense, where the VM is just an intermediate step in compiling from a high level language down to machine code. And that's where the JVM (mostly) falls today. The VM described in the OP could easily fit in any of the three. [1] http://www.jopdesign.com/ http://www.jopdesign.com/