Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:PSID and RSID (SID music)

From ReverseEngineering.wiki
Format
Platforms Platform:Commodore 64
Magic PSID or RSID at 0
Extensions .sid
Endianness big
On this wiki Facts · Code · Notes · Topics

PSID and RSID are the HVSC/SIDPLAY one-file formats for C64 music: a big-endian header (magic, version 1-5, data offset, load/init/play addresses, song counts, speed bits, three 32-byte text fields, flags) followed by C64 code and data.

Header

All header values are big-endian. Offsets (libsidplayfp readHeader): +0 "PSID" or "RSID"; +4 u16 version; +6 u16 offset of the binary data; +8 load address; +10 init; +12 play; +14 number of songs; +16 start song; +18 u32 speed bits (bit per song: 0 = vertical blank 50/60 Hz, 1 = CIA 1 timer A); +22, +54, +86 name, author, released (32 bytes each); version 2 and up: +118 u16 flags, +120 relocation start page, +121 relocation page count, +122 second SID address byte, +123 third SID address byte. Header sizes: 118 bytes (v1) and 124 bytes (v2+), then the data at the stated offset.

Versions

libsidplayfp accepts PSID versions 1-5 and RSID versions 2-5; anything else raises "Unsupported PSID version" / "Unsupported RSID version". Unverified: the HVSC format document was not read; version 5 appears in this libsidplayfp revision (flags for panning, FM OPL and an embedded song length table) and I have no second source for it.

Flags (version 2+)

bit 0 MUS data (Compute!'s Sidplayer; libsidplayfp then refuses to load), bit 1 PSID: built-in player specific / RSID: BASIC flag, bits 2-3 clock (01 PAL, 10 NTSC, 11 both, 00 unknown), bits 4-5 SID model of the first chip (01 6581, 10 8580, 11 either), bits 6-7 model of the second SID (v3/v4), bits 8-9 the third (v4).

Load address

If the header load address is 0, the first two bytes of the data are the little-endian load address (like a Format:Commodore PRG file) and the data starts 2 bytes later. If init is 0 it defaults to the load address.

RSID restrictions

libsidplayfp rejects an RSID with a non-zero load address, play address or speed word. For the compatibility check it also wants the init address inside the loaded data and not in $A000-$BFFF or $D000-$FFFF, and the load address at least $07E8.

Sources

libsidplayfp src/sidtune/PSID.cpp and SidTuneBase.cpp, commit c855551959b74651a800bdc16df1665de21f4e21 (GPL-2.0-or-later). See Platform:Commodore 64.

Code & repositories

  • https://github.com/libsidplayfp/libsidplayfp @ c855551959b74651a800bdc16df1665de21f4e21 · license: GPL-2.0-or-later (declared by the contributor for the files used; GitHub reports GPL-2.0 for the repository)
    libsidplayfp C64 SID player library: src/sidtune/PSID.cpp and SidTuneBase.cpp parse the PSID/RSID header
    Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-18