Casasoft.Commodore 1.0.2

dotnet add package Casasoft.Commodore --version 1.0.2
                    
NuGet\Install-Package Casasoft.Commodore -Version 1.0.2
                    
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="Casasoft.Commodore" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Casasoft.Commodore" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Casasoft.Commodore" />
                    
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 Casasoft.Commodore --version 1.0.2
                    
#r "nuget: Casasoft.Commodore, 1.0.2"
                    
#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 Casasoft.Commodore@1.0.2
                    
#: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=Casasoft.Commodore&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Casasoft.Commodore&version=1.0.2
                    
Install as a Cake Tool

Casasoft Commodore Package

A small utility library for reading, writing and generating Commodore PRG files in .NET.

This package provides in-memory representations and helpers for PRG files (two-byte little-endian load address followed by data), helpers to produce BASIC DATA lines, and utilities to build PRG payloads that contain pointer tables and null-terminated strings.

Features

  • Read and write PRG files with explicit load address handling.
  • Create PRG payloads from collections of strings (PETSCII conversion + pointer table).
  • Produce Commodore BASIC DATA lines for embedding PRG data in source listings.
  • Utilities for relocating pointer tables when changing load addresses.

Quick Start

Install (from NuGet)

  • If the package is published as Casasoft.Commodore.Utils:
    • dotnet add package Casasoft.Commodore.Utils

Build from source

  • Restore and build:
    • dotnet restore
    • dotnet build -c Release
  • Pack:
    • dotnet pack -c Release -o ./nupkg

Usage examples

Create a PrgFile from a file:

// C# example var prg = new PrgFile("myprogram.prg"); 
Console.WriteLine($"Load address: {prg.LoadAddress:X4}");

Save a PrgFile:

prg.Save("out.prg");

Create a PRG containing pointer-indexed strings:

var strings = new List<string> { "HELLO", "WORLD" }; 
var s2p = new Strings2Prg(0x0801, strings, LowerCase: false, AddIndex: true); 
s2p.Save("strings.prg");

Relocate pointers in an existing PRG payload in memory:

// Adjust pointer table values so strings point to a new load address 
Strings2Prg.RelocatePointers(s2p.Data, newLoadAddress: 0x1000, oldLoadAddress: 0x0801);

Generate BASIC DATA lines for embedding:

string basic = prg.CreateDataLines(bytesPerLine: 8, targetFilename: "OUT.PRG"); 
Console.WriteLine(basic);

API

Main classes:

  • PrgFile � represents a PRG payload with LoadAddress and Data, load/save helpers and CreateDataLines.
  • Strings2Prg � helper to construct PRG payloads with a pointer table and null-terminated strings. Includes CreateArrays and RelocatePointers helpers.

See XML doc comments in the source for detailed API behavior and edge-case notes.

Contributing

  • Fork the repo, create a feature branch, and submit a pull request.
  • Keep changes targeted and include unit tests where appropriate.
  • Follow the existing code style and include XML comments for public APIs.

License

Casasoft Commodore Utils is licensed under the GNU Affero General Public License v3 (AGPL-3.0). See the repository license file for details.

Authors and Maintainers

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.
  • net10.0

    • No dependencies.

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
1.0.2 105 3/15/2026