An assembler for the Hack machine language written in Go.
The HDL for the CPU can be found under CPU.hdl
- Clone the repository and navigate to the project root.
- Build the executable for your system
go build -o hack-assembler .- Run the assembler by specifying the path of a
.asmfile
./hack-assembler example.asmYou will now find a generated .hack file under the same path
| Assembly | Machine Code |
|---|---|
| @256 | 0000000100000000 |
| D=A | 1110110000010000 |
| @SP | 0000000000000000 |
| M=D | 1110001100001000 |
| @133 | 0000000010000101 |
| 0;JMP | 1110101010000111 |
| @R15 | 0000000000001111 |
| M=D | 1110001100001000 |