It is currently Sat Dec 16, 2017 11:43 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: NSF2NES
PostPosted: Thu Sep 08, 2016 10:26 pm 
Offline
User avatar

Joined: Sat Apr 18, 2009 4:36 am
Posts: 260
Location: Russia
Hi, Nesdev.
I want to make portable chiptune-player based on GameBoy hardware.
I've recevied GB-everdrive from krikzz.
Since it cannot play GBS-music, i use ugetab's GBS2GB converter,
it transforms GBS to GB (with built-in GBSplay integrated with ROM).
So, all works perfectly.

My question is simple: Do you know any NSF2NES converter which works like this,
for play music on devices that support NES, but don't support NSF?
(Everdrive-N8 and some emulators)


Top
 Profile  
 
 Post subject: Re: NSF2NES
PostPosted: Thu Sep 08, 2016 10:31 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6534
Location: Seattle
For NSFs that do not use bankswitching, try looking into VegaPlay.

For ones that do, it's a good deal more annoying. l_olveira has done some work, but I've never looked into specifics.


Top
 Profile  
 
 Post subject: Re: NSF2NES
PostPosted: Thu Sep 08, 2016 10:43 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
I don't believe there's a ready-made automatic utility. (Edit: lidnariq mentioned Vegaplay above for non-bankswitched NSFs.)

For NSFs without bankswitching, you can simply place the data inside NROM (32k), and write a very small stub to start playback, and find some unused part of the 32k space to insert the stub (for most NSFs there will be space at the top of the range.)
  • RESET initializes stuff (zero memory, prepare APU), calls NSF's INIT routine, turns on NMI and goes into infinite loop.
  • NMI calls NSF's PLAY routine.
  • IRQ not used.
  • Vector table must be added.

For NSFs with bankswitching, this is more difficult. The stub might be trickier to insert. (The top of the stack might be a useful place, if you can get it small enough; NSFs will not do anything special to the stack, but many NSFs will write to all places in RAM.) You could use the newly created Mapper 31 which supports NSF style bankswitching, but otherwise you will need to convert NSF banking code to use whatever the target mapper uses. (Expansion sound NSFs would have to use the mappers they belong to.)

Since NSFs are deterministic, and the music loops after a point, you could in theory automate the replacement of banking code by emulating each song for a while and logging the bankswitch writes (and unused regions where it's safe to insert code, etc.) and replacing them with operations for the target mapper.

So... I mean, you could. I don't think such a tool exists at the moment, though. I did it "by hand" a bunch of times for a few music compilations using Mapper 31. There's source code available for most of those, if you'd find that useful: Famicompo Pico (source)


Top
 Profile  
 
 Post subject: Re: NSF2NES
PostPosted: Sat Dec 02, 2017 7:24 pm 
Online
User avatar

Joined: Fri Nov 24, 2017 1:36 pm
Posts: 27
Location: Argentina
I wish to put music in vegaplay. But I do not understand:

Load Address: 0x8000
Init Address: 0x8003
Play Address: 0x8000

As I find these directions?

_________________
http://ochobitwlectqv5c.onion.link/
http://4232.cf/


Top
 Profile  
 
 Post subject: Re: NSF2NES
PostPosted: Sat Dec 02, 2017 7:38 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
If you open your NSF in NSFPlay you can click the properties button and then scroll down in thee "Misc." panel to read info about the NSF. One of the lines will give LOAD/INIT/PLAY addresses. Otherwise you can read it from the header with a hex editor.

Also noticing that my post above in this thread predates me making a utility called EZNSF for this purpose
https://forums.nesdev.com/viewtopic.php?f=6&t=15204


Top
 Profile  
 
 Post subject: Re: NSF2NES
PostPosted: Sun Dec 03, 2017 10:55 am 
Online
User avatar

Joined: Fri Nov 24, 2017 1:36 pm
Posts: 27
Location: Argentina
thanks!

_________________
http://ochobitwlectqv5c.onion.link/
http://4232.cf/


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 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