TED Music Collection

What's this?

TED Music Collection wants to be the ultimate pack of all the music created for the MOS TED chip used in the Commodore 264 series computers (C16, C116, plus/4 and the rare/prototype ones: the 232 and the V364).

Why?

Because we wanted to have a collection which can be played back using a generic music player on the real machine.

But we already have HVTC!

HVTC is missing several key features we think is very important:

  • it contains every music in two flavors: a standalone player which can be started from BASIC (which is good) and the raw player routine and data from the original program (which in fact cannot be used for anything)
  • music playback from HVTC is a real pain in the ass on the real machine: you extract the collection to your trusted SD2IEC, browse to the folder, load the music, play it then reset the computer which resets SD2IEC to the root folder so you can start all over
  • it does not have metadata for the music such as author, title, release date, music playback frequency, init and play entry addresses and so on which prevents playing back from a standardized player
  • TED Music Collection is the natural evolution of HVTC and we wanted a new name to reflect the fundamental differences. (High Voltage is the name of a C64 demo group who started collecting C64 music and they are not related to the plus/4 scene in any way)

What are the key features of TED Music Collection? 

TED Music Collection (TMC in short) is

  • aimed to be played back from a music player
  • but we keep what's good in HVTC: the standalone player: you can load and play a music straight from BASIC
  • has metadata fields to display information about the music

Creating TED Music Files

To create a TED Music File you need to

  • Extract music data and player code from the original program
  • Patch the player code (or create a wrapper) that allows you to
    • init the music with the number of song passed in register A
    • does the playback by a single call to the play routine
  • Create the file using the TMF Tool

TED Music File description

General information

  • files are standard Commodore .prg files with load address of $1001 (Commodore 264 series BASIC startup)
  • for BASIC RUN command they start the standalone player
  • word type fields are little endian: just like on a Commodore 6502 based computer
  • text fields are encoded in US PETSCII lower/upper case character set
  • reserved areas should be filled with zeros to allow backwards compatible changes in the specifications
  • in flag fields 0 means the flag is off and 1 means on. all not specified bits should be set to 0.

File layout

Offset (decimal) Offset (hexadecimal) Type Length (decimal) Name Mandatory Value Remarks
0 0 word 2 loadaddress yes $1001 not checked
2 2 word 2 basicnextline yes $100b not checked
4 4 word 2 basiclinenumber yes 2020 not checked
6 6 byte 1 basicsys yes $9e not checked
7 7 text 4 basicsysparam yes 4352 not checked
11 B byte 1 basiclineend yes 0 not checked
12 C word 2 basicend yes $0000 not checked
14 E byte 3   yes   filler
17 11 text 8 signature yes $54 $45 $44 $4d $55 $53 $49 $43 „tedmusic”
25 19 byte 1 version yes 0 0: Preliminary specification version
26 1A word 2 dataoffset yes   The offset where song data starts from the beginning of the file (load address included)
28 1C word 2 dataaddress yes   This is the memory address where the real music data should be loaded (in case of BASIC load this is the address where the music should be relocated to)
30 1E word 2 initaddress yes   The address of the routine which can be called to start a song. The number of the song is passed in register A. The init must not change interrupt enable ($ff0a) register and interrupt vectors (neither $0314 nor $fffe)
32 20 word 2 playaddress yes   The address of the routine which can be called to play the song. CPU I flag should not be manipulated and interrupt request ($ff09) must not be acknowledged
34 22 byte 1 numberofsongs yes    
35 23 byte 1 timing yes
  • 0: PAL VBlank (50Hz),
  • 1: NTSC VBlank (60Hz),
  • 2: PAL timer1 value in next field,
  • 3: NTSC timer1 value in next field,
  • 4: PAL timer1 value set by init routine,
  • 5: NTSC timer1 value set by init routine
Value 4 and 5 should be avoided whenever possible because it prevents playing back PAL music on NTSC machines and vice versa.
36 24 word 2 timer1value no  

The value put in TED timer#1

Special timer values:

  • PAL 1/frame (VBlank, 1x): 17734
  • PAL 2/frame (2x): 8867
  • PAL 4/frame (4x): 4433
  • NTSC 1/frame: 14915
  • NTSC 2/frame: 7457
  • NTSC 4/frame: 3728
38 26 byte 1 songflags yes
  • Bit 0: screen turned off during playback
  • Bit 1: uses SID too
  • Bit 2: uses DigiBlaster
  • Bit 3: uses AY (DIGIMUZ)
  • Bit 4: uses FM
Screen can be turned of during playback but the song still should handle interrupts gracefully. Music should indicate the used additional sound sources in order to allow music players to mute them after playback
39 27 byte 1 fileflags yes
  • Bit 0: file has song duration block
 
40 28 word 2 durationoffset no   offset of duration block
42 2A byte 23 reserved no   reserved for future use (padding to align text field to addresses dividable by $10)
65 41 text 32 title yes    
97 61 text 32 author no    
129 81 text 32 released no    
161 A1 text 32 tracker no   name of the tracker/composer used to create song
193 C1 byte 64   yes   reserved for future use
257 101     player yes   A built-in player (and optional relocator) routine that allows playing the music on a 264 series machine after a BASIC DLOAD
  durationoffset word 2*numberofsongs durationblock no   An optional array of words for every song in the file. The durations are stored in seconds and rounded up (for example 1 minute 3.2 seconds should be stored as 64)
  dataoffset     data yes   The music data