NAND2TETRIS: Hack-CPU 32-bit emulator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kaqu 2e4b5ae799 Superfluous GUI garbage removed 4 weeks ago
.vscode Sample included, icon added, README improved 1 month ago
OS_Test Sample included, icon added, README improved 1 month ago
doc hw docs added 1 month ago
rsc unsafe pointers (need for speed) 4 weeks ago
src Superfluous GUI garbage removed 4 weeks ago
.gitignore My 1st Rust program ... 2 months ago
Cargo.lock Removed old comments, used a global constant now! 4 weeks ago
Cargo.toml Removed old comments, used a global constant now! 4 weeks ago
README.md unsafe pointers (need for speed) 4 weeks ago

README.md

HE32, the emulator for a 32-bit version of the Hack CPU

This is a 32-bit version of the hack CPU (actually: a 19-bit version!) from the famous NAND2TETRIS course (https://www.nand2tetris.org/).

Motivation

If you want to run your full blown OS together w/ a somewhat larger application you'll soon find out, that it would require considerably more memory than the original 'ROM' size permits. The original (Java-)emulator does not support it. You will have to write your own emulator & that's what this is all about!

Features:

256KB ROM, 64KB RAM, >65 MegaInstructions/s (just about enough to play 'Pong'!)

Modifications

It's input file is a 32-bit variant of the original *.hack file 'binary' text output, the extension used shall be *.hack32. NOTE: You will have to adapt your hack assembler source to cope with 18-bit addresses (hence 256KB ROM) and 18-bit PC, A & D registers.

Hack OS modifications: Sys.jack: The emulator requires the modification of Sys.wait (simply return immediately) - if you don't want to wait forever ... Math.jack: Math.multiply will require adjustment to use 18 bits.

Usage

Usage is dead simple: he32 <hack32_filename>

Prerequisites

The application uses the Qt5-GUI. Several qt5 packages are required (sudo apt-get install ). On my machine these are:

libqt5concurrent5, libqt5core5a libqt5dbus5 libqt5designer5 libqt5gui5 libqt5help5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5test5 libqt5webkit5 libqt5widgets5 libqt5xml5 libqwt-qt5-6 libsignon-qt5-1 qt5-gtk-platformtheme qt5-style-plugins qt5ct qttranslations5-l10n

Hint: It is recommended to run actual applications as release-builds only, you may experience poor performance otherwise. Use:

cargo run --release ./OS_Test/OS_Test.hack32

You may also modify the 'Look' via qt5ct ...

Have fun!