Re: [cc65] Playing a PSID file

From: Greg King <greg.king41verizon.net>
Date: 2011-11-08 01:12:08
From: "Payton Byrd"; on Sat., Nov. 05, 2011; at 10:39 AM -0400
>
> > On Sat, Nov 5, 2011 at 3:27 AM, Marc 'BlackJack' Rintsch wrote:
> >
> > > I've done some initial googling; and, haven't found anything.
> > > So, I want to pose a general question, "What's the best way
> > > to play a PSID file from CC65?" -- and, to expand on what I
> > > believe the steps to be and the issues that I need to understand.
> > >
> > > 1) Assume I have a PSID that loads at $1000 through $1900.  It
> > > inits. at $1000, and plays at $1003.
> > > 2) I need to load that PSID into memory.  I'm assuming I simply can
> > > put the bytes of the data into an ASM file; and, it will get linked
> > > into the program at $1000.  However, I do need to understand if
> > > there will need to be any custom memory mappings for this; and,
> > > exactly what syntax to use in the ASM file, to accomplish setting the
> > > bytes at a specific memory location.
> >
> > Including the data can be done with the ".incbin" command in the
> > assembly file.  Use the offset argument to skip the PSID header.
> >
> > Placing the data at a specific memory location requires a little more
> > than just assembly syntax.  What ends up where is decided by the linker
> > and the linker configuration you have to write.  The memory from $1000
> > upwards is part of the memory where cc65 and the runtime can put code,
> > data, and stack; so, you have to write a memory configuration, to protect
> > the space for your music, and define a segment to place it there.
> >
> > So, the assembly file might look like this:
> >
> >  .export _music_init, _music_play
> >  .segment MUSIC_SEGMENT
> >      _music_init = *
> >      _music_play = _music_init + 3
> >      .incbin "music.sid", $7c  ; $7c = offset of data in PSIDv2 format
> >
> > Here is the header file to use it from C:
> >
> >  #ifndef MUSIC_H
> >  #define MUSIC_H
> >
> >  #include <stdint.h>
> >
> >  void __fastcall__ music_init(uint8_t song_number);
> >  void music_play(void);
> >
> >  #endif
>
> Thank you so much for that info.  It's exactly what I was needing for that
> part.  I'll play around with a memory map; and, see if I can figure out the
> part with the linker.

A couple of old mail threads might be useful to you.  Go to this page:
http://www.cc65.org/mailarchive/thread.html

Then, use your browser's find function to look for two things
on that page:

Goattracker
C64, Interrupt

(Each line is a single search-string.)

Keep in mind that those posts are old.  The general info is good;
but, the examples are somewhat obsolete.  CC65 has evolved since
then (for example, the CBM load address usually sits in its own
memory area, now).

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Nov 8 02:14:57 2011

This archive was generated by hypermail 2.1.8 : 2011-11-08 02:15:30 CET