Closed DavidSouther closed 3 months ago
Hi~ I just wanted to put it out there that I have a VM implementation for this that I think could potentially be useful. It was pretty... minimal to say the least and it has been a few years since I did the implementation (prior to me using TS much).
Either way, you can find it here: https://github.com/Goblinlordx/hvm/blob/master/packages/vm/
Really, the core is here: https://github.com/Goblinlordx/hvm/blob/master/packages/vm/VM.js
Nice, glad to see more of these!
The link you sent looks like an implementation of the nand2tetris CPU (chapter 4 and 5); this issue is meant to capture the VM described in chapters 7 and 8.
Hmmm~ I will need to check the book references. It was intended to simulate all the hardware and run actual code with video output and inputs. The "video" output just copies the framebuffer data and renders to a 2d canvas context. There is also functionality for dumping memory and registers for introspection and/or live view of those when running. Though I never did get around to implementing a "real" usable UI for it.
Ah~ I understand (looking back at the book). Sorry~ My misunderstanding.
No worries, you at least poked me enough to add some details to the issue! :)
Implement the Stack Virtual Machine from chapters 7 and 8, and page like the VM emulator stand-alone app.
Basic:
Control:
Tests: