GoatTracker

From Foenix F256 / Wildbits/K2 Wiki
Revision as of 23:17, 29 January 2026 by Mcassera (talk | contribs) (Created page with "= Using GoatTracker to Create F256K SID Music = This guide explains how to use '''GoatTracker''' to compose SID music and generate a packed <code>.bin</code> file that plays correctly on the '''F256K / F256K2 FPGA SID'''. This document focuses on SID-only usage (no PSG or other sound chips). --- == 1. Getting GoatTracker == * GoatTracker is available for '''Windows, macOS, and Linux'''. * Download page: https://cadaver.github.io/ * The stereo version (useful for dua...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Using GoatTracker to Create F256K SID Music

This guide explains how to use GoatTracker to compose SID music and generate a packed .bin file that plays correctly on the F256K / F256K2 FPGA SID.

This document focuses on SID-only usage (no PSG or other sound chips).

---

1. Getting GoatTracker

  • GoatTracker is available for Windows, macOS, and Linux.
  • Download page: https://cadaver.github.io/
  • The stereo version (useful for dual SIDs on F256K2) is available on SourceForge under the files tab.

---

2. Creating a Song

  1. Create and edit your song in GoatTracker as you would for a C64.
  2. Most instruments, effects, and patterns work correctly on the F256K FPGA SID.
  3. GoatTracker was tuned for real C64 hardware, so FPGA SIDs may sound slightly different.

---

3. Pitch and Timing

Pitch and playback speed are separate settings.

  • Playback speed is controlled by PAL vs NTSC timing (50 Hz vs 60 Hz).
  • Pitch is controlled by the A-4 tuning value.

The F256K uses NTSC (60 Hz) timing.

---

3.1 Editing and Previewing on Your Computer

When composing music on your computer, use NTSC timing and corrected pitch.

Recommended settings:

goattracker -N -G424 song.sng

  • -N — NTSC timing (60 Hz)
  • -G424 — Correct pitch for NTSC preview

This setting is for editing only.

---

3.2 Packing for Playback on the F256K

The F256K requires a different tuning to produce true 440 Hz pitch.

Tested value:

  • A-4 = 454 Hz

Always start GoatTracker with:

goattracker -G454 song.sng

Important: .sng files store tuning. Loading after startup will overwrite the setting.

---

4. Packing the Song

Songs must be packed into a self-playing binary.

---

Option A: Internal Pack (F9)

  • Press F9 in GoatTracker.
  • Ensure it was started with -G454 and the song loaded.

---

Option B: External Packer (GT2RELOC.EXE)

Recommended method.

Example command:

GT2RELOC song.sng song.bin -N -G454 -LD400 -Wa0 -Z80

---

Parameter Explanation

  • song.sng — Input song
  • song.bin — Output binary
  • -N — NTSC timing
  • -G454 — F256K tuning
  • -LD400 — SID base address
  • -Wa0 — Player load address ($A000)
  • -Z80 — Zeropage ($80/$81)

---

Notes

  • -Wxx sets the high byte only
  • -Wa0 = $A000
  • -Zxx uses two bytes
  • $80/$81 is tested and safe
  • Avoid $F0–$FF (kernel use)
  • -Wxx and -Zxx are configurable

---

5. Playing the Music

---

5.1 Initialization

Call the init routine:

JSR $A000

---

5.2 Per-Frame Playback

Call once per frame:

JSR $A003

---

6. Additional Notes

  • -N controls speed
  • -Gxx controls pitch
  • Both are required
  • The binary is C64-compatible
  • Correct setup ensures compatibility

---

Appendix: Minimal F256 SID Music Player Example

The following is a minimal working music player using kernel timers.

---


; ============================================================================
; music_min.asm - Minimal Music Player for Wildbits/K & /Jr
; ============================================================================

   .cpu "65816"
   MMU_IO_CTRL = $01
   init_music = $A000
   play_music = init_music+3
   timer_cookie = $D0

*=$A0
   .dsection zp
   .cerror * > $AF, "Too many zero page variables"

   .include "api.asm"

   .section zp
   event: .dstruct kernel.event.event_t
   .send

*=$1000

start:
   stz MMU_IO_CTRL

   lda #<event
   sta kernel.args.events
   lda #>event
   sta kernel.args.events+1

   jsr init_music
   jsr SetTimer

loop:
   jsr handle_events
   bra loop

handle_events:
   lda kernel.args.events.pending
   bpl done_handle_events
   jsr kernel.NextEvent
   bcs done_handle_events
   jsr dispatch
   jmp handle_events

done_handle_events:
   rts

dispatch:
   lda event.type
   cmp #kernel.event.timer.EXPIRED
   beq music_playback
   rts

music_playback:
   jsr SetTimer
   jsr play_music
   rts

SetTimer:
   inc timer_cookie
   lda timer_cookie
   sta kernel.args.timer.absolute
   sta kernel.args.timer.cookie
   lda #kernel.args.timer.FRAMES
   sta kernel.args.timer.units
   jsr kernel.Clock.SetTimer
   rts

*=$A000
   .binary "testsong.bin"


---

Cheat Sheet

Edit / Preview

goattracker -N -G424 song.sng

Pack for F256K

GT2RELOC song.sng song.bin -N -G454 -LD400 -Wa0 -Z80

Internal Pack

goattracker -G454 song.sng

Press F9

---

Playback

JSR $A000

JSR $A003

---

Tested Defaults

  • SID: $D400
  • Player: $A000
  • Zeropage: $80/$81
  • Timing: NTSC (60 Hz)

---

End of document.