PREVIEW PACKAGE WORKFLOW
Getting
started.
Create an ordinary .NET 10 C# project and publish it as a native Motorola 68k Amiga HUNK executable. The packaged project SDK runs the compiler, so no global compiler tool is required.
- Host requirement
- .NET 10 SDK
- Package version
- 0.1.0-preview.1
- Default CPU
- MC68000
01 / INSTALL AND PUBLISH
Install the template and publish the project.
Install the .NET 10 SDK, then run these commands. The template creates the source and package references; publish restores the packaged compiler and generates the target files.
dotnet new install CopperSharp.Templates::0.1.0-preview.1
dotnet new amiga -n HelloAmiga
cd HelloAmiga
dotnet publish -r amiga-m68k02 / GENERATED PROJECT
The complete example.
These are the two files generated by dotnet new amiga -n HelloAmiga.
HelloAmiga.csproj
<Project Sdk="Microsoft.NET.Sdk;CopperSharp.Sdk/0.1.0-preview.1">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifier>amiga-m68k</RuntimeIdentifier>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<CopperSharpEntry>HelloAmiga.Program::Main</CopperSharpEntry>
<CopperSharpCpu>68000</CopperSharpCpu>
<CopperSharpOutputFormat>hunk</CopperSharpOutputFormat>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CopperSharp.Sdk.Amiga" Version="0.1.0-preview.1" />
</ItemGroup>
</Project>Program.cs
using Amiga;
using CopperSharp.Compiler;
namespace HelloAmiga;
public static class Program
{
[M68kEntryPoint]
public static int Main()
{
var dosBase = Exec.OpenLibrary("dos.library", 33);
if (dosBase is null)
{
return DOS.RETURN_FAIL;
}
DOS.DOSLibraryBase = dosBase.Value;
DOS.PutStr("Hello from CopperSharp.\n");
Exec.CloseLibrary(DOS.DOSLibraryBase);
DOS.DOSLibraryBase = APTR.Null;
return DOS.RETURN_OK;
}
}The program opens dos.library, writes one line, closes the library, and returns an Amiga DOS status code.
03 / PUBLISH OUTPUT
Managed build, native publish.
dotnet build produces the managed .NET assembly. It does not produce an Amiga executable by default. dotnet publish -r amiga-m68kwrites the following files under bin/Release/net10.0/amiga-m68k/publish/.
- HelloAmiga.hunk
- The executable to copy to an Amiga filesystem or run in an emulator.
- HelloAmiga.hunk.map
- Symbols and exact compiler, contract, target, CPU, and output provenance.
- HelloAmiga.hunk.framework.json
- The closed-world framework compatibility report for this program.
04 / CPU SELECTION
Select generated instructions.
The template defaults to MC68000. Select another supported CPU when creating the project. This changes code generation and optimization; it is not an emulator setting.
dotnet new amiga -n HelloAmiga --cpu 68000
dotnet new amiga -n HelloAmiga --cpu 68020
dotnet new amiga -n HelloAmiga --cpu 68040
dotnet new amiga -n HelloAmiga --cpu 6806005 / COMPATIBILITY AND CLI
Check the reachable program.
CopperSharp implements a bounded CIL and .NET framework surface. The generated framework report records every reachable framework member and whether the program fits the current contract.
Direct compiler use is optional. See the CLI documentationfor custom ROM layouts, assembler output, and standalone reports.
Packages: CopperSharp.Templates · CopperSharp.Sdk.Amiga