Skip to main content

Write SAM Coupé disk images to USB floppy drive

Project description

writeusb

A Python script to write SAM Coupé disk images to a USB floppy drive so they can be used on real SAM hardware.

Source disk images should be normal 80/2/10/512 format and in MGT/SAD/EDSK disk image containers. SAMDOS/MasterDOS/BDOS and some custom loaders are supported.

Background

USB floppy drives are usually limited to 1.44M (18-sector) and 720K (9-sector) formats used by PC floppy disks. This is a problem for regular SAM disks, which use a 10-sector disk format.

This script re-maps the sectors used by the files on the source disk image so it uses only 9 sectors on each track. It also patches the boot loaders on converted disks to keep within these limits. Most SAM disks should support conversion.

Note: this script will NOT help to read existing 10-sector SAM Coupé disks. The 10th sector on each track is inaccessible on USB floppy drives.

Requirements

  • Windows, Linux or macOS.
  • USB floppy drive and double-density disks.
  • Python 3.10 or later.

Windows users can install Python from the Windows Store.

Installation

To install:

python3 -m pip install mgtwriteusb

Or to install from local source code:

python3 -m pip install .

To upgrade to the latest version:

python3 -m pip install --upgrade mgtwriteusb

Command-line Options

usage: writeusb [-h] [-o OUTPUT] [-p] [-n] [-f] [-a] [-s] [-V] diskimage

Write SAM disk image to USB floppy drive

positional arguments:
  diskimage

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        output to disk image file
  -p, --pad             pad output disk image to 10 sectors
  -n, --noverify        don't verify disk after writing
  -f, --force           write even if boot loader is unknown
  -a, --all             write all tracks, not just used tracks
  -s, --sniff           detect boot loader on source image
  -V, --version         show program's version number and exit

Examples

Convert image.dsk to 9-sector format, write used tracks to the connected USB floppy drive, then verify the written data:

writeusb image.dsk

Convert image.dsk to 9-sector format, save output to disk image output.img for use with SimCoupe or another disk writing program:

writeusb image.dsk -o output.img

Converting non-bootable disks will add a special version of SAMDOS v2, patched to dynamically support both 9-sector and 10-sector disks. It will appear in the directory listing as samdos9. When an existing boot loader is patched it supports only the converted 9-sector disks.

Troubleshooting

macOS and Linux users may need to run the script under sudo, depending on the permissions and group ownership of the USB floppy device. Linux users may just need to be in the disk group, depending on distribution.

Be sure to use real double-density media, which usually has a blue cover. High density disks have different magnetic properties, so covering the density hole is not a good solution. HD disks are often unreliable after writing (YMMV).

If you're re-using existing SAM disks be aware that some USB floppy drives may not recognise the existing 10-sector format. You may have to reformat the disk as true 9-sector before it'll work. Under Windows try format a: /t:80 /s:9, or under Linux try ufiformat /dev/sdX (change sdX to the correct device name).

SAMDOS/MasterDOS/BDOS will retry after disk errors but custom loaders may not. The MNEMOtech loader used by MNEMOdemo 1 and 2 fails immediately with a Loading Error so you'll need good quality disks!

Expect disk errors. If in doubt try a different disk!

Limitations

Disk images containing custom formats are not supported and will be rejected. This prevents original copies of Lemmings, Prince of Persia, and maybe some other titles from working.

Reducing from 10 sectors to 9 sectors also reduces the disk capacity. The converted disk has 72 directory slots and 702K of free space, rather than 80 directory slots and 780K on a regular disk. Full disks may need to be split.

Disks storing data outside the normal filesystem structures will be missed by the conversion process. This affects the Pac-Man Emulator (v1.4 or earlier).


https://github.com/simonowen/writeusb

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

mgtwriteusb-0.9.4.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mgtwriteusb-0.9.4-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file mgtwriteusb-0.9.4.tar.gz.

File metadata

  • Download URL: mgtwriteusb-0.9.4.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mgtwriteusb-0.9.4.tar.gz
Algorithm Hash digest
SHA256 2201073a39f604a5674bf300c0e4ee12726b71569ddfa5fb743d2d575a098b7e
MD5 5c5cb32b202f2ddbc172a49c37e58971
BLAKE2b-256 cd6f3445e98f8fe78cff55a4d941594ac0dc22b545547cb463edf64e89f877c3

See more details on using hashes here.

File details

Details for the file mgtwriteusb-0.9.4-py3-none-any.whl.

File metadata

  • Download URL: mgtwriteusb-0.9.4-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mgtwriteusb-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 18f1ab8f7a27ddd87d8b626f096bfcef94be0ea3654ae9b299dceded235c8e2b
MD5 67706aaaef76f380da8dd339a372b8f9
BLAKE2b-256 21b193ff2a78bf542bb7d63c44a111c79fbec30c0852d741a7c1d873912ea68d

See more details on using hashes here.

Supported by

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