Skip to content

This is the implementation of an assembler for the HACK machine language for project 6 of nand2tetris. The assembler uses two arguments, the first is the folder name that contains the assembly, the second is the .asm file. The assembler creates the .hack file in the folder. Run it as : lua assembler.lua <folder_name> <file.asm>

Notifications You must be signed in to change notification settings

YasseenRamadan2005/HACK-assembler-implentation-in-Lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HACK-assembler-implentation-in-Lua

This is the implementation of an assembler for the HACK machine language for project 6 of nand2tetris. The assembler uses two arguments, the first is the folder name that contains the assembly, the second is the .asm file. The assembler creates the .hack file in the folder. Run it as : lua assembler.lua <folder_name> <file.asm>

This is my first non-trivial coding project, so any helpful advice is appreciated. Pong.asm takes ~4.5 seconds to assemble, and I'm interested in shaving down that time as much as I can in lua.

PS: The Lua program needs the LuaFileSystem library. You can install it by doing - luarocks install luafilesystem

Edit: Got it to less than a second for Pong :)

Edit2: Now .048 seconds. Use sudo luarocks install bitlib to install the bitshifting library

Documentation here:

https://yasseenramadan2005.github.io/nand2tetris/2024/06/12/hack-assembler.html

About

This is the implementation of an assembler for the HACK machine language for project 6 of nand2tetris. The assembler uses two arguments, the first is the folder name that contains the assembly, the second is the .asm file. The assembler creates the .hack file in the folder. Run it as : lua assembler.lua <folder_name> <file.asm>

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published