Jump to content

Photo

ABCmusic re-surrected


4 replies to this topic

#1 karri ONLINE  

karri

    River Patroller

  • 2,592 posts
  • Location:Espoo, Finland

Posted Mon Feb 4, 2019 7:18 AM

I had some requests for fixing bugs in the ABCmusic package so there is now a fairly decent version in https://bitbucket,org/atarilynxunder lynx/contrib/cc65version

 

What is new is that you get feedback when the music ends on a channel.

extern void abcstop ();
extern void abcplay (unsigned char channel, char *tune);
extern unsigned char abcactive[4];
abcstop(); // Initialize engine
abcplay (0, "X7 I0 V100 T20 R0 H8 K4 O2 CEG"); // Play C E G notes
while (abcactive[0]) ; // Wait until done

 

You also have some new direct calls for setting the sound on the hardware.

 

// abcoctave legal values 0..6
extern void __fastcall__ abcoctave(unsigned char chan, unsigned char val);
// abcpitch legal values 0..255
extern void __fastcall__ abcpitch(unsigned char chan, unsigned char val);
// abctaps legal values 0..511
extern void __fastcall__ abctaps(unsigned char chan, unsigned int val);
// abcintegrate legal values 0..1
extern void __fastcall__ abcintegrate(unsigned char chan, unsigned char val);
// abcvolume legal values 0..127
extern void __fastcall__ abcvolume(unsigned char chan, unsigned char val);

There is also a demo file main.c and a compiled demo test.lnx in the zip file.

Attached Files



#2 42bs OFFLINE  

42bs

    Moonsweeper

  • 303 posts
  • Location:Germany/Southest West

Posted Mon Feb 4, 2019 7:23 AM

I had some requests for fixing bugs in the ABCmusic package so there is now a fairly decent version in https://bitbucket,org/atarilynxunder lynx/contrib/cc65version

 

What is new is that you get feedback when the music ends on a channel.

extern void abcstop ();
extern void abcplay (unsigned char channel, char *tune);
extern unsigned char abcactive[4];
abcstop(); // Initialize engine
abcplay (0, "X7 I0 V100 T20 R0 H8 K4 O2 CEG"); // Play C E G notes
while (abcactive[0]) ; // Wait until done

 

I haven't used ABC yet, but some thoughts:

* How about a call-back instead of a memory cell to poll?

* abcstop() to initialize seems weird ;-)

 

BTW, why not ASL?

	clc
	rol
	clc
	rol
	clc
	rol

Edited by 42bs, Mon Feb 4, 2019 7:31 AM.


#3 karri ONLINE  

karri

    River Patroller

  • Topic Starter
  • 2,592 posts
  • Location:Espoo, Finland

Posted Mon Feb 4, 2019 7:59 AM

I just wanted to fix the problems of why the code used to be out of tune. My 65sc02 asm skills are really rusty. Did not even know that asl existed.

 

About the callback. I am not quite sure how a callback from an interrupt would interact with a callback procedure declared in C.

 

Besides, the abcmusic is no replacement for a real music engine like Chipper or HandyMusic. It is just a small, fast approach.

 

abcstop() is required to initialize the score pointers to point to a byte 0. As the pointers are in zp ram I need to do something at startup. Perhaps I could trick the system to run init at the first interrupt?


Edited by karri, Mon Feb 4, 2019 8:08 AM.


#4 necrocia OFFLINE  

necrocia

    Moonsweeper

  • 356 posts

Posted Wed Feb 6, 2019 1:49 AM

Thanks for listening to my complaints Karri :grin: ! I really like the simplicity of the cc65 version, just one asm file and it just works, it was the easiest way to get started with music on the Lynx for me.



#5 necrocia OFFLINE  

necrocia

    Moonsweeper

  • 356 posts

Posted Wed Feb 6, 2019 8:48 PM

Tried it out, works like a charm. I like the tutorial code you put together too.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users