Skip to content

wang-edward/assembler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hack Assembler

Assembler that translates programs written in Hack assembly language into Hack binary code.

Project from the book nand2tetris.

Usage

$ ./init.sh                                     # build code
$ ./build/assembler tests/Add.asm               # run executable
$ cat tests/Add.hack                            # show results
$ diff tests/Add.hack tests/sols/Add.hack       # compare results with solutions from book

$ ./build/assembler tests/PongL.asm             # huge example (27k lines of assembly)
$ diff tests/PongL.hack tests/sols/PongL.hack   # compare again

Add.asm -> Add.hack

Add.asm     |       Add.hack
------------------------------------
@2          |       0000000000000010
D=A         |       1110110000010000
@3          |       0000000000000011 
D=D+A       |       1110000010010000
@0          |       0000000000000000
M=D         |       1110001100001000

Specification

Hack Specification

Example

Example

Hack CPU Architecture

Architecture

About

assembler for Hack binary code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published