[cc65] Problems playing Goattracker BIN files

From: Sebastian Gutsfeld <segoh1gmx.net>
Date: 2006-11-02 13:11:31
Hi,

inspired by Chris McCormick's aSid
(http://mccormick.cx/viewcvs/aSid/src/), which uses CC65 as compiler, I
started to program for my old C64, but I have problems converting a
little DASM assembler sid player to CA65 assembler. 

This little snippet should play the sid tune "example2.bin", exported
from goattracker to BIN format (init at $1000, plays a frame at $1003).

Here's the DASM source:

,----[ sid_player_dasm.s ]
|         processor 6502
|         org $0800
| 
| _main:
|         lda #$00
|         tax
|         tay
|         jsr song                ; Initialize music 
| 
| mainloop:
|         lda $d012               ; Load $d012
|         cmp #$80                ; Is it equal to #$80?
|         bne mainloop            ; If not, keep checking
| 
|         inc $d020               ; Inc border colour
|         jsr song+3              ; Jump to music play routine
|         dec $d020               ; Dec border colour
|         jmp mainloop            ; Keep looping
| 
|         org $1000
| song:   incbin "example2.bin"
`----

After assembling this and setting the execution address with pucrunch to
2048 the resulting programm starts fine and plays my sid file (taken
from the Goattracker examples).

But I am not able to reproduce this with CA65. I read the FAQ about the
.ORG directive, so I tried to modify the C64 linker config.

Here's my code:

,----[ sid_player_ca65.s ]
|         .export _main
|         .segment "PRG"
| 
| _main:  lda #$00
|         tax
|         tay
|         jsr song                ; Initialize music 
| 
| mainloop:
|         lda $d012               ; Load $d012
|         cmp #$80                ; Is it equal to #$80?
|         bne mainloop            ; If not, keep checking
| 
|         inc $d020               ; Inc border colour
|         jsr song+3              ; Jump to music play routine
|         dec $d020               ; Dec border colour
|         jmp mainloop            ; Keep looping
| 
| 
|         .segment "SID"
| song:   .incbin "example2.bin"
`----

And here are my modifications to the C64 linker config

,----[ c64.cfg ]
| MEMORY {
|     [...]
|     SIDDATA: start = $1000, size = $1000, file = %O, fill = yes, define = yes;
|     PRGDATA: start = $0800, size = $0B00, file = %O, define = yes;
| }
| SEGMENTS {
|     [...]
|     SID:      load = SIDDATA, type = ro, define = yes;
|     PRG:      load = PRGDATA, type = ro, define = yes;
| }
| [...]
`----

I assembled it with

,----
| cl65 -C c64.cfg -o sid_player_ca65.prg sid_player_ca65.s
`----

but this program just clears the screen and shows me the ready prompt. I
think my problem must be really basic to you all, but since I am a real
newbie when it comes to assembler and C64 programming I hope you can
explain me what's wrong.

regards,
   Sebastian
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Nov 2 13:11:41 2006

This archive was generated by hypermail 2.1.8 : 2006-11-02 13:11:45 CET