Author Topic: Chrono Trigger SOURCE CODE  (Read 5060 times)

Schala Zeal

  • Radical Dreamer (+2000)
  • *
  • Posts: 2148
  • I like pop tarts
    • View Profile
Chrono Trigger SOURCE CODE
« on: February 05, 2009, 03:31:56 am »
This was NOT easy, but I was able to decompile the Chrono Trigger SNES ROM into pure 65816 assembly code! It totals a gigantic 140 megs! Luckily it's been compressed in a convenient 6 meg zip file.

Little note though. I am not sure if this will recompile. It took a long time to disassemble and I don't want to leave my computer to reassemble it for verification. The assembly source file contains an assembly header totalling 512 bytes (or was it kilobytes?) which was roughly 0x200, and the start code is offset 0x8000.

You may want to read up on 65816 (or X816 for short) assembly before diving into this. Wikipedia should be a good start, if not Google.

EDIT: Damn forums won't accept the attachment, what a load of crap...

Vehek

  • Errare Explorer (+1500)
  • *
  • Posts: 1762
    • View Profile
Re: Chrono Trigger SOURCE CODE
« Reply #1 on: February 05, 2009, 03:45:31 am »
I've heard that you can't just "disassemble" an entire ROM automatically, because of variable-length ASM commands and data which isn't code.

Schala Zeal

  • Radical Dreamer (+2000)
  • *
  • Posts: 2148
  • I like pop tarts
    • View Profile
Re: Chrono Trigger SOURCE CODE
« Reply #2 on: February 05, 2009, 03:48:38 am »
.............damn it.... Well, I thought assembly, though cumbersome, is human readable. The source I disassembled ranged in offsets 0x8000 to 0xffffff, with 0x200 header

yaz0r

  • Architect of Kajar
  • Porrean (+50)
  • *
  • Posts: 65
    • View Profile
Re: Chrono Trigger SOURCE CODE
« Reply #3 on: February 06, 2009, 12:04:04 pm »
Doing such a thing is theoricaly doable, but due to a bunch of technical implications, I doubt it can actualy be achieved without a lot of work figuring out what is code and what is data.
Just imagine, what if the part of the game code was compressed, and uncompressed in the SNES memory and run from there ? Your static disassembly wouldn't work in that case. There is a lot of other situations that wouldn't work either, like self modifying code (that kind of technic wasn't really used before the N64 era, but you never know).

Schala Zeal

  • Radical Dreamer (+2000)
  • *
  • Posts: 2148
  • I like pop tarts
    • View Profile
Re: Chrono Trigger SOURCE CODE
« Reply #4 on: February 06, 2009, 04:01:07 pm »
Yeah... I sorta trashed it after it wouldn't reassemble. "Undefined behavior" this and that...

Jutty

  • Black Wind Agent (+600)
  • *
  • Posts: 614
  • The Most In-Frequent Poster Ever
    • View Profile
Re: Chrono Trigger SOURCE CODE
« Reply #5 on: February 06, 2009, 05:42:37 pm »
The only commercial game that has had it's source code leaked for SNES that I know of is here. http://eludevisibility.org/spacy-funky-bob-source-code/ Not sure if it will help with Chrono related stuff, but it would help for those interested in SNES development.
« Last Edit: February 06, 2009, 05:44:13 pm by Jutty »

tushantin

  • CC:DBT Dream Team
  • Hero of Time (+5000)
  • *
  • Posts: 5645
  • Under Your Moonlight, Stealing Your Stars
    • View Profile
    • My Website
Re: Chrono Trigger SOURCE CODE
« Reply #6 on: February 06, 2009, 11:39:10 pm »
 :lee: If you guys manage that it'd be a romhacking revolution, mates!

Schala Zeal

  • Radical Dreamer (+2000)
  • *
  • Posts: 2148
  • I like pop tarts
    • View Profile
Re: Chrono Trigger SOURCE CODE
« Reply #7 on: February 07, 2009, 01:10:39 am »
Well, SNESCom comes with a tool: DisAsm

Ramsus

  • Entity
  • Chronopolitan (+300)
  • *
  • Posts: 313
    • View Profile
Re: Chrono Trigger SOURCE CODE
« Reply #8 on: February 15, 2009, 06:28:21 am »
A debugger that does disassembly is immediately much more useful for reverse engineering. Then you know you're disassembling a function instead of some random bit of data, and after identifying what you want, you can figure out where it is in the ROM and use more conventional disassembly tools to rewrite parts of the game's code.

That shouldn't be too hard with a ROM either. Just figure out where each segment gets mapped to in memory, and you'll know where to look in the file after you find the memory address of an interesting function in the debugger. Or if the representation in the ROM is different, you can go back to the debugger and see what they're doing with it.

Disassembling the entire game that way though would be time consuming. If you keep careful notes and stay creative (writing some of your own tools along the way), it should be doable.