Offline

Could someone be so kind to give me a walk-through on how to play a song packed as a .prg from Goattracker?
I've tried exporting using all default settings (Start address $7000, etc)
Then tried loading the .prg in VICE (File -> Autostart disk/tape image)
and then in monitor I've added:

.a $6F00 LDA $00
.a $6F02 JSR $7000

Then moved the PC to $6F00 with SYS28416
This didn't do anything so I tried adding

.a $6F05 JSR $7003

But still nothing. What am I missing here?

Offline

GoatTracker doesn't have a timer-enabled driver attached to it when you export.  (afaik, unless they added one in 2.x series)

$7000 will init the song
$7003 will play a frame of the song only.

So you'd need a little bit of code to play it like:

SEI
; init
LDA #$00
JSR $7000
; loop, wait for raster ($d012) to hit line 128
RASTER LDA $D012
CMP #$80
BNE RASTER
; play frame of song
JSR $7003
; jump back to raster loop
JMP RASTER

Offline

Thanks for your help. It all makes sense.
I'm not yet familiar with the 6010's raster lines and interrupts. I've tried your piece of code in Vice but unfortunately I'm not getting any sound.
I've tried loading up a game in Vice so I know the audio works.
If I put the above code @ address $6000, I should enter SYS24576 to start it, right?
Do I need to do anything else?

Offline

Yep that should be ok, just tried it.  Here's my compile (Player at $6000, song at $7000)

Offline

while I'm here, this is some timer friendly code to do the same thing:

sei

; init song
lda #$00
jsr $7000

; point hardware interrupt registers at our play routine
lda #<raster
sta $0314
lda #>raster
sta $0315
; set raster position (in this case, below bottom border on PAL machines)
lda #252                        
sta $d012                      
lda $d011
and #$7f                        
sta $d011                      
; init interrupts
lda #$7f                       
sta $dc0d
lda #$01                        
sta $d01a
lda $dc0d                     
; return to system now interrupts are running.
cli
rts

; play routine, just calls a frame of the music and changes border colour so we have some visuals.
raster
dec $d020
jsr $7003
inc $d020
; ack interrupts
dec $d019
jmp $ea31
 
Offline

Thanks a lot mate!
After I tried your file and it was working beautifully, I realized that there was something in the export from Goattracker that wasn't right.
What solved the problem was to say no to "Use zeropage ghost regs". Then it worked like a charm. smile
Next, reading up on raster interrupts and the memory map.