Page 1 of 1
Using the SNES PowerPak for development
Posted: Sat Jan 02, 2010 5:43 am
by artakserkso
First of all, I'd like to state that I'm a complete n00b in SNESDev.
Regardless, it's not my code I can't get to run on the PowerPak, it's someone else's.
I tried some tutorials here and there, read up a bit on the 65816 and then realized something - I should first try to get any kind of example code running on the SNES, because developing for it was/is my ultimate goal.
That's when MottZilla, who was very helpful with all my newbie questions thus far (thanks, MZ!), showed me to an example I really loved -
the XMSNES (look for the example demo under Files). Loading a background, "writing" on-screen, music, nicely commented... It had everything. Unfortunately, I can't get it to run with the PowerPak. Not even some tutorial code that worked with bsnes when I used neviksti's SNES init code instead of the one provided for the tutorial.
I realize I need to fix the header or checksum of any ROM image I assembled, but I really don't know what exactly the PowerPak expects and how I am to achieve it. With the help of Jeroen, I tried fooling around SNES-Tool, but that didn't really work. Maybe we were doing it the wrong way. Any and all game ROM images work with the PowerPak, but nothing easier such as a couple of lines example code to change the background color or a harder example such as XMSNES seems to work (it complains about lacking internal headers, then something very cryptic; sometimes it even locks up when trying to copy to memory).
My current failures in being able to run bsnes aside for now (it works with XMSNES and the tutorial code I copied on my gf's laptop, where I can get it to run - on my desktop, it now no longer works with anything (!), it only loads up a black screen), I would really love to see any code I could either understand or begin to understand within a couple of months/years or so tailored for and working with the PowerPak.
If any of you guys can help me with this or point me to other good examples, please do. Getting into SNESDev from scratch seems to be much harder than the same for NESDev, but I would really like to go that more direct path (I don't mean assembly-wise, as I understand 65816 is mostly a superset of 6502). Any personal success stories on learning about more than 65816 assembly and running code on the SNES PowerPak would also be appreciated.
Thanks!
Posted: Sat Jan 02, 2010 3:50 pm
by Memblers
I had a pretty good background working with the NES when I did some SNES development, so it was fairly comfortable and familiar. The main thing was all the PPU registers, it's much more complex than NES. I had to use someone else's initialization code at reset, there's no shame in doing that.

After that it took me a little while to set up the VRAM and video mode properly. But it was smooth sailing after that, after that it was just a matter of keeping in mind the 8/16-bit mode selection so the assembler doesn't make the wrong opcode lengths.
If you need to fix the checksum (it wouldn't be smart for PowerPak to use that, as most translations/hacks/etc/devbuilds leave it broken) you can use ucon64. I forget the command, but -help -snes will show all the commands available.
Posted: Sat Jan 02, 2010 6:00 pm
by artakserkso
Great stuff, Memblers, thanks. I'll try and take a similar path to knowledge.
Unfortunately, fixing the checksum (ucon -chk) along with converting to gd3 (-gd3) or rewriting the smc header (-smc), even combining the checksum fix and header repair, didn't work with the PowerPak.
I'd really, really love to see at least some snippet of visually verifiable homebrew code working with the PowerPak. If anyone gets anything working, please drop me a line here. I'm desperate to see something work.
Posted: Sat Jan 02, 2010 6:10 pm
by d4s
Expand the ROM to 4 Mbit and it will most likely work.
PowerPak appears to have problems with smaller ROMs.
Posted: Sat Jan 02, 2010 6:55 pm
by artakserkso
Ahhh, finally some progress.
Expanding to 4Mbit with Lunar Expand (a Windows tool

... is there a way to do it with ucon64?) partially worked.
The colours/graphics are very messed up. XMSNES loads with a very light background color, the graphics are mostly invisible and the font is barely readable (it is almost the same as the background).
The tutorial code (that should paint the background magenta) turns the screen to a weird, pixelated yellow (and fails to clear the information about copying the ROM to the PowerPak's memory).
If pictures or the output in LOG.TXT would help clarify, I can post those.
Posted: Sun Jan 03, 2010 11:54 am
by MottZilla
After expanding you could try using UCON64 to convert the ROM to another format too. Try the GD3 format seeing how it will load the Star Ocean SDD1 perhaps it actually uses the GD3 header information which might help with loading ROMs that cause you problems.
Posted: Sun Jan 03, 2010 12:49 pm
by artakserkso
I tried expanding xmsnes.smc and magenta.smc with Lunar Expand and UCON64, along with trying both the .smc and .gd3 (thus, 4 possibilities).
Nothing worked better than before, same problems.
I was a bit taken aback by the fact that the .smc and .gd3 had 524800 bytes instead of 524288, but I understand those must be the SWC and GD3 headers, consecutively (don't know really why SWC and not SMC, but that's what the PowerPak recognizes it as). For some reason, UCON64 once padded the ROMs to 524288 bytes (when I used it with -pad twice on a ROM). Whatever the number should be, no combination of anything works.
Same ugly yellow instead of the lovely magenta, same pale XMSNES (although the music works almost perfectly - there is a faint crackle when you listen closely).
Posted: Sun Jan 03, 2010 1:29 pm
by whicker
Have you checked to see if your homebrew rom image has the official "Nintendo" information near where the interrupt vectors are? As in, the information about the Internal Name, checksum, mapper (mode 20, 21, etc), ROM size (power of 2), Battery RAM size, version, etc.
Unless we hear from the man who made this, I don't think copier headers do jack squat.
Maybe posting log.txt would help. Unlike an emulator that can guess on-the-fly, the physical hardware needs to know exactly how your game pak is "constructed", so to speak.
Posted: Sun Jan 03, 2010 2:07 pm
by d4s
artakserkso wrote:
I'd really, really love to see at least some snippet of visually verifiable homebrew code working with the PowerPak. If anyone gets anything working, please drop me a line here. I'm desperate to see something work.
Oh, and here's a shameless self plug:
If you want to see homebrew code that runs perfectly on the PowerPak, check out the sourcecode of a game i released some time ago:
http://gra.dforce3000.de/
Posted: Sun Jan 03, 2010 5:33 pm
by artakserkso
whicker wrote:Have you checked to see if your homebrew rom image has the official "Nintendo" information near where the interrupt vectors are? As in, the information about the Internal Name, checksum, mapper (mode 20, 21, etc), ROM size (power of 2), Battery RAM size, version, etc.
Your post made me realize how much I have to learn.
I think there's no point in trying to run "my" code for now. I need to read up more on SNESdev. I certainly won't embarrass myself here by blindly asking away about something I should obviously look up on my own.
d4s wrote:Oh, and here's a shameless self plug:
If you want to see homebrew code that runs perfectly on the PowerPak, check out the sourcecode of a game i released some time ago:
http://gra.dforce3000.de/
OMG! That's
exactly what I need! Thanks a million! When I first found this forum, I saw and acknowledged the game's (and source code's) existence, but I never imagined that studying the code would be a plausible idea. It truly does work perfectly with the PowerPak! All that code is very intimidating, though... If you have any invaluable advice on what it takes to understand it, I'm all ears!
Now that I have seen the overall scarcity of good tutorials and introductory information,
especially considering the fact that some good stuff doesn't run on the PowerPak out of the box (XMSNES, for example... also, Skipp and Friends which I just tried - the .smc doesn't load all the level graphics for some reason ((most of the level is white and you don't know where the walls are)), and when converted to .gd3 it doesn't work at all:
here's the LOG.TXT), N-Warp Daisakusen seems too good to be true.
Oh, right... XMSNES and the tutorial code I initially wanted to run have very similar LOG.TXTs to that linked to in the parentheses above (sorry for its bad formatting, it was pasted verbatim).
Posted: Sun Jan 03, 2010 8:59 pm
by whicker
Hey, nobody should be embarrassed right now. None of this stuff is intuitive. For info on the internal header, it's in the official SNES developer manual (google is your friend).
The Powerpak log.txt confirms it can't find a viable internal header, so it's either guessing wrong or doesn't know what to do.
Posted: Mon Jan 04, 2010 1:43 am
by koitsu
The
SNES documentation I wrote long ago should contain a demo/intro with source code that you can assemble using TRASM (now known as x816; should work there with little modification, if any). It should be called TEST.LZH (yes, an LZH/LHA within a ZIP file). This intro was written + tested on actual hardware and not emulators (we didn't have such back in the day :P). It'd be a good starting point.
Posted: Mon Jan 04, 2010 4:56 pm
by artakserkso
Thanks for the tips, guys!
I'm sure I'll have many questions when I learn some more.
Posted: Sat Feb 19, 2011 1:51 pm
by ikari_01
artakserkso wrote:also, Skipp and Friends which I just tried - the .smc doesn't load all the level graphics for some reason ((most of the level is white and you don't know where the walls are))
The game doesn't initialize $2132 properly, leading to wrong layer1+2 colors on real hardware. It's not the PowerPak's fault
Here's a fixed version.
Posted: Sun Feb 20, 2011 7:40 am
by KungFuFurby
Skipp and Friends doesn't actually use XMSNES, but uses SNESMod. SNESMod is by the same person that made XMSNES. See
http://snes.mukunda.com/ .
If you can get a game up and running that uses XMSNES, I'd be really surprised... ^_^