Skip to main content

Python wrapper for ATasm, a 6502 cross-assembler using MAC/65 syntax

Project description

Python wrapper for ATasm, a mostly Mac/65 compatible 6502 cross-assembler

Summary

From the ATasm readme:

ATasm is a 6502 command-line cross-assembler that is compatible with the
original Mac/65 macroassembler released by OSS software.  Code
development can now be performed using "modern" editors and compiles
with lightning speed.

pyatasm is a python wrapper that uses the (slightly modified) C code from ATasm. It provides the front end to the assembler and returns the bytes (and other metadata) from the assembly.

Prerequisites

  • python 2.7 (but not 3.x yet) capable of building C extensions

Installation

pyatasm is available through PyPI:

pip install pyatasm

or you can compile from source:

git clone https://github.com/robmcmullen/pyatasm.git
cd pyatasm
python setup install

Your version of python must be able to build C extensions, which should be automatic in most linux and on OS X. You may have to install the python development packages on linux distributions like Ubuntu or Linux Mint.

Windows doesn’t come with a C compiler, but happily, Microsoft provides a cut-down version of their Visual Studio compiler just for compiling Python extensions! Download and install it from here.

Developers

If you check out the pyatasm source from the git repository or you want to modify pyatasm and change the .pyx file, you’ll need Cython. The .pyx file is compiled to C as a side effect of using the command:

python setup.py sdist

Usage

A simple example:

#!/usr/bin/env python

from pyatasm import Assemble

asm = Assemble("tests/works.m65")

if asm:
    print asm.segments
    print asm.equates
    print asm.labels
else:
    print asm.errors

Because pyatasm is a very thin wrapper around ATasm (and very little ATasm code was changed) it needs to creates files to do its work. These files will be created in the same directory as the source file, so the directory must be writeable.

The segments attribute will contain a list of 3-tuples, each tuple being the start address, the end address, and the bytes for each segment of the assembly. A segment is defined as a contiguous sequence of bytes. If there is change of origin, a new segment will be created.

License

pyatasm, python wrapper for ATasm

ATasm is Copyright (c) 1998-2014 Mark Schmelzenbach pyatasm is Copyright (c) 2016 Rob McMullen (feedback@playermissile.com)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyatasm-1.4.tar.gz (99.1 kB view details)

Uploaded Source

File details

Details for the file pyatasm-1.4.tar.gz.

File metadata

  • Download URL: pyatasm-1.4.tar.gz
  • Upload date:
  • Size: 99.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyatasm-1.4.tar.gz
Algorithm Hash digest
SHA256 499c27091d16beb8fbe2944b5c17da116236a725dc557a64bbc6001d79b9d5f7
MD5 2bb552303e710cf010e36b7886712c2d
BLAKE2b-256 1b240df02ece724306274ea1f1506c91c9d3d04bd8f08fb26d6d543b41aba301

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page