Dennis-Johnson / hack_assembler

An assembler for Hack written in C++.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hack Assembler

An assembler for the Hack platform written in C++. Translates the given .asm file to a .hack file.

Pong

Here's the translated Pong.hack file running on a Hack CPU Emulator. Pong

A shorter example

Add.asm translated to Add.hack

  // Computes R0 = 2 + 3  (R0 refers to RAM[0])            
  @2                                            // 0000000000000010
  D=A                                           // 1110110000010000
  @3                                            // 0000000000000011
  D=D+A                                         // 1110000010010000
  @0                                            // 0000000000000000
  M=D                                           // 1110001100001000

Language Specification

About

An assembler for Hack written in C++.


Languages

Language:C++ 96.7%Language:CMake 3.3%