Skip to content

abcdjdj/hasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HASM

Introduction

A simple two-pass assembler for the HACK CPU's assembly language, written in Flex/Bison (Project 6 of Nand2Tetris). Supports predefined symbols (KBD, R0-R15 etc.), labels and variables as well. Know more about the HACK assembly language here

Prerequisites

You need to have make, flex and bison installed on your machine. In case you don't, run the following command to install them.

Ubuntu
sudo apt install flex bison build-essential
Arch
sudo pacman -S base-devel

Building

Run the following commands to clone and build HASM

git clone https://github.com/abcdjdj/hasm
cd hasm
make

Usage

./hasm.out <asm file>

By default, the generated binary code will get printed to stdout