This script automates the process of organizing large collections of .sid music files into Commodore 64 .d81 disk images. It handles filename conversion, ensures unique names to avoid conflicts, and can optionally include a SID player program on every disk.
- Batch Processing: Scans a folder and distributes files across multiple 800KB
.d81images. - C64 Compatibility: Automatically sanitizes filenames to uppercase and removes illegal characters.
- Collision Avoidance: If two files result in the same name (e.g.,
Last_Ninja_1andLast_Ninja_2both becomingLAST_NIN.SID), the script appends a suffix like_1,_2, etc. - Player Integration: Automatically writes a SID player (like
sidplay64.prg) to each disk. - Smart Capacity: Monitors remaining blocks to ensure disks aren't overfilled.
To use this script, you must have the VICE emulator tools installed on your system (specifically c1541).
Linux (Ubuntu/Debian):
sudo apt-get install vice
macOS:
brew install vice
- Make the script executable:
chmod +x sid_player_d81.sh
- Run the script:
./sid_player_d81.sh <sid_folder> [base_name] [player_file]
<sid_folder>: The directory containing your.sidfiles.[base_name]: (Optional) The prefix for the generated disks (default isSIDJUKE).[player_file]: (Optional) The path to your C64 SID player.prg.
./sid_player_d81.sh ./MyMusic Collection1 sidplay64.prg
This will generate Collection11.d81, Collection12.d81, etc., each containing the player and as many SIDs as will fit.
- Format: Creates a fresh D81 image using
c1541. - Player First: Copies the player PRG to the disk first to ensure it's easily accessible in the directory.
- Sanitization: Converts "Krakout_Theme.sid" →
KRAKOUT.SID. - Unique Check: Before writing, it reads the disk directory. If the name exists, it generates a variation (e.g.,
KRAKOU_1.SID). - Overflow: When the disk reaches the
MIN_FREE_BLOCKSlimit (default 50), it closes the disk and starts a new one.
- File Limits: The script targets 8.3 filename formats for maximum compatibility with various C64 file browsers, though D81 supports up to 16 characters.
- Disk State: The script uses a brief "micro-pause" and forced disk re-reads to ensure
c1541provides an accurate directory listing during high-speed batch processing.
Would you like me to add a section on how to customize the block limit or filename length?