I ported the Nand to Tetris Emulator to the Web

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

I ported the Nand to Tetris Emulator to the Web

Arch
This post was updated on .
I am proud to present my solo hobby project NAND. This year-long undertaking follows the completed Nand to Tetris course, but ported to the web with its own runtime, user interface, and IDE. You can try out some example programs I wrote in Jack on NAND such as 2048, a genetic algorithm, and a manual stack overflow to corrupt the screen.

Check out NAND at https://nand.arhan.sh and its repository at https://github.com/ArhanChaudhary/NAND

Additionally, I've authored an extensive writeup about the project. Read about it on the README.
Reply | Threaded
Open this post in threaded view
|

Re: I ported the Nand to Tetris Emulator to the Web

dolomiti7
Wow, great work! Really well done!

I see that you are also using compressed constants for the charset to reduce the size of Output - so I'm not the only one doing this :-) In addition to packing bits of multiple characters into a constant, I am using a simple RLE encoding. Depending on the type of encoding, I ended up with 285 or 315 constants for the whole charset (one version for "normal" translation and one version which works better with threaded code. If I see it correctly, you are using 96*4=384 constants instead of the 96*12=1152 constants of the original implementation, which gives you already a significant reduction in size.

One thing I don't understand: why are you poking a value into the Keyboard I/O address on Sys.halt? I guess that is for debugging purposes, but shouldn't that address be read-only by default (and consequently that RAM address shows still 0 even after the halt)?

Other than that: I also used green on black for my own emulator as default, though you have to be aware that it implicitly inverses the Hack specification. I only realized that with the Chess program, where the board and piece colors were flipped... Perhaps you could add a color select option.

And finally: if there was an option to load ASM or BIN code directly into the emulator, this would become my favorite nand2tetris IDE ;-)
Reply | Threaded
Open this post in threaded view
|

Re: I ported the Nand to Tetris Emulator to the Web

Arch
I'm poking the value 32767 into the Keyboard address on Sys.halt as a poor-man's flag to tell the runtime when to stop. The runtime polls for this value at this memory address, and I didn't want to introduce another memory address to remain spec-compliant. After the halt, it's instantly set back to 0 when this flag is enabled to reset it.

I'm not sure if a color selector is really needed, but I could definitely look into an ASM or BIN loader which would be trivially easy to implement in terms of code.
Reply | Threaded
Open this post in threaded view
|

Re: I ported the Nand to Tetris Emulator to the Web

Arch
In reply to this post by Arch
Also, woohoo for Nand to Tetris! My project was #1 on Hacker news for half a day and the repository has gained over 300 stars. I'm so grateful for this course and its opportunities
Reply | Threaded
Open this post in threaded view
|

Re: I ported the Nand to Tetris Emulator to the Web

Renslay
In reply to this post by Arch
That is a marvelous emulator! Love it <3 Excellent job!