Has anyone tried to make a website specifically for revers engineered games?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

DirtyMcDingus
Posts: 22
Joined: Sat Jul 25, 2020 5:31 pm

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by DirtyMcDingus » Wed Jul 29, 2020 5:18 pm

@oRBIT2002
Haha, yeah calima has it right. I basically stared at the raw disassembly until it made sense. I poked around in FCEUX when I wanted to test some ideas. There were no shortcuts. There are several hundred man hours in this reverse engineered code. Including Dragon Warrior, I have probably reversed engineered close to 100,000 lines of code between NES games and old arcade games. I'm getting pretty good at it.

Now for something a little off the off topic. This post got me thinking about sharing how I do it. I just started Mike Tyson's Punchout. I'm still getting the disassembly to a point where I can work on it. I haven't really started any of the reverse engineering. Would it be interesting to people if I started a new thread and posted my progress as I worked on the game? I would try to post every time I made good progress or discovered something interesting. I would also create a repository on Github as well for anyone interested in following along.

DirtyMcDingus
Posts: 22
Joined: Sat Jul 25, 2020 5:31 pm

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by DirtyMcDingus » Wed Jul 29, 2020 5:22 pm

@Memblers
I know Arcade Archeology! My Asteroids disassembly is linked there. I've had email discussions with the owner of the site. He is the one who actually did many of the disassemblies located there!

User avatar
oRBIT2002
Posts: 622
Joined: Sun Mar 19, 2006 3:06 am
Location: Gothenburg/Sweden

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by oRBIT2002 » Thu Jul 30, 2020 1:45 am

DirtyMcDingus wrote:
Wed Jul 29, 2020 5:18 pm
Now for something a little off the off topic. This post got me thinking about sharing how I do it. I just started Mike Tyson's Punchout. I'm still getting the disassembly to a point where I can work on it. I haven't really started any of the reverse engineering. Would it be interesting to people if I started a new thread and posted my progress as I worked on the game? I would try to post every time I made good progress or discovered something interesting. I would also create a repository on Github as well for anyone interested in following along.
Sounds awesome! :)

Pokun
Posts: 1492
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by Pokun » Thu Jul 30, 2020 5:28 am

I think documenting and standardizing disassembly work is a very good idea. I'm pretty bad at disassembling and have a hard time understanding other people's code in general, so I wouldn't mind learning more about how to do it effectively.

Also Dragon Quest is one of my absolute favourite game series of all time, so I'm very pleased to see a complete disassembly of DW. Thank you for your hard work!
Now it's just too bad that it's "only" DW (although that is a good thing in regards to seeing the saving system) so it doesn't tell how the DQ passwords works. It has been discussed a bit here.

User avatar
oRBIT2002
Posts: 622
Joined: Sun Mar 19, 2006 3:06 am
Location: Gothenburg/Sweden

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by oRBIT2002 » Thu Jul 30, 2020 7:58 am

I'd like to learn efficient techniques (if any) for disassembling NES-stuff. Running the code through a disassembler can anyone do but understanding and documenting it later, well, it's a different story.
I have a theory of working "backwards" here. Running the game and then analyze each memorylocation and give all locations a label (in Mesen) which might make reading the code easier in the end..(?)

DirtyMcDingus
Posts: 22
Joined: Sat Jul 25, 2020 5:31 pm

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by DirtyMcDingus » Thu Jul 30, 2020 6:55 pm

Its settled! I'll create a Mike Tyson's repository and start a new forum for documenting my progress! I should have everything up and ready to go by the end of the weekend...

DirtyMcDingus
Posts: 22
Joined: Sat Jul 25, 2020 5:31 pm

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by DirtyMcDingus » Thu Jul 30, 2020 7:00 pm

oRBIT2002,
Hopefully the Mike Tyson's punch out forum I have in mind will help you understand how the reverse engineering is done (at least by me) and the thought processes I use as I poke and prod the code.

Did you read through the Dragon Warrior disassembly? I tried to make the comments very verbose to make it easy to follow.

DirtyMcDingus
Posts: 22
Joined: Sat Jul 25, 2020 5:31 pm

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by DirtyMcDingus » Thu Jul 30, 2020 7:04 pm

Pokun,
I never actually played Dragon Quest. There were some unused code chunks in Dragon Warrior that I'm assuming were remnants from Dragon Quest. I thought is was a Japanese game. Did you play a translated version?

User avatar
Bregalad
Posts: 7890
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by Bregalad » Mon Aug 03, 2020 1:21 pm

oRBIT2002 wrote:
Thu Jul 30, 2020 7:58 am
I'd like to learn efficient techniques (if any) for disassembling NES-stuff. Running the code through a disassembler can anyone do but understanding and documenting it later, well, it's a different story.
I have a theory of working "backwards" here. Running the game and then analyze each memorylocation and give all locations a label (in Mesen) which might make reading the code easier in the end..(?)
It's actually a very interesting and very hard work to do.
It's necessary to know what memory values are used, similarly to if you'd do some cheating or romhacking work. It's also important to have educated guesses. A method that is interesting is to replace JSR instructions by 3xNOP and see what happens... it can tell you what exactly a routine is doing because what it's doing will be missing :D

This brings up good memories of trying to disassemble and reverse-engineer FF1 long before Dish did his much better disassembly. I also did some work on Rad Racer, everything is unfortunately lost. I can remember Nasir's coding was awful in some places (*), like converting hex numbers to decimal where he used 3 tables of 255 numbers instead of a small loop !

(*) no personal offense to him

Pokun
Posts: 1492
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by Pokun » Mon Aug 03, 2020 3:57 pm

DirtyMcDingus wrote:
Thu Jul 30, 2020 7:04 pm
Pokun,
I never actually played Dragon Quest. There were some unused code chunks in Dragon Warrior that I'm assuming were remnants from Dragon Quest. I thought is was a Japanese game. Did you play a translated version?
Interesting. I made a list of DQ-DW differences that you might want to check out. I also included some trivia of the named NPCs in the game that I could only find on the Japanese internet, now in English. I'm in the making of a similar list for DQ2-DW2 as well.

Yes DQ is of course Japanese. I can read and write Japanese fine, and I have a CIB copy of the original Japanese version of every DQ game in the main series in my collection. It's very cheap to collect, and about every used-games store in Japan has at least one game in the series (like DQ8 or 9). The hardest thing is probably to find DQ1 and DQ2 in good conditions as they are usually heavily used.

There is a translation now though, and user Bregalad here made a fix for the password system (maybe the fix is already incorporated into the latest version of the translation patch though, I don't really know).

strat
Posts: 364
Joined: Mon Apr 07, 2008 6:08 pm
Location: Missouri

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by strat » Mon Aug 03, 2020 7:54 pm

oRBIT2002 wrote:
Thu Jul 30, 2020 7:58 am
I have a theory of working "backwards" here. Running the game and then analyze each memorylocation and give all locations a label (in Mesen) which might make reading the code easier in the end..(?)
That's how I figured out everything in the few games I've attempted to disassemble. Start from the result on screen and work backwards. I got the urge to document Chrono Trigger's battle system (spoilers: decided working on my own game was more important than a fetish project) and started with the damage numbers that float down in front of the target. From there I was able to find the routines that calculate the damage and determine the enemy's attack, though only have rough notes.
Bregalad wrote:It's also important to have educated guesses. A method that is interesting is to replace JSR instructions by 3xNOP and see what happens... it can tell you what exactly a routine is doing because what it's doing will be missing
I think that works good for action games - I did that with Balloon Kid to disable the result of player/sprite collisions so the player just moves through everything. For CT I set a bunch of breakpoints and got into situations to see if that code would run. For ex:

Code: Select all

; damage = damage * -1
$C1/DDAF AD 89 AD    LDA $AD89  [$7E:AD89]   A:0000 X:0000 Y:0000 P:envmxdiZc
$C1/DDB2 49 FF FF    EOR #$FFFF              A:0000 X:0000 Y:0000 P:envmxdiZc
$C1/DDB5 1A          INC A                   A:0000 X:0000 Y:0000 P:envmxdiZc
$C1/DDB6 8D 89 AD    STA $AD89  [$7E:AD89]   A:0000 X:0000 Y:0000 P:envmxdiZc
At first I thought this might result from a healing spell, but that was a negative, so I asked myself what else in CT could heal a target? Sure enough this snippet runs when a target absorbs elemental damage as healing (which both monsters and characters in CT can do).

It's also fun to do some memory poking. I can get different monsters into Spekkio's room and change the enemy's next attack on the fly. In Balloon Kid if you change D100 to 0 the level continues scrolling with the player absent (simply changing it back to 1 brings her back).

fadden
Posts: 2
Joined: Tue Aug 04, 2020 3:03 pm

Re: Has anyone tried to make a website specifically for revers engineered games?

Post by fadden » Tue Aug 04, 2020 3:39 pm

I'm curious whether anyone here has tried the 6502bench SourceGen disassembler (full disclosure: I wrote it).

For example, here's SMB exported as HTML. Among SourceGen's features is the ability to display graphics in-line, e.g. this section. Sometimes the images aren't quite right, because the simple visualizer I wrote doesn't do much with palettes or handle certain reflection modes, but it at least lets you tell which character is being drawn. I rendered the CHR ROM as a simple 1:1 scale grid.

SourceGen also allows you to write "plugins" that handle inline data following a JSR/JSL/BRK. So if you have a lot of BRK instructions that need to be formatted in a certain way, you can write a bit of C# that handles the formatting automatically. (Handy for Apple /// SOS calls if you're into that.)

The project files contain no part of the original -- no code, no graphics, not one byte -- so you can share the disassembly without including any copyrighted material. Anybody who wants to view the project needs to have the same binary. The project file itself is text (JSON). You can also export as HTML, with or without GIFs for bitmaps and animated sequences, or as source code for various cross-assemblers (including cc65).

I finally finished 65816 support, but most SNES games are too big to handle reasonably... it currently shows the project in a single scrolling window, which is fine for 40KB, not so fine for 4MB.

The program is free, but does require Windows 7 or later.

Post Reply