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
<PackageReference Include="MrKWatkins.OakAsm.IO.ZXSpectrum" Version="0.8.7" />
<PackageVersion Include="MrKWatkins.OakAsm.IO.ZXSpectrum" Version="0.8.7" />
<PackageReference Include="MrKWatkins.OakAsm.IO.ZXSpectrum" />
paket add MrKWatkins.OakAsm.IO.ZXSpectrum --version 0.8.7
#r "nuget: MrKWatkins.OakAsm.IO.ZXSpectrum, 0.8.7"
#:package MrKWatkins.OakAsm.IO.ZXSpectrum@0.8.7
#addin nuget:?package=MrKWatkins.OakAsm.IO.ZXSpectrum&version=0.8.7
#tool nuget:?package=MrKWatkins.OakAsm.IO.ZXSpectrum&version=0.8.7
OakAsm
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 | 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
- JetBrains.Annotations (>= 2026.2.0)
- MrKWatkins.Ast (>= 0.9.137)
- MrKWatkins.BinaryPrimitives (>= 1.7.0)
- MrKWatkins.OakAsm (>= 0.8.7)
- MrKWatkins.OakIO (>= 2.0.1)
- MrKWatkins.OakIO.ZXSpectrum (>= 2.0.1)
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 |