Adding MYMPlayer to C

Since we do not have native C compilers on the Oric, this forum will be mostly be used by people using CC65 or the OSDK. But any general C related post will be welcome !
Post Reply
User avatar
Badger
2nd Star Corporal
Posts: 16
Joined: Sat Sep 22, 2018 10:04 am
Location: Wigan, England

Adding MYMPlayer to C

Post by Badger » Sun Oct 07, 2018 9:53 pm

I'm trying to add the mymplayer to my C game with a few issues.
So I did this

Code: Select all

#include <lib.h>
main(){
sedoric("!DIR"); //just display disk contents
sedoric("!MYMPLAYER.BIN"); //load mymplayer to mem
sedoric("!BUBBLE.BIN"); //load bubble bobble tune                                   
call(25856); //#6500
}

It builds runs and the music plays.....great....but.....

This happens

Code: Select all

                                   
  Drive A V3 (Mst) TAP2DSK SAMPLE DISC  
                                        
  TEST     .COM   4   MYMPLAYER.BIN   4 
  BUBBLE   .BIN  10                     
                                        
  *237 sectors free (S/21/17)  3 Files  
                                        
  ?SYNTAX ERROR IN  8192                
  Ready                                 
  LIST 8192                             
                                        
                                        
  Ready                                 
  CALL #6503                            
                                        
  Ready                                 
  CALL #6500                            
                                        
  Ready                                 
  CALL #6503                            
                                        
  Ready                                 
  
So the music plays on load , get the syntax error after about 1 second but music continues

further calls #6503 to stop the music work and #6500 to start work with no error.

I get stranger results when I insert similar code to the sideways scroller such as display corruption and freeze.

YM2MYM is version 1.007 and the showmap.bat shows the osdk starting at #600 and going to #8d8 so no overlap with #6500-> or #7600

Any hints?

Badger
flag_uk Amateurs built the Ark, Professionals built the Titanic.

User avatar
Dbug
Site Admin
Posts: 2702
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Adding MYMPlayer to C

Post by Dbug » Mon Oct 08, 2018 8:23 pm

The error is reported from the system not being happy after the program finished.

If you add:

Code: Select all

	printf("Press a key to stop");
	get();
	call(0x6503);
you'll see that the error appears only after you exit the program.

Basically the whole "sedoric" invocation is kind of wonky (and by the way, how did you get it to work, I had to add some lines to my library.ndx!

Code: Select all

-sedoric.s
    _sedoric


Regarding corruption with the scroller, that requires a bit more investigation: Could be some rogue pointer, badly used zero page location, C code writing to where the player plays, etc...

If you plan on having the player in your program, it's probably a better idea to have the code assembled as part of your program, this particular BASIC player was created to allow the author of Athanor to have music in a BASIC program, and there was some pretty explicit constraints about where it could be run, it was not really a generic routine, like it kind of hook on the system IRQ and uses specific memory addresses for temporary depacking of data. (like the entire area $6800 to $7600 is used)

User avatar
Badger
2nd Star Corporal
Posts: 16
Joined: Sat Sep 22, 2018 10:04 am
Location: Wigan, England

Re: Adding MYMPlayer to C

Post by Badger » Tue Oct 09, 2018 6:48 pm

Dbug wrote
Basically the whole "sedoric" invocation is kind of wonky (and by the way, how did you get it to work, I had to add some lines to my library.ndx!

-sedoric.s
_sedoric
I dont remember having to change the library files and when I looked the _sedoric was already there (although I could have added it as a flash of inspiratiion and then forgot about it :D )

Yes it does exactly as you say with the keypress and I suspect with the scroller it is C which is wrting over the code.

I'll have a play around and see if its possible to either mod the player code or incorporate it into the c program or something. maybe time to delve into some assembler (luckily I found some books on ebay to help).....this may take some time :D
flag_uk Amateurs built the Ark, Professionals built the Titanic.

User avatar
Dbug
Site Admin
Posts: 2702
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Adding MYMPlayer to C

Post by Dbug » Tue Oct 09, 2018 7:06 pm

What you can do, is to use osdk_showmap to generated the memory map of your program and see if any area overlap with the music player.
If you are doing the program in C or assembler, you can put it wherever you want: The CALL#6000 thing was just because in had to work with BASIC.
If you integrate the player as an additional module to compile with your program, then it will just be added wherever you want, and you can have the depacking buffers as just a normal additional buffer somewhere in memory.

User avatar
Badger
2nd Star Corporal
Posts: 16
Joined: Sat Sep 22, 2018 10:04 am
Location: Wigan, England

Re: Adding MYMPlayer to C

Post by Badger » Tue Oct 09, 2018 7:11 pm

Thanks, I'll give that a try :)
flag_uk Amateurs built the Ark, Professionals built the Titanic.

User avatar
Badger
2nd Star Corporal
Posts: 16
Joined: Sat Sep 22, 2018 10:04 am
Location: Wigan, England

Re: Adding MYMPlayer to C

Post by Badger » Tue Oct 09, 2018 7:26 pm

I just figured out what I did to get the sedoric commands working.

I copied the sedoric.s (which had the _sedoric in it) into the scroller working directory and compiled with the c program.

This should have triggered in my brain that I should be able to do the same with the music player.... but it didnt :)
flag_uk Amateurs built the Ark, Professionals built the Titanic.

User avatar
Dbug
Site Admin
Posts: 2702
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Adding MYMPlayer to C

Post by Dbug » Tue Oct 09, 2018 7:39 pm

Could you give a shot at adding

Code: Select all

-sedoric.s
    _sedoric
at the end of your lib/library.ndx instead of copying the sedoric.s :) ?

If that works fine, I'll publish a new OSDK with this fix and the few other things Waskol signaled.

If we have too many persons working with too many differently patched version, it become difficult to find out what goes wrong.

User avatar
Badger
2nd Star Corporal
Posts: 16
Joined: Sat Sep 22, 2018 10:04 am
Location: Wigan, England

Re: Adding MYMPlayer to C

Post by Badger » Tue Oct 09, 2018 8:01 pm

Works perfectly.
flag_uk Amateurs built the Ark, Professionals built the Titanic.

Post Reply