It is currently Sun Oct 22, 2017 5:55 pm

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Tue Jan 04, 2005 5:59 am 
Offline

Joined: Tue Jan 04, 2005 3:07 am
Posts: 8
Location: Sofia
Hello,

after some months of work my first SNES game is ready in playable form and the only stuff left for it being a complete product is the sound/music.Image

I browsed through some docs but haven't found a ready routine for usage of non ripped misic. I mean I don't want to use stolen music, because I have already a big archive of Amiga and some sid musics which I have the permission to use, so I'd better use them. Then the problem came:
I saw a demo ROM with some MOD musics in it, but unfortunatelly I can't find the sourcecode and the needed converting tool. I tryied by converting the mods to MIDI with MOD2MIDI and similar programs, and then using the MIDI2MSS converting tool, but it always gives me error "Ran out of voices for MIDI channel x. Either allocate more voices or remove concurrent notes", but I have checked on all the voices, so no luck with this too. Same problem when converting SID music to MIDI. For directly playing SID musics I can't understand the SID replayer either. Where to put the .sid file, do I have to manually set all the tables, or there is a tool for this? Another option is using .nsf files, but I don't have the permission to use any of them, and the DemoROM with the NSF songs for SNES doesn't come with sourcecode, unfortunatelly. But if Memblers is willing to give me a hand with this, NES music is an option too.

Another stuff I wish to add which will be unique for the SNES version of this game (Despite of the doublesized [16*16] graphics) is that I think it will be better insead of writing the text about what the character says, to actually say it - for example when completing level to scream "Hurray", "Yeahaa" or "Yuppie", and when dying to scream "Arghhh", "Noooooooo" or "Ouch", so for this I would need sample replayer/converting tool, and someone wishing to have his voice recorded.

So far this is the most important for now. I am open for suggestions, bugreports, insults etc.. If someone is willing to help please reply here or contact me privately. Credit will be given.

_________________
drHirudo


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 6:29 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3471
Location: Indianapolis
The source code to my NSF player is here, it was released before but not really publicised much.
http://mywebpages.comcast.net/memblers/2a03-src.zip

Sorry if it's a mess to work with, I could probably assemble a stripped-down binary that you could use if that'd be better. But I am busy with a lot of stuff lately.

I can write sample playing code, I found that SPC is pretty easy to use (other than loading) and also really well documented. As long as all the samples can fit in SPC's memory (the NSF player doesn't use much at all).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 7:02 am 
Offline

Joined: Tue Jan 04, 2005 3:07 am
Posts: 8
Location: Sofia
Thanks I've downloaded the archive and will give it a look now. I am using WLA but converting it from the x816 assembler and tasm shouldn't be a problem.

Do you know any public domain nsf songs, and/or authours who can be contacted for approval? For the samples - there is a lots of empty space on the ROM, so I can put them there and copy the data to the SPC memory only when they are needed - i.e. right before the reply.

_________________
drHirudo


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 9:02 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3471
Location: Indianapolis
Try out the music archive here:
http://2a03.org/

And also on the forums there, lots of people hang out and post their music.

For the sample loading dynamically, that'll be ok if the samples aren't played when real-time stuff is going on. Loading the SPC is kinda slow, and I don't think there are any interrupts on SPC to keep the music playing during loading.

Also, you probably know my NSF player doesn't play the DPCM channel. I could add support for that if you have a song that needs it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 9:22 am 
Thanks for the links. I'll try now to build test rom. I do some intensive usage of the zeropage for the game (it was bigger but the level is not in the zeropage anymore), but I can relocate more of the cells from there to the SNES RAM at $0E00 for example, if the replayer routines are in need of the zeropage as well. Is it there any standart about the zeropage usage by the NSF files, or this depends on the used tracker/routine?


Top
  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 9:46 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3471
Location: Indianapolis
Zeropage is relocatable on 65816, the player code takes advantage of that. I made it use a seperate page while it runs in emulation mode. NSFs will use any and all zeropage memory, depending on the engine (which is mostly MCK and less commonly NT2 for new stuff).

You should have ram at $0000-$07FF free, to be safe.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 8:32 am 
Offline

Joined: Tue Jan 04, 2005 3:07 am
Posts: 8
Location: Sofia
Quote:
I could probably assemble a stripped-down binary that you could use if that'd be better

Seems that will be better because I can't build a test rom. The Initsound routine is missing, probably it's in the sound.asm file (
Code:
.include "sound.asm"
), which is not included in the archive and I don't have, so I don't know how to initialise and how to transfer the SPC code to it's RAM, although I saw some docs about it.

You can build it like Amiga library, i.e. calling from different offsets contains jumptables to the actual code. For example:
Code:
SPCReplayer: incbin "SPCReplayer.bin"

for calling the routine the following code can be used this way:
Code:
Initsound:         jmp (SPCReplayer)
InitSong:          jmp (SPCReplayer+2)
TransferToSPC: jmp (SPCReplayer+4)
StartReplay:      jmp (SPCReplayer+6)
StopReplay:       jmp (SPCReplayer+8)

etc...

Or more cycle saving way is having direct interface to the routines, knowing the exact offsets, included in a separate file, but they will vary for the different compiles:
Code:
InitSound: jsr SPCReplayer + InitSoundOffset
InitSong:   jsr SPCReplayer + InitSongOffset
TransferToSPC: jsr SPCReplayer + TransferToSPCOffset
StartReplay: jsr SPCReplayer + StartReplayOffset
StopReplay: jsr SPCReplayer + StopReplayOffset

called directly from the code.

_________________
drHirudo


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 9:23 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3471
Location: Indianapolis
Whoops, I forgot that important file. It also has the .incbin for the SPC program itself. I didn't write that loader, I found it somewhere. (one I did try to write didn't work, it's probably still commented out in the main source, heheh)

http://mywebpages.comcast.net/memblers/SOUND.ASM

I'll try to assemble a little version of the whole player, I can't test it right away though. You'll need to load the NSF intro RAM at bank $7E. (I think it was $7E? It's been a long time, but it was the bank that was a full 64kB of RAM).

Oh also, unless you say otherwise, I'll assume you're using LoROM. So I'll make the code origin $8000.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 11:10 am 
Offline

Joined: Tue Jan 04, 2005 3:07 am
Posts: 8
Location: Sofia
Quote:
Oh also, unless you say otherwise, I'll assume you're using LoROM. So I'll make the code origin $8000.

Yes, I am using the standart/default memorymap. Here is a direct link to the game (sourcecode is included in the archive.

_________________
drHirudo


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 1:05 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3471
Location: Indianapolis
I haven't been able to download the game yet, I tried yesterday too. The connection either times out or gets to 10% or so and won't continue.

Here's a stripped down version of the NSF player, I haven't tested it at all though.. But it should work.
http://mywebpages.comcast.net/memblers/player.zip

Include the file at $8000, at the end of the file you need a table of load/init addresses for the NSFs.

So just do like:
.incbin "player.bin"
.word nsf1_init
.word nsf1_play
.word nsf2_init
.word nsf2_play
etc..

Get the init and play addresses from the NSF header (bytes 9 - 12 I think). And load the NSF program (based on the load address in the header) into bank $7F's RAM.

Look at the source or listing for the snes code addresses. There's JMPs at the beginning. You call spc_sound_init once. Then call spc_nsf_init with the song # in the accumulator, and the NSF number in X (just do LDX #0 if you only use one NSF)

Let me know if you have any questions. I hope you can use this program. :D

Oh, also be sure to disable NMIs and interrupts when the NSF play or init stuff is running. Because some NSFs might have their own vectors! heheh


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 2:26 pm 
Offline

Joined: Tue Jan 04, 2005 3:07 am
Posts: 8
Location: Sofia
Quote:
I haven't been able to download the game yet, I tried yesterday too. The connection either times out or gets to 10% or so and won't continue.

Seems the host provider is playing tricks again. Is it possible to attach a file in the forum posts? Or I should change host again, grrrrr. Works fine from here though. The web1000 and edula accounts which I had, dissapeared for some reason.

It's late now, I will look at the replayer tommorow.

Quote:
Oh, also be sure to disable NMIs and interrupts when the NSF play or init stuff is running. Because some NSFs might have their own vectors! heheh
Yes, I learned this the hard way - random crashes and hours of debugging, because of interrupts. SEI and CLI solved many headeaches.

_________________
drHirudo


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: HihiDanni and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group