https://github.com/fredmorcos/has
Hack CPU & JACK tooling
https://github.com/fredmorcos/has
assembler compiler disassembler emulator hack hack-assembler hack-cpu interpreter jack
Last synced: about 2 months ago
JSON representation
Hack CPU & JACK tooling
- Host: GitHub
- URL: https://github.com/fredmorcos/has
- Owner: fredmorcos
- License: mit
- Created: 2020-10-08T16:53:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-09-18T12:49:43.000Z (over 3 years ago)
- Last Synced: 2023-03-04T05:23:42.574Z (about 3 years ago)
- Topics: assembler, compiler, disassembler, emulator, hack, hack-assembler, hack-cpu, interpreter, jack
- Language: Hack
- Homepage:
- Size: 287 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelogs/0.1.0
- License: LICENSE
Awesome Lists containing this project
README
# `HAS`: The HACK Application Suite
[](https://github.com/fredmorcos/has/blob/master/LICENSE)
[](https://github.com/fredmorcos/has/releases)
[](https://github.com/fredmorcos/has/releases)
[](https://github.com/fredmorcos/has/actions)
https://github.com/fredmorcos/has
`HAS` is MIT licensed (see the `LICENSE` file) unless otherwise stated
at the top of a file.
## About
The HACK Application Suite is a library and a program for handling
various tasks related to the HACK CPU and instruction set as well as
the JACK programming language. HAS currently consists of the
following:
- [x] HACK assembler
- [x] HACK disassembler
- [ ] HACK interpreter
- [ ] HACK CPU emulator
- [ ] JACK virtual machine
- [ ] JACK compiler
## Usage
`HAS` makes use of subcommands.
`cargo run -- --help` or `has --help`:
```
has 0.3.0
The HACK Application Suite
USAGE:
has [FLAGS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
-v, --verbose Verbose output (can be specified multiple times)
SUBCOMMANDS:
asm Assemble a HACK file
dis Disassemble a HACK file
help Prints this message or the help of the given subcommand(s)
```
### Assembler
The assembler can only build a single file at a time. The output file
must not already exist.
`has asm --help`:
```
has-asm 0.3.0
Assemble a HACK file
USAGE:
has asm [FLAGS] --out
FLAGS:
-b, --bintext Output a bintext instead of binary file
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-o, --out Output file (must not exist)
ARGS:
Hack assembly file to compile
```
### Disassembler
The disassembler can only disassemble a single file at a time. The
output file must not already exist.
`has dis --help`:
```
has-dis 0.3.0
Disassemble a HACK file
USAGE:
has dis [FLAGS] --out
FLAGS:
-b, --bintext The input is a bintext instead of a binary file
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-o, --out Output file (must not exist)
ARGS:
Hack file to disassemble
```
## Examples
Assemble a `.asm` file with logging enabled: `has -vvv asm infile.asm -o outfile.hack`
## Installation
Cargo can be used to install `HAS` into `~/.cargo/bin`: `cargo install --path .`
## Tests
To test the `HAS` library, execute `cargo test` in the top-level directory.