16-Bit Virtual Machine in JavaScript 001




In this episode we begin implementing a 16-bit virtual machine from scratch in JavaScript. The concepts of computation are introduced, along with the basics of assembly language and machine code.

=[ ℹ About ℹ ]=

This series is all about building a powerful virtual machine in JavaScript with the following features:

– A flexible, extensible, register-based virtual machine
– Support for signed, unsigned and floating point operations
– A call stack
– Interrupt capabilities
– Ability to do memory mapping for IO
– An assembly language with macro and module support
– A higher level, C like language. We’ll use and expand the library from the parser combinators from scratch series
– And finally, to be able to take the whole thing into the browser and exend it to create a sort of fantasy console – an emulator for a machine that never existed

=[ 🔗 Links 🔗 ]=

– ⭐️ Patreon: https://www.patreon.com/lowleveljavascript

– Playlist: https://www.youtube.com/playlist?list=PLP29wDx6QmW5DdwpdwHCRJsEubS5NrQ9b&playnext=1&index=1
– Github Repo: https://github.com/LowLevelJavaScript/16-Bit-Virtual-Machine

– 16BitJS: https://github.com/francisrstokes/16bitjs
– VMFC: https://github.com/francisrstokes/vmfc
– Turing Machine: https://en.wikipedia.org/wiki/Turing_machine
– Von Neumann architecture: https://en.wikipedia.org/wiki/Von_Neumann_architecture
– CPU: https://en.wikipedia.org/wiki/Central_processing_unit
– Stack Machine: https://en.wikipedia.org/wiki/Stack_machine
– Register Machine: https://en.wikipedia.org/wiki/Register_machine
– Instruction set architecture: https://en.wikipedia.org/wiki/Instruction_set_architecture

Original source


34 responses to “16-Bit Virtual Machine in JavaScript 001”

  1. Excuse me for being dim, but what is the point of all this? Is this solely for education/research or are there real-world applications for this? It seems very interesting, but I just can't work out why.

  2. Help me understand — In handling instruction 0x12 "add", aren't you getting the values in register1 and register2 already with the two calls to `this.fetch()` ? Why are those calls followed by the two lines where you directly reach into memory? scratches head

  3. First of all amazing job, the quality of the content is well high and I'm glad that I've randomly spotted this on reddit. On second hand at 6:26 you mention that you produced a previous video on array buffer which I cannot find. Would you mind to put the link in? Because I would love to check it out.

  4. > And the prospect of building something like this that is able to perform those functions sounds quite daunting
    I think I'm misunderstanding what you mean here, but isn't Brainfuck is like… close to if not the easiest to implement programming language in existence and meeting all of the requirements?

Leave a Reply