MrKWatkins.OakAsm.IO.ZXSpectrum 0.8.7

Prefix Reserved
dotnet add package MrKWatkins.OakAsm.IO.ZXSpectrum --version 0.8.7
                    
NuGet\Install-Package MrKWatkins.OakAsm.IO.ZXSpectrum -Version 0.8.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MrKWatkins.OakAsm.IO.ZXSpectrum" Version="0.8.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MrKWatkins.OakAsm.IO.ZXSpectrum" Version="0.8.7" />
                    
Directory.Packages.props
<PackageReference Include="MrKWatkins.OakAsm.IO.ZXSpectrum" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MrKWatkins.OakAsm.IO.ZXSpectrum --version 0.8.7
                    
#r "nuget: MrKWatkins.OakAsm.IO.ZXSpectrum, 0.8.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MrKWatkins.OakAsm.IO.ZXSpectrum@0.8.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MrKWatkins.OakAsm.IO.ZXSpectrum&version=0.8.7
                    
Install as a Cake Addin
#tool nuget:?package=MrKWatkins.OakAsm.IO.ZXSpectrum&version=0.8.7
                    
Install as a Cake Tool

OakAsm

Build Status NuGet Version NuGet Downloads

An assembler for 8-bit systems. Designed for generating assembly via C# code but also supports parsing and formatting assembly files.

OakAsm currently targets the Z80 and the Z80N, the extended Z80 found in the ZX Spectrum Next. Documentation is at mrkwatkins.github.io/OakAsm.

Installing

dotnet add package MrKWatkins.OakAsm.Z80                 # Z80 library.
dotnet add package MrKWatkins.OakAsm.Z80N                # ZX Spectrum Next library.
dotnet tool install --global MrKWatkins.OakAsm.Tool      # The oakasm command line tool.

Building Assembly from C#

Z80Assembly has a strongly-typed builder method for every instruction and directive:

using MrKWatkins.OakAsm.Ast;
using MrKWatkins.OakAsm.IO;
using MrKWatkins.OakAsm.Z80;
using static MrKWatkins.OakAsm.Z80.Z80Assembly;

var source = new Source(
    ORG(0x6000),
        LD(BC, "STRING"),
    Label("LOOP"),
        LD(A, [BC]),
        CP(0),
        JR(Z, "EXIT"),
        RST10(),               // ZX Spectrum ROM: print the character in A.
        INC(BC),
        JR("LOOP"),
    Label("EXIT"),
        RET(),
    Label("STRING"),
        DEFB("Hello World"),
        DEFB(13, 0));

Z80Assembler.Instance.Assemble(source);

var output = new Output(source);    // output.Regions has the assembled bytes and their locations.

Assembling Files

Describe a project in YAML:

cpu: z80
sections:
  - org: "0x6000"
    sources:
      - "*.asm"
outputs:
  - format: binary
    file: "Output.bin"

Then assemble it with the command line tool:

oakasm assemble MyProject.yaml

The tool can also disassemble ZX Spectrum snapshots back to assembly with oakasm disassemble.

Packages

Package Use it for
MrKWatkins.OakAsm Core AST, assembler machinery and binary output.
MrKWatkins.OakAsm.Z80 Z80 opcode definitions, assembler and C# builder API.
MrKWatkins.OakAsm.Z80N Z80N (ZX Spectrum Next) extensions to the Z80 package.
MrKWatkins.OakAsm.Parsing Parsing assembly text into the AST.
MrKWatkins.OakAsm.Formatting Formatting the AST back to configurable assembly text.
MrKWatkins.OakAsm.Disassembly CPU-agnostic disassembly machinery.
MrKWatkins.OakAsm.Disassembly.Z80 Z80/Z80N disassembly.
MrKWatkins.OakAsm.Projects YAML project files and project assembly.
MrKWatkins.OakAsm.IO.ZXSpectrum ZX Spectrum tape and snapshot output.
MrKWatkins.OakAsm.Testing Test helpers for code built with OakAsm.
MrKWatkins.OakAsm.Tool The oakasm command line tool.

Use of AI

My general rule is I'll write the interesting bits and use AI for the boring bits. I wrote the bulk of the code, but then used AI to get it ready for release, or it would never have been done... So the project files, last few assembler features, finishing off the console tools and the documentation was mainly AI generated.

Licensing

OakAsm is licensed under the GPL v3.0. The test suite uses some files found in the wild:

  • A snapshot of Hungry Horace by Psion Software Ltd. and published by Sinclair Research. According to World of Spectrum's publisher permissions, Sinclair allow distribution of their published games for non-profit purposes. The original snapshot was taken from archive.org but tweaked slightly so the program counter starts at the start of the program; the original starts slightly later.
  • A binary of ZEXALL, Frank Cringle's Z80 instruction set exerciser, used to test the disassembler. ZEXALL is distributed under the GNU General Public License; its inclusion here as an unmodified test input does not affect the licensing of OakAsm itself.
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.8.7 73 8/4/2026
0.8.6 94 8/3/2026
0.8.5 96 8/1/2026
0.7.6 331 2/16/2026
0.7.5 145 2/10/2026
0.7.4 128 2/10/2026
0.7.3 302 12/14/2025
0.7.2 440 12/4/2025
0.7.1 227 12/4/2025
0.7.0 222 11/15/2025
0.6.60 374 9/11/2025
0.6.59 288 8/12/2025
0.6.58 234 8/10/2025
0.6.57 306 8/6/2025
0.6.56 289 7/13/2025
0.6.55 230 7/13/2025
0.6.54 619 5/26/2025
0.6.53 363 5/13/2025
0.6.52 224 5/11/2025
0.6.51 298 4/22/2025
Loading failed