News for hackers. Stuff that matters.
Re:16-Bit VM in JavaScript by mysterydip on Saturday July 22, 2017 @08:01PM (#14830125)
Something I've always wanted to do (16 bit as well, even) but never got around to. Thanks for the writeup!
Re:16-Bit VM in JavaScript by jasonhansel on Saturday July 22, 2017 @10:42PM (#14830636)
Congratulations! I've been working on a similar (though less well-documented) project in Rust: https://github.com/jasonhansel/kineticvm
Re:16-Bit VM in JavaScript by FrancisStokes on Sunday July 23, 2017 @03:27AM (#14831257)
Ah 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
Re:16-Bit VM in JavaScript by carussell on Sunday July 23, 2017 @04:22PM (#14834196)
Props for choosing `->` instead of either of the historical mistakes `opcode s, d` or `opcode d, s`.
Re:16-Bit VM in JavaScript by m1dnigh7 on Monday July 24, 2017 @12:50AM (#14835956)
Is 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.

Re:16-Bit VM in JavaScript by gmiller123456 on Tuesday July 25, 2017 @02:04PM (#14850252)
That'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/

Re:16-Bit VM in JavaScript by orionblastar on Saturday July 22, 2017 @10:48PM (#14830653)
This 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?
Re:16-Bit VM in JavaScript by FrancisStokes on Sunday July 23, 2017 @03:33AM (#14831276)
Indeed, 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/ . I'd like to do something similar myself but more in the coding style I've used on the 16-bit VM.

Re:16-Bit VM in JavaScript by khedoros1 on Sunday July 23, 2017 @02:51AM (#14831168)
Yes, 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.
Re:16-Bit VM in JavaScript by pjmlp on Saturday July 22, 2017 @03:00PM (#14828738)
Very interesting read and props for choosing opcode D, S.
Re:16-Bit VM in JavaScript by FrancisStokes on Sunday July 23, 2017 @03:34AM (#14831279)
Thanks, I've had mixed feedback about that choice!