SPC to ROM
Moderator: ZSNES Mods
-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
SPC to ROM
Anyone have source code to convert an SPC file to an SNES ROM?
Anyone skilled enough to write up such a tool and willing to donate the source?
Anyone skilled enough to write up such a tool and willing to donate the source?
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding
Alpha-II made a tool called SPC2ROM a while back. It's available here.
I'm quite certain the source used to be downloadable as well, since I'm quite certain I based an improved version of the tool on it.
It's all on another computer right now, but I'll look into it. The tool available doesn't produce very reliable results, and while I made some improvements there was still the need of manually tweaking some flags to get every tune playing correctly.
I'm quite certain the source used to be downloadable as well, since I'm quite certain I based an improved version of the tool on it.

-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
Well, without source, it's useless to me.OptiRoc wrote:Alpha-II made a tool called SPC2ROM a while back. It's available here.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding
-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
Let's just say I want to add some crazy features to ZSNES.OptiRoc wrote:What are you going to use it for? (I'm just evaluating my motivation to get the tool properly polished)
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding
-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
Well, SPCs are just RAM dumps of the SPC processor with a header to tell it where to begin execution and somesuch. You should be able to write a small routine fairly easily to copy the SPC data into the SPCRAM area and jump into it.
The major problem I don't understand is how you play more than one SPC without resetting the SNES entirely. Once you give control to the SPC files' code, how do you make the SPC return to the IPLROM to load another SPC?
The major problem I don't understand is how you play more than one SPC without resetting the SNES entirely. Once you give control to the SPC files' code, how do you make the SPC return to the IPLROM to load another SPC?
Took me a while to figure out the kitchensync, and I didn´t even figured it out. I just read it in the forum. Now we have toaster support, whatever that is. Oh boy, I wonder what will be next!Nach wrote:Let's just say I want to add some crazy features to ZSNES.
[url=http://www.fsf.org/resources/formats/playogg]PlayOgg[/url]
-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
So is this a good or bad time to tell you ZSNESW is now Microsoft Smart Home compatible?anewuser wrote:Took me a while to figure out the kitchensync, and I didn´t even figured it out. I just read it in the forum. Now we have toaster support, whatever that is. Oh boy, I wonder what will be next!Nach wrote:Let's just say I want to add some crazy features to ZSNES.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding
Like woah, source code here.
-
- Romhacking God
- Posts: 922
- Joined: Wed Jul 28, 2004 11:27 pm
- Contact:
If memory serves me correctly, your SPC program can still check the ports from the main CPU. I think it's up to you to collaborate exchanging data from that point on. You'd check for a certain values coming from the port periodically from the ROM, and that would initiate the data transfer. You'd have code to handle this on both the ROM side and SPC side.byuusan wrote:Well, SPCs are just RAM dumps of the SPC processor with a header to tell it where to begin execution and somesuch. You should be able to write a small routine fairly easily to copy the SPC data into the SPCRAM area and jump into it.
The major problem I don't understand is how you play more than one SPC without resetting the SNES entirely. Once you give control to the SPC files' code, how do you make the SPC return to the IPLROM to load another SPC?
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
But wouldn't that require modifying each SPC file before its loaded into the SPC? I don't think that'd be practical...
Not sure, but I don't think you know that SPC2ROM takes ONE spc and converts it...
Even so, why not have a hard reset? If the SNES can reset itself, including the SPC computer, then just use an itty bitty SRAM file to keep track of whats going on and have it reset itelf to change SPC files...
Also, SPC2ROM loads its own program inside the SPC file in unused space to be executed before the song you want to play. This way you can restore the register values. If you can somehow make that part of the main program loop, you'd be set.
Not sure, but I don't think you know that SPC2ROM takes ONE spc and converts it...
Even so, why not have a hard reset? If the SNES can reset itself, including the SPC computer, then just use an itty bitty SRAM file to keep track of whats going on and have it reset itelf to change SPC files...
Also, SPC2ROM loads its own program inside the SPC file in unused space to be executed before the song you want to play. This way you can restore the register values. If you can somehow make that part of the main program loop, you'd be set.
SHREIK!!!!!!! DDdddnnnnnnaaaa! GESTAHLLLLLLLLLL!!!!!!!!
Steelers now officially own your ass.
Steelers now officially own your ass.
-
- Dark Wind
- Posts: 1271
- Joined: Thu Jul 29, 2004 8:58 pm
- Location: Texas
- Contact:
I had this awesome idea for a crazy feature last night in the shower, but now I can't remember it.Nach wrote:Let's just say I want to add some crazy features to ZSNES.OptiRoc wrote:What are you going to use it for? (I'm just evaluating my motivation to get the tool properly polished)

[u][url=http://bash.org/?577451]#577451[/url][/u]
That's exactly the point I was making. Not practical.But wouldn't that require modifying each SPC file before its loaded into the SPC? I don't think that'd be practical...
The SNES cannot reset itself via code; the reset line is controlled by hardware only.Even so, why not have a hard reset? If the SNES can reset itself, including the SPC computer, then just use an itty bitty SRAM file to keep track of whats going on and have it reset itelf to change SPC files...
You transfer all control to the SPC. Unless you modify that SPC, there's no way to regain control of it. The SPC may have a special code you can write to $2140-$2143 on the SNES side to make the SPC700 jump to the IPL ROM code at $ffc0, but again: this would vary for every SPC.Also, SPC2ROM loads its own program inside the SPC file in unused space to be executed before the song you want to play. This way you can restore the register values. If you can somehow make that part of the main program loop, you'd be set.
Even then, not all games have commands to soft reset the APU, for another load, which means you have to either modify the spc to handle loading that command, or find a way to manipulate the IO ports, to overwrite a section of code, the section of interest being the part jumped to, when finished loading. If the code was very well written, then that may not be possible, and as a result, the only option left, is to modify the spc, before loading it.You transfer all control to the SPC. Unless you modify that SPC, there's no way to regain control of it. The SPC may have a special code you can write to $2140-$2143 on the SNES side to make the SPC700 jump to the IPL ROM code at $ffc0, but again: this would vary for every SPC.Also, SPC2ROM loads its own program inside the SPC file in unused space to be executed before the song you want to play. This way you can restore the register values. If you can somehow make that part of the main program loop, you'd be set.
Specifically, the modifying code must check for a specific sequence on the IO ports, and if not found, continue running. If it is found, it is then to write a certain bit, to turn IPL rom back on, write the Key Off register with 0xFF, then jump to the IPL. Failure to write the Key Off register may result in a possible headache, because of the tone that won't stop playing until something else is loaded. Of course, if you forget to write the register, it can still be done from the IPL code, just make the first write go to 0x00F2, and write for the next 2 bytes, the Key Off register, then 0xFF, then start a new transfer.