Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/godtamit/assembler
A modular general 2-pass assembler written in Python.
https://github.com/godtamit/assembler
assembler assembly instruction-set-architecture instructions modular parser
Last synced: about 1 month ago
JSON representation
A modular general 2-pass assembler written in Python.
- Host: GitHub
- URL: https://github.com/godtamit/assembler
- Owner: GodTamIt
- License: 0bsd
- Created: 2016-09-17T17:00:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-04-20T15:50:41.000Z (over 3 years ago)
- Last Synced: 2024-11-06T13:12:15.804Z (about 2 months ago)
- Topics: assembler, assembly, instruction-set-architecture, instructions, modular, parser
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-0BSD
Awesome Lists containing this project
README
# Assembler
A general 2-pass assembler with implementations of LC-2200 and LC3-2200a.## Requirements
The assembler runs on any version of Python 2.6+. An instruction set architecture definition file is required along with the assembler. In this repository, several sample ISA definitions have been provided (see below).## Sample Definitions
* [LC-2200 (32-bit)](lc2200.py)
* [LC3-2200a (32-bit)](lc32200a.py)## Options
The assembler contains multiple options.`python assembler.py -h` prints:
```
usage: Assembles generic ISA-defined assembly code into hex or binary.
[-h] [-i ISA] [-v] [--hex] [-s SEPARATOR] [--sym] [--params PARAMS]
asmfilepositional arguments:
asmfile the .s file to be assembledoptional arguments:
-h, --help show this help message and exit
-i ISA, --isa ISA define the Python ISA module to load [default: isa]
-v, --verbose enable verbose printing of assembler
--hex, --logisim assemble code into hexadecimal (Logisim-compatible)
-s SEPARATOR, --separator SEPARATOR
the separator to use between instructions (accepts \s
for space and standard escape characters) [default:
\n]
--sym, --symbols output an additional file containing the assembled
program's symbol table
--params PARAMS custom parameters to pass to an architecture,
formatted as "key1=value1, key2=value2, key3=value3"```
## How to Use
Typical usage:
```
./assembler.py -i
```Example usage with the `lc2200.py` definition:
```
./assembler.py assembly.s -i lc2200
```To output assembled code in hexadecimal (compatible with *Logisim* images):
```
./assembler.py assembly.s -i lc2200 --logisim
```To separate entries by a space:
```
./assembler.py assembly.s -i lc2200 --separator \s
```