CopperDisk 3.0.1
dotnet add package CopperDisk --version 3.0.1
NuGet\Install-Package CopperDisk -Version 3.0.1
<PackageReference Include="CopperDisk" Version="3.0.1" />
<PackageVersion Include="CopperDisk" Version="3.0.1" />
<PackageReference Include="CopperDisk" />
paket add CopperDisk --version 3.0.1
#r "nuget: CopperDisk, 3.0.1"
#:package CopperDisk@3.0.1
#addin nuget:?package=CopperDisk&version=3.0.1
#tool nuget:?package=CopperDisk&version=3.0.1
CopperDisk
CopperDisk is a managed Amiga floppy disk-image library for emulator hosts and disk tools. It loads standard 880 KiB ADF sector images, modern UAE extended ADF images, gzip-compressed ADZ images, read-only DMS images, decodes SPS/CAPS IPF images and SuperCard Pro SCP flux captures into raw Amiga track streams, and exposes both decoded AmigaDOS sectors and encoded track data through one small API.
The package targets .NET 10 and has no external runtime dependencies.
CopperDisk website and IPF API overview documents the library's track APIs, supported formats and decoder limits.
The source also owns AmigaHardfileConfiguration/partition metadata and internal
file-range, RDB and filesystem metadata helpers used by Lightweight CopperHDF.
CopperHDF mounts raw HDFs and fixed or dynamically expanding VHDs. Host tools can
read their virtual sectors with AmigaHardfileImage.OpenRead and prepare a new
dynamic VHD with AmigaHardfileImage.CreateDynamicVhd.
Guest device registration, boot discovery and I/O gateways remain in the engine.
Source also exposes AmigaRdbSetup for strict offline 512-byte RDB
inspection and adding partitions in unpublished image copies. Filesystem
formatting remains in CopperFS; see offline disk setup.
See the storage interface.
Installation
The development source includes AmigaSectorImage, a read-only image handle with
writer exclusion, RDB discovery and bounded volume-relative byte views. It supplies
geometry and storage; it contains no filesystem reader or CPU dependency.
OpenDms uses the existing DMS decoder for complete, unencrypted standard DD
archives, retaining the source's writer exclusion. CopyTo creates a decoded
working image; WriteDmsReplacement encodes and verifies an empty seekable
read/write staging stream without publishing it. Header metadata is preserved.
Auxiliary/unsupported records and flags or trailing data keep an archive read-only;
invalid or incomplete archives fail to open. Filesystem tools own publication.
CopperScreen consumes the separate packaged CopperStart filesystem service to
browse and extract files. See the Disk Image Manager guide
for supported filesystems and package provisioning.
dotnet add package CopperDisk --version 3.0.1
Version 3.0.1
SPS/CAPS IPF decoding reserves two track cells per MFM weak source bit. This preserves weak-region lengths and the position of subsequent stream data.
Read-only UAE-1ADF and encoded-track media accept one to 168 physical tracks (up to 84 DD cylinders). Extra raw tracks retain their stored bits, and normal tracks beyond cylinder 79 decode with their physical AmigaDOS track numbers. An absent final head is unformatted. Zero-bit raw UAE entries become a zero-filled PAL DD revolution, including entries with no allocated bytes.
Version 3.0.0
This release includes IPF density selectors and per-cell timing weights, stored gap decoding, weak/no-flux region metadata, read-only SCP decoding, aggregate loader options, and hardfile configuration and partition metadata.
Compared with stable 2.1.0, there are two API changes:
AmigaEncodedTrack.WrapBitOffsetis internal. PublicReadByteAtBit,ReadUInt16AtBitandReadUInt32AtBitmethods wrap offsets automatically.- Custom
IWritableAmigaSectorDiskMediaimplementations must implementTryWriteBytes(int byteOffset, ReadOnlySpan<byte> source)in addition to track writes. CopperDisk's standard ADF implementation supports both operations.
Supported Images
.adf: standard 880 KiB AmigaDOS sector images, plus modernUAE-1ADFextended ADF images..adz: gzip-compressed standard or modern extended ADF images, loaded read-only..dms: unencrypted standard DD Disk Masher images, loaded read-only..ipf: SPS/CAPS IPF images decoded to raw track streams..scp: read-only Amiga DD SuperCard Pro flux captures decoded to raw track streams..zip: an archive containing exactly one.adf,.adz,.dms,.ipf, or.scpentry.
IPF tracks expose DensityType and optional index-oriented CellWeights (relative
cell durations, nominal 1000), in addition to exact bit length, encoded data and
weak/no-flux regions. Select AlignTracksToWord = false for preserved execution.
The decoder's deterministic weak-byte materialization is a tooling view;
Lightweight uses region masks and a reproducible per-drive/revolution seed instead.
Decoder metadata does not certify native protection or exact receiver electronics.
Standard ADF media is writable at the sector-image level. Extended ADF, ADZ,
DMS, IPF, SCP, and encoded-track media are read-only, but still expose a
best-effort decoded sector view when sectors can be recognized. Extended ADF
support targets modern UAE-1ADF images; old UAE--ADF images are rejected.
Modern DD images may declare 1–168 tracks, within the 84-cylinder drive limit.
Missing tracks are unformatted, including the second head of a partial cylinder.
Extra physical tracks remain available through ReadTrack and the best-effort
decoded sector view covers all supplied cylinders. A zero raw bit length
denotes an unformatted track, represented using a zero-filled PAL DD revolution.
Third-Party Notices
DMS support follows the file-format validation and decrunch behavior of the
public-domain xDMS unpacker by Andre Rodrigues de la Rocha. See
THIRD-PARTY-NOTICES.md for details.
Loading Disk Images
using CopperDisk;
var loaded = AmigaDiskLoader.Load("Workbench.adf");
Console.WriteLine(loaded.DisplayName);
var media = loaded.Media;
var track = media.ReadTrack(cylinder: 0, head: 0);
Console.WriteLine(track.BitLength);
Console.WriteLine(track.Features);
AmigaDiskLoader.Load accepts direct ADF/ADZ/DMS/IPF/SCP paths and ZIP files
containing exactly one supported image. ADF and ADZ inputs are routed by content,
so modern extended ADF images can use the usual .adf or .adz extension.
Direct and ZIP-wrapped IPF/SCP files use the same optional aggregate options:
var loaded = AmigaDiskLoader.Load(
"protected-disk.zip",
new AmigaDiskLoadOptions
{
Ipf = new IpfDecodeOptions
{
StartAtIndex = false,
AlignTracksToWord = true
},
Scp = new ScpDecodeOptions
{
RevolutionIndex = 0
}
});
The older Load(path, IpfDecodeOptions) overload is retained as a compatibility
shortcut for IPF-only callers.
Use FromIpfBytes when IPF bytes are already in memory. The input is read
during decoding and is not retained by the returned media:
ReadOnlySpan<byte> ipfBytes = File.ReadAllBytes("protected-disk.ipf");
IAmigaSectorDiskMedia ipf = AmigaDiskLoader.FromIpfBytes(ipfBytes);
Use FromScpBytes for in-memory SCP captures:
ReadOnlySpan<byte> scpBytes = File.ReadAllBytes("flux-capture.scp");
IAmigaSectorDiskMedia scp = AmigaDiskLoader.FromScpBytes(scpBytes);
Sector Media
Use IAmigaSectorDiskMedia when you need the decoded AmigaDOS sector view:
if (loaded.Media is IAmigaSectorDiskMedia sectors)
{
ReadOnlyMemory<byte> bootBlock = sectors.BootBlock;
ReadOnlyMemory<byte> sector0 = sectors.ReadSector(0);
ReadOnlyMemory<byte> diskBytes = sectors.SectorData;
Console.WriteLine(sectors.HasCompleteDecodedSectorData);
}
SectorData uses the standard AmigaDOS sector layout, with 11 sectors per
physical track. Standard ADF remains 880 KiB; preserved track-backed media
covers its supplied cylinders, including a zero-filled absent final head.
Missing or unreadable sectors are zero-filled and
HasCompleteDecodedSectorData reports whether every sector was decoded.
Writable ADF Media
ADF loaders return IWritableAmigaSectorDiskMedia, so callers that need write
support do not need casts through unrelated interfaces:
byte[] adfBytes = File.ReadAllBytes("blank.adf");
IWritableAmigaSectorDiskMedia adf = AmigaDiskLoader.FromAdfBytes(adfBytes);
IAmigaTrack encodedTrack = adf.ReadTrack(0, 0);
bool wroteAnySector = adf.TryWriteTrack(0, 0, encodedTrack);
if (adf.IsDirty)
{
File.WriteAllBytes("blank.adf", adf.SectorData.ToArray());
}
Encoded Tracks
All media exposes encoded floppy-controller data through IAmigaDiskMedia and
IAmigaTrack.
IAmigaTrack track = media.ReadTrack(cylinder: 40, head: 1);
ReadOnlyMemory<byte> encodedBytes = track.EncodedData;
int encodedBits = track.BitLength;
int indexBit = track.StartBit;
AmigaTrackFeatures features = track.Features;
IReadOnlyList<AmigaTrackRegion> regions = track.Regions;
Use AmigaEncodedTrack when a tool needs byte-backed track helpers:
var encoded = new AmigaEncodedTrack(
track.EncodedData, track.BitLength, track.StartBit, track.Features, track.Regions);
ushort sync = encoded.ReadUInt16AtBit(0);
ushort acrossTrackBoundary = encoded.ReadUInt16AtBit(-1);
Regions preserves track spans that need special handling in an emulator host,
including weak data, flux-capture origin, approximate index materialization, and
no-flux intervals. Region start and length are expressed in bit offsets within
the encoded track.
FromEncodedTracks accepts one to 168 tracks, in cylinder/head order.
FromEncodedTrackBytes accepts the same range of byte arrays and treats
null entries as unformatted tracks:
byte[]?[] tracks = new byte[AmigaDiskGeometry.TrackCount][];
tracks[0] = File.ReadAllBytes("track-00.0.raw");
IAmigaSectorDiskMedia disk = AmigaDiskLoader.FromEncodedTrackBytes(tracks);
Ownership And Mutability
ADF and encoded-track byte-array entry points take ownership of the supplied arrays and do not make defensive copies. After passing an owned array to CopperDisk, do not mutate it while the returned media or track object is still in use.
This applies to:
AmigaDiskLoader.FromAdfBytesAmigaDiskLoader.FromEncodedTrackBytesAmigaEncodedTrack.FromBytes
Public output uses ReadOnlyMemory<byte> where possible. Treat these values as
read-only views over CopperDisk-owned media. Writable ADF media updates its
sector view after successful writes.
IPF Decoder Notes
IpfDecoder is an expert API for hosts that need decoded IPF track streams
directly:
byte[] ipfBytes = File.ReadAllBytes("disk.ipf");
IpfDiskImage image = IpfDecoder.Decode(ipfBytes);
foreach (IpfTrack track in image.Tracks)
{
Console.WriteLine($"{track.Cylinder}/{track.Head}: {track.BitLength} bits");
}
The managed IPF decoder currently supports the SPS/CAPS stream forms needed by CopperScreen's floppy path, with these limitations:
- Weak data is materialized deterministically and marked with
AmigaTrackFeatures.WeakDataandAmigaTrackFeatures.ApproximateWeakData. - Stored IPF gap streams are decoded from their stream elements when present; malformed gap offsets and invalid stream endings are rejected.
- Unknown IPF block encoders are rejected with
IpfDecodeException.
Use AmigaDiskLoader.FromIpfBytes or AmigaDiskLoader.Load for normal disk
loading. Use IpfDecoder only when a tool needs the IPF model types directly.
SCP Decoder Notes
ScpDecoder is a read-only Amiga DD decoder for SuperCard Pro captures:
byte[] scpBytes = File.ReadAllBytes("disk.scp");
ScpDiskImage image = ScpDecoder.Decode(scpBytes);
foreach (ScpTrack track in image.Tracks)
{
Console.WriteLine($"{track.Cylinder}/{track.Head}: {track.BitLength} bits");
}
The decoder validates normal floppy SCP headers, nonzero checksums, TRK
records, 1-5 revolutions, 16-bit flux entries, selected head data, and 25 ns
resolution scaling. It defaults to Amiga DD read-only media and rejects HD,
write-capable mutation, non-Amiga disk types, and unsupported bit-cell entry
widths unless options explicitly allow the format.
Flux transitions are converted to raw MFM bitcells for the selected revolution.
Overflow/no-flux entries are preserved as NoFlux regions, while captures
without a reliable index are marked with ApproximateIndex.
AmigaDOS Track Helpers
AmigaDosTrackEncoder and AmigaDosTrackDecoder are expert APIs for standard
AmigaDOS MFM track data. They are useful for emulator tests, disk-inspection
tools, and import/export paths that need raw floppy-controller streams rather
than a filesystem-level API.
They do not validate Amiga filesystems. The decoder scans for standard sector headers and checksums, returns a best-effort sector image for the supplied tracks, and leaves unreadable sectors zero-filled.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on CopperDisk:
| Package | Downloads |
|---|---|
|
CopperMod.Amiga.Emulator
Full Amiga emulator host services, boot helpers, and disk media adapters layered on CopperMod.Amiga. |
|
|
CopperMod.Cust
Native Amiga CUST Hunk loader with an A500 PAL MC68000/Paula playback sandbox. |
|
|
CopperMod.Amiga.Lightweight
Independent single-clock PAL OCS A500 engine with reusable framebuffer and 48 kHz stereo audio output. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Corrects MFM weak-field lengths in SPS/CAPS IPF tracks. Extends read-only UAE-1ADF and encoded-track media to 84 DD cylinders and handles unformatted raw tracks. Adds HDF/VHD image tools, RDB partition setup, and sector-image access for disk utilities.