ultimate

package module
v0.0.0-...-51d7d7c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2026 License: Apache-2.0 Imports: 19 Imported by: 1

README

go-ultimate

A Go module for controlling Commodore 64 Ultimate devices over the network. It provides client libraries for the device's REST API and utilities for working with C64 assembly, BASIC, disk and CRT images, streams etc.

Installation

go get github.com/c64uploader/go-ultimate

Overview

Go Reference

See the Go package documentation by clicking the badge above or follow the examples below.

Functionality is organized into the following client services:

The library also provides utilities for working with 6502 code, BASIC, and C64 hardware:

The project includes a command line tool c64ctl for accessing go-ultimate capabilities. Install it with go -C tools/c64ctl/ install or run it directly using go run github.com/c64uploader/go-ultimate/tools/c64ctl@latest. To enable shell completion, use source <(c64ctl completion bash).

Contributing

See CONTRIBUTING.md for details on how to contribute to this project.

Documentation

Overview

Package ultimate is a Go client for the Commodore 64 Ultimate family of devices.

Quick start

client, err := ultimate.New("c64u")
if err != nil {
	log.Fatal(err)
}
err = client.Machine.Reset(context.Background())

Services

The Client exposes grouped services:

  • Machine: Control power, reset, and read/write RAM over DMA.
  • Runners: Upload and run programs (.PRG, .CRT) or play music (.SID, .MOD).
  • Drives: Mount disk images and control emulated floppy drives.
  • Files: Query file metadata and create blank disk images.
  • Configs: Read and write device settings. All values are strings on the wire; use Configs.GetItem to discover valid values and Configs.Set to write them, with ConfigMap.Bool/Int/String and Configs.SetBool/SetInt for typed convenience.
  • Keyboard: Inject text and keystrokes into C64 (latter is best-effort).
  • Streams: Multiplex video and audio streams into AVI format.
  • Debug: Read and decode C64 state: screen, registers, memory.
  • Raw: Send binary commands to the TCP port 64 socket for lower latency than the REST API.

C64-specific data formats and decoders live in the c64 subpackage.

Authentication

For password-protected devices set credentials via WithPassword:

client, err := ultimate.New("c64u", ultimate.WithPassword("secret"))

Device failures return *APIError. Inspect the HTTP status and firmware messages with errors.As:

var apiErr *ultimate.APIError
if errors.As(err, &apiErr) && apiErr.StatusCode == http.StatusNotFound {
	// resource not found
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int      // HTTP status code (or 0 for success status errors)
	Errors     []string // Messages returned by the device firmware
}

APIError is returned on HTTP or firmware-level failures from the device.

func (*APIError) Error

func (e *APIError) Error() string

type AVISession

type AVISession struct {
	Video io.ReadCloser
	Audio io.ReadCloser
	// contains filtered or unexported fields
}

AVISession coordinates active video and audio streams from the device.

func (*AVISession) Close

func (s *AVISession) Close() error

Close stops the streams on C64, cancels the readers, and closes both connections.

type AVISessionOptions

type AVISessionOptions struct {
	HostIP    string
	VideoPort int
	AudioPort int
	Writer    io.Writer
}

AVISessionOptions configures an AVISession.

type Client

type Client struct {
	Machine  *MachineService  // C64 power state and DMA memory access
	Runners  *RunnersService  // load/run programs and play music
	Drives   *DrivesService   // floppy drives and disk mounting
	Configs  *ConfigsService  // device settings
	Streams  *StreamsService  // UDP video/audio/debug streams (Ultimate 64)
	Files    *FilesService    // device filesystem and blank disk images
	Debug    *DebugService    // decode live C64 hardware state from RAM
	Raw      *RawService      // TCP command socket on port 64
	Keyboard *KeyboardService // inject strings and keystrokes (latter is best-effort)
	// contains filtered or unexported fields
}

Client is an HTTP connection to a C64 Ultimate device. Create one with New; each exported field is a service group for one area of the API.

func New

func New(host string, opts ...Option) (*Client, error)

New creates a Client for host (hostname, IP, or URL). http:// is added if missing.

func (*Client) Help

func (c *Client) Help(ctx context.Context, command string) (string, error)

Help returns the built-in help text for a device console command.

func (*Client) Info

func (c *Client) Info(ctx context.Context) (*DeviceInfo, error)

Info returns the device model, firmware version, and network details.

func (*Client) Version

func (c *Client) Version(ctx context.Context) (*VersionInfo, error)

Version returns the REST API version. Can be used as a connectivity probe.

type ConfigItem

type ConfigItem struct {
	Current any      `json:"current"`           // Current value (string or number)
	Min     int      `json:"min,omitempty"`     // Minimum value (for numeric settings)
	Max     int      `json:"max,omitempty"`     // Maximum value (for numeric settings)
	Format  string   `json:"format,omitempty"`  // Printf-style display format
	Default any      `json:"default,omitempty"` // Factory default value
	Values  []string `json:"values,omitempty"`  // Allowed values (for choices/enums)
	Presets []string `json:"presets,omitempty"` // Available presets
}

ConfigItem is the metadata for one device setting.

type ConfigItems

type ConfigItems map[string]map[string]*ConfigItem

ConfigItems is category -> setting name -> ConfigItem metadata.

func (ConfigItems) Get

func (m ConfigItems) Get(category, item string) (*ConfigItem, bool)

Get retrieves a ConfigItem by category and item name. Returns false if not found.

type ConfigMap

type ConfigMap map[string]map[string]any

ConfigMap is category -> setting name -> current value.

func (ConfigMap) Bool

func (m ConfigMap) Bool(category, item string) (bool, bool)

Bool parses a config value as a boolean. Recognises "Enabled"/"Disabled", "Yes"/"No", "ON"/"OFF" (case-insensitive), and numeric 1/0.

func (ConfigMap) Int

func (m ConfigMap) Int(category, item string) (int, bool)

Int parses a config value as an integer. Handles JSON numbers, plain numeric strings, and strings with unit suffixes (e.g. "2 MB", " 0 dB").

func (ConfigMap) String

func (m ConfigMap) String(category, item string) (string, bool)

String returns the value as a string. Returns false if not found.

type ConfigOptions

type ConfigOptions struct {
	Category string // Leave empty to act on all categories
}

ConfigOptions limits flash operations to one category.

type ConfigsService

type ConfigsService struct {
	// contains filtered or unexported fields
}

ConfigsService reads and writes device settings.

func (*ConfigsService) Apply

func (s *ConfigsService) Apply(ctx context.Context, cfg ConfigMap) error

Apply updates multiple settings at once using a ConfigMap.

func (*ConfigsService) Bool

func (s *ConfigsService) Bool(ctx context.Context, category, item string) (bool, error)

Bool reads a single setting and parses it as a boolean. Uses the same parsing rules as ConfigMap.Bool.

func (*ConfigsService) Get

func (s *ConfigsService) Get(ctx context.Context, category string) (ConfigMap, error)

Get returns settings for category. Supports * wildcards in the path.

func (*ConfigsService) GetItem

func (s *ConfigsService) GetItem(ctx context.Context, category, item string) (ConfigItems, error)

GetItem returns detailed specifications for a setting (supports '*' wildcards).

func (*ConfigsService) List

func (s *ConfigsService) List(ctx context.Context) ([]string, error)

List returns the names of all setting categories.

func (*ConfigsService) LoadFromFlash

func (s *ConfigsService) LoadFromFlash(ctx context.Context, opts ConfigOptions) error

LoadFromFlash restores settings from flash storage.

func (*ConfigsService) ResetToDefault

func (s *ConfigsService) ResetToDefault(ctx context.Context, opts ConfigOptions) error

ResetToDefault resets settings to factory defaults. Changes are not persisted until SaveToFlash is called.

func (*ConfigsService) SaveToFlash

func (s *ConfigsService) SaveToFlash(ctx context.Context, opts ConfigOptions) error

SaveToFlash saves the current settings to non-volatile flash storage.

func (*ConfigsService) Set

func (s *ConfigsService) Set(ctx context.Context, category, item, value string) error

Set updates a single setting.

func (*ConfigsService) SetBool

func (s *ConfigsService) SetBool(ctx context.Context, category, item string, value bool) error

SetBool writes a boolean setting using the device's "Enabled"/"Disabled" convention.

func (*ConfigsService) SetInt

func (s *ConfigsService) SetInt(ctx context.Context, category, item string, value int) error

SetInt writes an integer setting.

type CreateOptions

type CreateOptions struct {
	Tracks   int    // Track count (for D64 or DNP custom size formats)
	DiskName string // Custom disk name header/label (up to 16 characters)
}

CreateOptions sets optional parameters when creating a disk image.

type DebugService

type DebugService struct {
	Mem MemoryReaderWriter // memory backend; defaults to Machine
}

DebugService reads C64 RAM and decodes it into structured hardware views. DebugService reads C64 RAM and decodes it into structured hardware views. Mem must be set before calling any DebugService method.

func (*DebugService) BASIC

func (d *DebugService) BASIC(ctx context.Context) ([]c64.BASICLine, error)

BASIC reads tokenized program memory from $0801 and decodes it to source lines.

func (*DebugService) Bitmap

func (d *DebugService) Bitmap(ctx context.Context) (*image.Paletted, error)

Bitmap decodes the current VIC bitmap screen into a 320×200 image. Returns an error if the VIC is not in bitmap mode.

func (*DebugService) Charset

func (d *DebugService) Charset(ctx context.Context) (*c64.Charset, error)

Charset reads the active character generator dot data (2048 bytes, 256 characters × 8 bytes). The address is determined from $D018 bits 1–3.

func (*DebugService) Screen

func (d *DebugService) Screen(ctx context.Context) (*c64.Screen, error)

Screen reads screen memory and returns 25 rows of decoded text. The base address comes from the VIC-II memory-setup register and CIA2 bank select. In bitmap modes the screen memory holds per-cell color data, not character codes; in that case Rows is left empty and Mode is set to the active bitmap mode.

func (*DebugService) ScreenMode

func (d *DebugService) ScreenMode(ctx context.Context) (c64.ScreenMode, error)

ScreenMode returns the current VIC-II display mode.

func (*DebugService) Sprites

func (d *DebugService) Sprites(ctx context.Context) (c64.Sprites, error)

Sprites reads position, flags, and sprite data for all eight hardware sprites.

type DeviceInfo

type DeviceInfo struct {
	Product         string   `json:"product"`          // e.g. "Ultimate 64"
	FirmwareVersion string   `json:"firmware_version"` // e.g. "3.12"
	FPGAVersion     string   `json:"fpga_version"`     // e.g. "11F"
	CoreVersion     string   `json:"core_version,omitempty"`
	Hostname        string   `json:"hostname"`
	UniqueID        string   `json:"unique_id,omitempty"`
	Errors          []string `json:"errors"`
}

DeviceInfo is hardware model, firmware versions, and network identity.

type Drive

type Drive struct {
	Enabled   bool   `json:"enabled"`    // Whether the drive is turned on
	BusID     int    `json:"bus_id"`     // IEC bus ID (typically 8 or 9)
	Type      string `json:"type"`       // Drive model (e.g., "1541", "1571", "1581")
	ROM       string `json:"rom"`        // Custom ROM file name (if loaded)
	ImageFile string `json:"image_file"` // Name of the mounted disk image file
	ImagePath string `json:"image_path"` // Directory path of the mounted image
}

Drive is the status of one emulated floppy drive.

type DriveID

type DriveID string

DriveID names an emulated floppy drive slot on the device.

const (
	DriveA       DriveID = "a"       // Primary drive
	DriveB       DriveID = "b"       // Secondary drive
	DriveSoftIEC DriveID = "softiec" // Software-emulated IEC drive
)

type DriveMode

type DriveMode string

DriveMode selects which Commodore disk drive model to emulate (1541, 1571, or 1581).

const (
	DriveMode1541 DriveMode = "1541"
	DriveMode1571 DriveMode = "1571"
	DriveMode1581 DriveMode = "1581"
)

type Drives

type Drives struct {
	A       *Drive   // primary drive (typically IEC device 8)
	B       *Drive   // secondary drive (typically IEC device 9)
	SoftIEC *SoftIEC // software IEC filesystem device
}

Drives holds the current status of drive slots A, B, and the SoftIEC device.

func (*Drives) UnmarshalJSON

func (d *Drives) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the device JSON array format into a Drives struct.

type DrivesService

type DrivesService struct {
	// contains filtered or unexported fields
}

DrivesService controls emulated 1541/1571/1581 drives and disk mounting.

func (*DrivesService) List

func (s *DrivesService) List(ctx context.Context) (*Drives, error)

List returns the current status of all floppy drives.

func (*DrivesService) LoadROM

func (s *DrivesService) LoadROM(ctx context.Context, drive DriveID, file string) error

LoadROM installs a custom drive ROM from the device filesystem. The default ROM returns after a mode change or reboot.

func (*DrivesService) LoadROMBytes

func (s *DrivesService) LoadROMBytes(ctx context.Context, drive DriveID, data []byte) error

LoadROMBytes uploads and installs a custom drive ROM. The default ROM returns after a mode change or reboot.

func (*DrivesService) Mount

func (s *DrivesService) Mount(ctx context.Context, drive DriveID, image string, opts MountOptions) error

Mount mounts an image file from the device filesystem onto drive.

func (*DrivesService) MountBytes

func (s *DrivesService) MountBytes(ctx context.Context, drive DriveID, data []byte, opts MountOptions) error

MountBytes uploads image bytes and mounts them on drive.

func (*DrivesService) ResetDrive

func (s *DrivesService) ResetDrive(ctx context.Context, drive DriveID) error

ResetDrive resets drive emulation.

func (*DrivesService) SetMode

func (s *DrivesService) SetMode(ctx context.Context, drive DriveID, mode DriveMode) error

SetMode switches drive emulation model and restores the default ROM.

func (*DrivesService) TurnOff

func (s *DrivesService) TurnOff(ctx context.Context, drive DriveID) error

TurnOff powers off drive and removes it from the IEC bus.

func (*DrivesService) TurnOn

func (s *DrivesService) TurnOn(ctx context.Context, drive DriveID) error

TurnOn powers on drive. If already on, it is reset.

func (s *DrivesService) Unlink(ctx context.Context, drive DriveID) error

Unlink detaches the image file. Writes are allowed but not saved on unmount.

func (*DrivesService) Unmount

func (s *DrivesService) Unmount(ctx context.Context, drive DriveID) error

Unmount removes the mounted image from drive.

type FileInfo

type FileInfo struct {
	Path      string `json:"path"`
	Filename  string `json:"filename"`
	Size      int    `json:"size"`
	Extension string `json:"extension"`
}

FileInfo is metadata for one file on the device.

type FilesService

type FilesService struct {
	// contains filtered or unexported fields
}

FilesService reads file metadata and creates blank disk images on the device.

func (*FilesService) CreateD64

func (s *FilesService) CreateD64(ctx context.Context, path string, opts CreateOptions) error

CreateD64 creates a blank .d64 disk image (standard 35 tracks).

func (*FilesService) CreateD71

func (s *FilesService) CreateD71(ctx context.Context, path string, opts CreateOptions) error

CreateD71 creates a blank .d71 disk image (70 tracks).

func (*FilesService) CreateD81

func (s *FilesService) CreateD81(ctx context.Context, path string, opts CreateOptions) error

CreateD81 creates a blank .d81 3.5-inch disk image (80 tracks).

func (*FilesService) CreateDNP

func (s *FilesService) CreateDNP(ctx context.Context, path string, opts CreateOptions) error

CreateDNP creates a blank .dnp partition-based image. Tracks is required.

func (*FilesService) Info

func (s *FilesService) Info(ctx context.Context, path string) (*FileInfo, error)

Info returns metadata (size, extension) for a file on the device.

type ImageType

type ImageType string

ImageType is a disk image file format extension.

const (
	ImageD64 ImageType = "d64"
	ImageD71 ImageType = "d71"
	ImageD81 ImageType = "d81"
	ImageG64 ImageType = "g64"
	ImageG71 ImageType = "g71"
)

type KeyboardService

type KeyboardService struct {
	Mem MemoryReaderWriter // memory backend; defaults to Machine
}

KeyboardService injects keystrokes into the C64.

WARNING: Keystroke injection is a best-effort software feature. Remote DMA access cannot bridge physical hardware matrix pins. Injection works reliably for BASIC and standard KERNAL software, but WILL FAIL in software that bypasses the KERNAL or uses custom keyboard scanning logic.

func (*KeyboardService) Press

func (s *KeyboardService) Press(ctx context.Context, keys ...c64.Key) error

Press simulates holding one or more keyboard keys down.

The Ultimate REST API does not provide a built-in feature for simulating keyboard key presses. To work around this, Press attempts to simulate key presses in software using two different methods depending on the environment:

  1. Standard C64 environment (BASIC prompt): When the C64 KERNAL operating system is scanning the keyboard in the background, Press writes the key's character code directly into the KERNAL keyboard buffer ($0277).
  2. Custom software (Interrupts disabled): When background IRQ scanning is disabled, Press modifies the CIA #1 hardware chip registers ($DC00-$DC03) to simulate an active key matrix signal for 40ms before restoring the original register values.

Why this workaround may fail:

  • Programs that reset CIA direction registers ($DC02/$DC03) every frame will overwrite the injected key state.
  • Routines that scan matrix columns individually expect selective row responses, which a static CIA register write cannot replicate across all column scans.

func (*KeyboardService) Type

func (s *KeyboardService) Type(ctx context.Context, text string, opts ...TypeOption) error

Type enqueues ASCII text into the KERNAL keyboard buffer ($0277).

Use at the BASIC READY prompt or with programs reading input via KERNAL routines (GETIN/CHRIN).

WARNING: Type does NOT work in software that reads hardware registers directly.

type MachineService

type MachineService struct {
	// contains filtered or unexported fields
}

MachineService controls C64 run state and reads/writes RAM over DMA.

func (*MachineService) Inject

func (s *MachineService) Inject(ctx context.Context, p *c64.Program) error

Inject writes p into C64 RAM at its load address without resetting.

func (*MachineService) MeasureBus

func (s *MachineService) MeasureBus(ctx context.Context) ([]byte, error)

MeasureBus returns a VCD trace of cartridge bus timing.

func (*MachineService) MenuButton

func (s *MachineService) MenuButton(ctx context.Context) error

MenuButton simulates a press of the cartridge menu button.

func (*MachineService) Pause

func (s *MachineService) Pause(ctx context.Context) error

Pause freezes the C64. The CPU stops, but RAM is preserved.

func (*MachineService) Peek

func (s *MachineService) Peek(ctx context.Context, address uint16) (byte, error)

Peek reads one byte from C64 RAM.

func (*MachineService) Poke

func (s *MachineService) Poke(ctx context.Context, address uint16, value byte) error

Poke writes one byte to C64 RAM.

func (*MachineService) PowerOff

func (s *MachineService) PowerOff(ctx context.Context) error

PowerOff shuts down the device.

func (*MachineService) ReadDebugRegister

func (s *MachineService) ReadDebugRegister(ctx context.Context) (byte, error)

ReadDebugRegister reads the Ultimate 64 debug register at $D7FF.

func (*MachineService) ReadMemory

func (s *MachineService) ReadMemory(ctx context.Context, address uint16, length int) ([]byte, error)

ReadMemory reads length bytes from C64 RAM starting at address.

func (*MachineService) Reboot

func (s *MachineService) Reboot(ctx context.Context) error

Reboot restarts Ultimate firmware and then resets the C64.

func (*MachineService) Reset

func (s *MachineService) Reset(ctx context.Context) error

Reset performs a hardware C64 reset. Cartridge settings are kept.

func (*MachineService) Resume

func (s *MachineService) Resume(ctx context.Context) error

Resume lets the C64 run again after a Pause.

func (*MachineService) WriteDebugRegister

func (s *MachineService) WriteDebugRegister(ctx context.Context, value byte) (byte, error)

WriteDebugRegister writes value to $D7FF and returns the readback.

func (*MachineService) WriteMemory

func (s *MachineService) WriteMemory(ctx context.Context, address uint16, data []byte) error

WriteMemory writes data to C64 RAM.

type MemoryReader

type MemoryReader interface {
	ReadMemory(ctx context.Context, address uint16, length int) ([]byte, error)
}

MemoryReader reads bytes from C64 memory.

type MemoryReaderWriter

type MemoryReaderWriter interface {
	MemoryReader
	MemoryWriter
}

MemoryReaderWriter combines MemoryReader and MemoryWriter.

type MemoryWriter

type MemoryWriter interface {
	WriteMemory(ctx context.Context, address uint16, data []byte) error
}

MemoryWriter writes bytes to C64 memory.

type MountMode

type MountMode string

MountMode controls whether writes to a mounted image are persisted.

const (
	MountReadWrite MountMode = "readwrite" // writes go back to the image file
	MountReadOnly  MountMode = "readonly"  // image is write-protected
	MountUnlinked  MountMode = "unlinked"  // writes are discarded on unmount
)

type MountOptions

type MountOptions struct {
	ImageType ImageType // Image type (d64, d71, d81, etc.)
	Mode      MountMode // Mount mode (readonly, readwrite, etc.)
}

MountOptions sets image format and write mode for a mount operation.

type Option

type Option func(*Client)

Option configures a Client.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL sets the full device base URL. Used mainly in tests.

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient sets a custom http.Client. Overrides WithTimeout.

func WithPassword

func WithPassword(password string) Option

WithPassword sets the password used to authenticate with the device.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the per-request timeout. Ignored when WithHTTPClient is set.

type RawConn

type RawConn struct {
	// contains filtered or unexported fields
}

RawConn represents an active connection to the device's TCP port 64 command socket.

func (*RawConn) Close

func (c *RawConn) Close() error

Close closes the raw TCP connection.

func (*RawConn) Identify

func (c *RawConn) Identify(ctx context.Context) (string, error)

Identify requests the product title string from the device.

func (*RawConn) LoadAndJump

func (c *RawConn) LoadAndJump(ctx context.Context, jumpAddr uint16, prg []byte) error

LoadAndJump DMA-loads a program and jumps to a specific entry point. prg is a standard C64 PRG (starts with 2-byte load address).

func (*RawConn) LoadAndRun

func (c *RawConn) LoadAndRun(ctx context.Context, prg []byte) error

LoadAndRun DMA-loads a standard C64 PRG program (the first 2 bytes are the load address) and runs it automatically.

func (*RawConn) LoadKernal

func (c *RawConn) LoadKernal(ctx context.Context, rom []byte) error

LoadKernal uploads a replacement KERNAL ROM image.

func (*RawConn) MountDiskImage

func (c *RawConn) MountDiskImage(ctx context.Context, d64 []byte) error

MountDiskImage mounts a .d64 or other disk image without running it.

func (*RawConn) PowerOff

func (c *RawConn) PowerOff(ctx context.Context) error

PowerOff powers off the device.

func (*RawConn) Reset

func (c *RawConn) Reset(ctx context.Context) error

Reset resets the C64 via SOCKET_CMD_RESET.

func (*RawConn) RunCartridge

func (c *RawConn) RunCartridge(ctx context.Context, crt []byte) error

RunCartridge runs a .crt cartridge image.

func (*RawConn) RunDiskImage

func (c *RawConn) RunDiskImage(ctx context.Context, d64 []byte) error

RunDiskImage mounts and runs a .d64 or other disk image.

func (*RawConn) Type

func (c *RawConn) Type(ctx context.Context, text string) error

Type enqueues keystrokes directly into the C64 KERNAL keyboard buffer.

func (*RawConn) Wait

func (c *RawConn) Wait(ctx context.Context, ticks uint16) error

Wait instructs the firmware to delay execution by the specified number of FreeRTOS ticks.

func (*RawConn) WriteMemory

func (c *RawConn) WriteMemory(ctx context.Context, address uint16, data []byte) error

WriteMemory DMA-writes data to C64 RAM via the SOCKET_CMD_DMAWRITE command.

func (*RawConn) WriteREU

func (c *RawConn) WriteREU(ctx context.Context, reuOffset uint32, data []byte) error

WriteREU writes data to REU expansion RAM at reuOffset.

type RawService

type RawService struct {
	// contains filtered or unexported fields
}

RawService manages connections on the device's TCP port 64.

func (*RawService) Dial

func (s *RawService) Dial(ctx context.Context) (*RawConn, error)

Dial opens the TCP connection and authenticates when a password is configured.

type RunnersService

type RunnersService struct {
	// contains filtered or unexported fields
}

RunnersService loads and runs programs or plays music files. Methods ending in Bytes upload data from memory; others use a path on the device.

func (*RunnersService) Load

func (s *RunnersService) Load(ctx context.Context, p *c64.Program) error

Load uploads c64.Program into C64 memory without running it.

func (*RunnersService) LoadPRG

func (s *RunnersService) LoadPRG(ctx context.Context, file string) error

LoadPRG loads a .PRG from the device filesystem. Resets the C64 first.

func (*RunnersService) LoadPRGBytes

func (s *RunnersService) LoadPRGBytes(ctx context.Context, data []byte) error

LoadPRGBytes uploads and loads PRG bytes. Resets the C64 first.

func (*RunnersService) PlayMOD

func (s *RunnersService) PlayMOD(ctx context.Context, file string) error

PlayMOD plays a .MOD file from the device filesystem.

func (*RunnersService) PlayMODBytes

func (s *RunnersService) PlayMODBytes(ctx context.Context, data []byte) error

PlayMODBytes uploads and plays .MOD bytes.

func (*RunnersService) PlaySID

func (s *RunnersService) PlaySID(ctx context.Context, file string, song int) error

PlaySID plays a .SID file from the device. song is the sub-tune index (zero-based).

func (*RunnersService) PlaySIDBytes

func (s *RunnersService) PlaySIDBytes(ctx context.Context, data []byte, song int) error

PlaySIDBytes uploads and plays .SID bytes. song is the sub-tune index (zero-based).

func (*RunnersService) Run

func (s *RunnersService) Run(ctx context.Context, p *c64.Program) error

Run uploads and starts p on the C64.

func (*RunnersService) RunCRT

func (s *RunnersService) RunCRT(ctx context.Context, file string) error

RunCRT runs a .CRT cartridge file from the device filesystem.

func (*RunnersService) RunCRTBytes

func (s *RunnersService) RunCRTBytes(ctx context.Context, data []byte) error

RunCRTBytes uploads and runs .CRT cartridge bytes.

func (*RunnersService) RunPRG

func (s *RunnersService) RunPRG(ctx context.Context, file string) error

RunPRG loads and runs a .PRG from the device filesystem. Resets the C64 first.

func (*RunnersService) RunPRGBytes

func (s *RunnersService) RunPRGBytes(ctx context.Context, data []byte) error

RunPRGBytes uploads and runs PRG bytes. Resets the C64 first.

type SoftIEC

type SoftIEC struct {
	Enabled    bool               `json:"enabled"`
	BusID      int                `json:"bus_id"`
	Type       string             `json:"type"`
	LastError  string             `json:"last_error"`
	Partitions []SoftIECPartition `json:"partitions"`
}

SoftIEC is the software-based IEC storage device (filesystem browser).

type SoftIECPartition

type SoftIECPartition struct {
	ID   int    `json:"id"`
	Path string `json:"path"`
}

SoftIECPartition is one directory partition on the software IEC device.

type StreamName

type StreamName string

StreamName selects a UDP output stream (Ultimate 64 only).

const (
	StreamVideo StreamName = "video" // VIC-II framebuffer
	StreamAudio StreamName = "audio" // mixed audio output from the C64 (SID)
	StreamDebug StreamName = "debug" // internal signal trace
)

type StreamsService

type StreamsService struct {
	// contains filtered or unexported fields
}

StreamsService controls starting the streams and gives you readers for the data.

func (*StreamsService) AVISession

func (s *StreamsService) AVISession(ctx context.Context, opts AVISessionOptions) (*AVISession, error)

AVISession starts video and audio streams on the device, multiplexes them into an AVI stream, and writes the output to the provided Writer. Call Close() on the returned session to cleanly stop the streams.

func (*StreamsService) Audio

func (s *StreamsService) Audio(ctx context.Context, port int) (io.ReadCloser, error)

Audio returns a reader with clean 48kHz stereo PCM. Pipe it to ffmpeg or another tool.

func (*StreamsService) Start

func (s *StreamsService) Start(ctx context.Context, name StreamName, ip string) error

Start tells the device to begin sending the stream to the given IP:port.

func (*StreamsService) Stop

func (s *StreamsService) Stop(ctx context.Context, name StreamName) error

Stop tells the device to stop the stream.

func (*StreamsService) Video

func (s *StreamsService) Video(ctx context.Context, port int) (io.ReadCloser, error)

Video returns a reader with raw RGB24 frames (384x272). Pipe it to ffmpeg or another tool.

type TypeOption

type TypeOption func(*typeConfig)

TypeOption configures Type.

func Literal

func Literal() TypeOption

Literal makes Type distinguish 'a' from 'A' (lowercase vs uppercase on screen). Default folds case so both produce uppercase.

type VersionInfo

type VersionInfo struct {
	Version string   `json:"version"`
	Errors  []string `json:"errors"`
}

VersionInfo is the REST API version string.

Directories

Path Synopsis
c64
codec
Package codec maps between C64 single-byte encodings: ASCII, PETSCII, and screen codes.
Package codec maps between C64 single-byte encodings: ASCII, PETSCII, and screen codes.
examples
utils
Package utils implements common utilities for the examples.
Package utils implements common utilities for the examples.
tools
c64ctl module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL