Metadata-Version: 2.4
Name: machine68k
Version: 0.5.1
Summary: A Cython binding for a m68k system emulator
Author-email: Christian Vogelgsang <chris@vogelgsang.org>
License-Expression: GPL-2.0-or-later
Keywords: m68k,musashi,machine68k,system emulator
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: System :: Emulators
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# machine68k - m68k Emulator and Machine Binding for Python

- written by Christian Vogelgsang <chris@vogelgsang.org>
- under the GNU Public License V2

## Introduction

`machine68k` is a Python package that offers a system binding for
the [Musashi][1] Motorola 68000 CPU emulator with memory binding and
support for ALine opcode exception traps.

The package is currently used by the [amitools][2] project and
supplies the CPU emulation for `vamos`.

## Prerequisites

- Python >= ```3.11```
- [pip3][3]

## Optional Packages

- [cython][4]: (version >= **3.0.0**) required to rebuild the native module

[1]: https://github.com/kstenerud/Musashi
[2]: https://github.com/cnvogelg/amitools
[3]: https://packaging.python.org/en/latest/tutorials/installing-packages/
[4]: https://cython.org

## Installation

### Stable/Release Version

```bash
pip3 install machine68k
```

Note:

- on Linux/macOS may use ``sudo`` to install for all users
- requires a host C compiler to compile the extension.
- the version may be a bit outdated. If you need recent changes use the
  current version.

### Current Version from GitHub

Ensure you have Cython installed:

```bash
pip3 install cython
```

Then install `machine68k` directly from the git repository:

```bash
pip3 install -U git+https://github.com/cnvogelg/machine68k.git
```

Or if you have a local clone of the repository:

```bash
pip3 install .
```

Note:

- This will install the latest version found in the github repository.
- You find the latest features but it may also be unstable from time to time.
- Repeat this command to update to the latest version.

### Developers

- Follow this route if you want to hack around with the codebase
- Clone the Git repo: [machine68k@git](https://github.com/cnvogelg/machine68k)
- Ensure you have Cython installed:

```bash
pip3 install cython
```

- Enter the directory of the cloned repo and install via pip:

```bash
pip3 install -U -e .
```

This install `machine68k` in your current Python environment but takes the
source files still from this repository. So you can change the code there
and directly test the machine.

#### Building release wheels

The `Build and publish wheels` workflow builds a source distribution, then
builds wheels from that archive for CPython 3.11–3.15 on Linux x86_64,
Windows x64, and macOS Intel and Apple Silicon. Each wheel is installed
and tested on its native architecture, including the greenlet tests.
Pull requests and manual runs produce downloadable artifacts without
publishing them.

For a release, configure a PyPI trusted publisher for `cnvogelg/machine68k`,
workflow `wheels.yml`, and environment `pypi`. Create that environment in
GitHub and configure any desired release approval rules. Pushing a `v*`
release tag to the upstream repository publishes the source distribution
and wheels only after all wheel tests pass. No PyPI token is required.

Releases made with this workflow let pip install a matching wheel without
a compiler. Older source-only releases and platforms without a matching
wheel still require a host C compiler.

#### Using uv

As an alternative, install [uv](https://docs.astral.sh/uv/getting-started/installation/),
then create an environment and install the development dependencies and package:

```bash
uv python install "$(cat .python-version)"
uv venv
uv pip install -r requirements-dev.txt
uv pip install -e .
```

The Makefile targets use `uv` to run the tools. For example, run `make test` to
run the tests, `make format` to format Python files, `make fix` to apply Ruff
lint fixes, `make fix-unsafe` to also apply unsafe Ruff fixes (which may change
code behavior), and `make check` to check formatting and lint.
