SAP2 assembler
A simple assembler for the SAP2 computer architecture
sap2assembler can be installed using pip
pip install sap2ssembler
To use the package, you will need to have a file containing your assembly code
# test.sap2asm
mov a, b ; this will move this contents of the Accumulator into the B register
You can assemble the code using the SAP2Assembler class
from sap2assembler import SAP2Assembler # import the class
assembler = SAP2Assembler() # create the assembler object
assembler.assemble_from_file("test.sap2asm", hex_output=True, n_bytes=8, row=4, print_output=True) # assemble and print the first 8 bytes in hex in 4 byte rows
0000: 78 00 00 00
0004: 00 00 00 00
By default, it will print the first 256 bytes in binary in 16 byte rows
If you want to save the machine code into a file, you will need to use the file_to_write parameter
from sap2assembler import SAP2Assembler # import the class
assembler = SAP2Assembler() # create the assembler object
assembler.assemble_from_file("test.sap2asm", n_bytes=8, row=4, file_to_write"output.txt") # save the assembled code into output.txt
output.txt
0000: 01111000 00000000 00000000 00000000
0004: 00000000 00000000 00000000 00000000
To use is as a CLI, you can use the sap2assembler command
sap2assembler
type 'sap2assembler -h' for help
To assemble a file, you need to use the -a flag
sap2assembler -a test.sap2asm -o output.txt -b 8 -rw 4 -hd -p
-o will specify the output file
-b is the number of bytes either to write into the file or print
-rw is the row width
-hd will output the data in hex
-p will print the data
console
0000: 78 00 00 00
0004: 00 00 00 00
output.txt
0000: 78 00 00 00
0004: 00 00 00 00
Metadata
Release files for sap2assembler 4.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sap2assembler-4.0.2.tar.gz | 7.7 kB | Without provenance | Details for sap2assembler-4.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sap2assembler-4.0.2-py3-none-any.whl | Python 3 | none | any | Details for sap2assembler-4.0.2-py3-none-any.whl |
Total release size: 15.3 kB
Release files / sap2assembler-4.0.2.tar.gz
| Download URL | sap2assembler-4.0.2.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a29cc0f36350cb89abaa46b5ac157da96f814c8ce4fcf17899c39cda07686a6d
|
|
BLAKE2b-256 checksum How to use checksums |
cdadd3c9d4419f87db9a209a0135921c4bdda7a5b7078b017075e3ec16c431c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / sap2assembler-4.0.2-py3-none-any.whl
| Download URL | sap2assembler-4.0.2-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c4ed822bab9bee4ea9411333c85ba149ea759fe336e3fcd88df6698b6d262a0
|
|
BLAKE2b-256 checksum How to use checksums |
c2ffef3fc1a63b8eec286a62b788e999b24397855d17f916dd35e32085e7de18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for sap2assembler 4.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.