TheAllmightyStegosaurus, what are you hoping to be able to do? If you're working on a TAS, you don't necessarily need the full source code for a game. You do need to spend time learning and understanding the game, but there's a lot you can accomplish just using savestates and observing what happens onscreen. Reverse engineering the binary code of a game to understand how it works is a big job in itself. For a game like Mega Man 3, even something as seemingly simple as, say, understanding the map file format could take dozens of hours of work.
My advice, if you're working on a TAS, is not to start at such a low level. Watch the fastest RTA runs (
megamanleaderboards.net,
speedrun.com) and learn what tricks they use. Try making a TAS of a full stage, using RTA strategies but with no mistakes.
An intermediate step, before you dive into full reverse engineering of the code, is
finding useful RAM addresses, such as Mega Man's (
x,
y) coordinates, HP, and weapon energy. Learning how to use RAM search is a good step towards acquiring the other skills you will need.
Randomno is correct, there's no automatic way to rip the source code from a compiled program. It's not like the source code is hidden in the program somewhere. The best you can do is look at the compiled binary code and infer what the source code would have been. I'm not certain about Mega Man 3, but Mega Man 1 for DOS was written in assembly, not C or some other high-level language. You can tell this (when you have enough experience) just by observing the way functions are called, for example, but in this case there's definitive evidence in the form of a
fragment of source code visible in
Gaming Historian's video. When I reverse engineered the
Sewer Rat AI in Mega Man 1, for example, I did it just as Randomno says: I looked at the assembly language disassembled from the program executable, identified the loops, figured out what the function calls did, etc. Then I wrote C code (C-like pseudocode really) with equivalent behavior because C is easier to read and understand than assembly—but the game was definitely not originally written in C. The comments are my interpretation: there are no comments or even variable names in the program itself.
Randomno recommended the
ScummVM's reverse engineering howto which is a good place to start. There are lots of reverse engineering guides online if it's something you want to learn. I use
Rizin for disassembling the machine code, annotating memory locations, giving names to functions, etc. Honestly it's not an ideal tool for this purpose; in particular, it's not very good with the memory segments of 16-bit DOS code. But I haven't spent a lot of time looking for alternative tools. But any of these tools is going to require substantial background knowledge. You will need to know how a CPU works and how to read assembly language, at least. If you're not able to do those things yet, you will have to build a foundation of knowledge first.
Start by doing some experiments with savestates and RAM search, and document your progress in the
Mega Man 3 thread because we're interested in seeing what you come up with :)