News:

11 March 2016 - Forum Rules

Main Menu

Basics for Sega Saturn hacking

Started by lytron, July 09, 2014, 06:00:02 AM

Previous topic - Next topic

lytron

Hello,

I was asked to look a bit into Saturn hacking, and I... don't know the tiniest bit about it.

So, here some questions:

1) Is there a Sega Saturn Code Decompiler of any sort, or do I have to disassemble?
2) Speaking of disassembling: Where to start? I have spotted one file I guess to be the main code file. Do I start at Byte 0, or is there, like in SNES ROMs, a vector at a certain Position that Points to the program start?
3) It is a lifetime filling Task to disassemble a game/program that is written in a high Level programming language, isn't it?

Thanks in advance for helping me out / strengthening my doubts. ;)

FAST6191

I am not much of a Saturn hacker but I did read up on things once and again in recent days when doing some background for the hack any console thread/project thing I considered ( http://www.romhacking.net/forum/index.php/topic,18310.0.html ).

1) Though computer science is doing some good stuff the only thing you will see a useful decompiler for is something written in an interpreted language or a language with extensive libraries (C#/.net and related things there mainly). On older systems this basically means SCUMM, ZZT and things like that. On more modern systems it is probably going to be java things, .net and family has some stuff, lua and python driven things. The Saturn did exist kind of in the rise of C so there may be something some day but equally the Saturn was a pig to code for so I would not be surprised to see lots of games using extensive inline assembly, nobody has yet done an analysis from what I have seen though but given it benefits from dynamic recompilation it is not going to be all bad.

2) I assume you mean actual disassembly of program code rather than iso extraction. For the latter I believe it is fairly standard iso stuff though I have not had cause to look in depth here (similar vintage systems do things like raw addressing and putting things outside the filesystems).
Anyway disassembly... remember the part when I said the Saturn was a pig to code for? This is mainly as it contains several different processors, often of different types, and all with different tasks as well as the complexity/endless list of quirks that is likely to happen when you release a machine with all that in 1994 (and also try to bolt mid 1990's vintage 3d support on in the later stages of development).
Still Sega showed some restraint and the main processors are two SuperH from Hitachi, specifically the SH2 family. They are flanked by various things but a 68030 for the sound governor (though sound has some more stuff beyond that) and the video chips, usually called VDP1 and VDP2, though these are closer to normal dumb chips/graphics handling type setups than straight up processors; http://wiki.yabause.org/index.php5?title=VDP1 and http://wiki.yabause.org/index.php5?title=VDP2 . Oh and the CD drive also has a processor you get to speak to much like the video stuff ( http://wiki.yabause.org/index.php5?title=CDCommands ), technically it is a SH1 chip doing the controlling and I mention this mainly as it allows for some slightly easier tracing sessions.
Getting towards the point... any system without the main data source mapped into memory, especially one where said data source is as slow and latency prone as 2x CD, will tend to copy things from said data source into normal memory. This tends to mean basically anything goes, I can point you at entry points for the system and as far as I know the Saturn did not use ELF or anything (the playstation family does stuff like this) but I am not sure how much good it would do. You are better off looking at a disassembly window of a debugger (and there are more popular systems with lesser debuggers than those of yabause) as the game is running. Compression did exist and was fairly extensively used in the Saturn but I am not sure how often any binaries, or binary extensions, do things with it.
Also of note is that the system existed rather nicely in the period between extensive software abstraction but after filesystems became a thing -- if you look at all the tools on somewhere like http://www.romhacking.net/?page=utilities&category=&platform=13&game=&author=&os=&level=&perpage=50&title=&desc=&utilsearch=Go then you will see most are geared towards turning things into "hardware compatible" versions.

3) Kind of depends what you want to do with it. If you want to know all of the systems so you can make a nice C version to press compile and run on a PC then that is actually reasonably doable over a year or two, assuming you have most of the base skills in place. If you want to have it in such a way that you can fiddle, press compile and run it on real hardware where said real hardware is something like the Saturn then yes, yes it is; even getting something into a position where you can press assemble and have it work is a reasonable feat. If you want to disassemble it so you have a rough idea of what each section does and maybe some of the specific mechanics, mainly so someone can come to the game and be pointed in the right direction for the part they want to alter, then this is very doable and has already happened for several games on several systems.

lytron

Thank you for the very informative answer! This gives me a good start point.

Last question, I don't know if you can help me there, it's more a practical thing: Which Emulator/Debugger should I use? Yabause doesn't seem to have a feature where you let it run codelines step by step from the beginning, and programs like girigiri expect to have a physical copy (bad for testing). Any recommendations?

Thanks again! :)

LaLaPico

I hate to bump this old thread, but I too would like to get involved in helping to start up a Saturn translation/hacking revolution.

Unless it's simply just too difficult --- I mean, it couldn't be a lack of interest, could it?

travel27

I hope the Saturn can receive more attention someday. Tons of great games, but underrepresented on the emulation and translation scene.  I used to think it was my computer, all of the games are very choppy when trying to play various Saturn translations on it.  But now I am not so sure.  That same computer flawlessly plays any Dreamcast game I throw at it (Skies of Arcadia, Virtua Tennis, EGG, Time stalkers, etc.), PS2 games like Star Ocean 3, Tales of the Abyss, FFx, and FFXII play perfectly and it even worked very well when I tried Tales of Graces F, a PS3 game!  So now I think it is more the Saturn emulation scene can use some more love, more than anything about my computer.  Just my opinion along with some hope.

MysticLord

You can find good things on github often, but their internal search function is pretty bad. I recommend Google, with this exact search string:
sega saturn site:github.com

Experiment with terms other than (or in combination with) sega and saturn.