Development : : CopperSharp68k Preview 1
Posted By: itix. on 2026/8/29 7:08:20
The first public preview of CopperSharp68k is now available.

CopperSharp68k is a closed-world CIL-to-Motorola 68k ahead-of-time (AOT) compiler for C# and other .NET languages.

The compiler currently produces:
  • Amiga HUNK executables
  • 256 KiB and 512 KiB Kickstart ROM images
  • Readable Motorola 68k assembler output
The supported CPU targets are MC68000, MC68020, MC68040, and MC68060.

The Amiga target is intended for Kickstart 1–3 systems. CopperSharp also supports the MorphOS m68k environment, including selected MorphOS m68k ABI extensions and system interfaces. It does not currently generate native MorphOS/PPC code.

<div>Building the first C# program

The compiler runs on Windows, Linux, and macOS. You need the .NET 10 SDK on the build machine; the generated Amiga executable does not require .NET on the Amiga.

Install the project templates:
Code:<div class="xoopsCode"><pre>dotnet new install CopperSharp.Templates@0.1.0-preview.1</pre></div>
Create a project:

Code:
dotnet new amiga -n HelloAmiga
cd HelloAmiga

The template creates a normal C# project. Its entry point can use the typed Amiga SDK.

Publish it as an Amiga HUNK executable:
Code:</div> <div>dotnet publish -c Release -r amiga-m68k</div> <div>
</div> <div>YOLO and managed exception modes</div>
CopperSharp has two exception modes.

YOLO mode is intended for compact programs that do not use managed exception regions. It omits the exception runtime and keeps fatal faults as non-returning paths. Methods containing try/catch/finally are rejected in this mode.

Full mode includes a table-driven 68k exception runtime with support for catch, finally, rethrow, leave, and managed unwinding. Full mode is also required when using C# finalizers.

Optional managed memory

Memory management is configurable. A program can use no managed heap, an external allocator, an Amiga-backed allocator, or CopperSharp’s built-in managed pool.

The built-in collector is a non-moving mark-and-sweep collector. The compiler emits exact root metadata for static fields and managed stack slots, and the collector follows object references and reference arrays using generated type descriptors.

Collection can be explicit, triggered after allocation failure, run before every allocation, or driven by allocation-pressure telemetry.

C# finalizers are supported when using the built-in managed pool together with Full exception mode. Finalization is synchronous: unreachable finalizable objects are retained during collection, the remaining object graph is traced, unreachable memory is reclaimed, and finalizers are then executed on the collecting thread.

Finalizer suppression, re-registration, resurrection, nested collection, and nested allocation are supported. An exception from one finalizer is caught and discarded so that later finalizers can still run. After a normal return from Main, outstanding finalizers are drained before runtime shutdown. An abnormal or unhandled termination does not perform this final drain.

What is supported

CopperSharp is not a full .NET runtime or a general-purpose CoreCLR replacement. It performs closed-world analysis from a selected entry point and compiles only the reachable, explicitly supported surface.

Among the current limitations are:

  • Only a bounded subset of CIL and .NET 10 is supported.

  • Unsupported reachable instructions, types, and framework members produce diagnostics.

  • Reflection, runtime code generation, dynamic loading, COM, and arbitrary P/Invoke are not supported.

  • Threads, tasks, general synchronization, networking, and HTTP are outside the current contract.

  • General 64-bit arithmetic and comparisons are not yet supported.

  • Multidimensional arrays and many uncommon marshaling forms are deferred.

  • Floating-point support is limited to the explicitly supported native-FPU operations.

  • MorphOS support currently targets m68k, not native PPC output.

The preview also includes typed Amiga SDK declarations, examples for DOS, MUI, IFF parsing, console I/O, polymorphism, and direct OCS hardware access, including a small CopperBars demo.

Project page: CopperSharp68k website
Source code: GitHub repository

Packages: CopperSharp.Templates CopperSharp.Sdk.Amiga