Decompiling/recompiling

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
DrWho198
Posts: 25
Joined: Mon Feb 23, 2015 8:05 pm

Decompiling/recompiling

Post by DrWho198 » Thu Jan 04, 2018 10:23 am

I have been looking for a good decompiler for nes roms.
Is there a reliable decompiler that produces assembler code that can be recompiled without much problems?

My target is to decompile fds games adapt them and recompile them to cartridge roms.
I know this is not as easy as it sounds but I'm interested in having a look at it.

lidnariq
Posts: 9282
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Decompiling/recompiling

Post by lidnariq » Thu Jan 04, 2018 11:16 am

I have been reasonably pleased with bisqwit's nescom's clever-disasm.

BUT: It can't load FDS files. And it still requires a fair amount of manual assistance.

User avatar
Dwedit
Posts: 4300
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Decompiling/recompiling

Post by Dwedit » Thu Jan 04, 2018 7:21 pm

It is possible to hack FDS games into cartridge games as long as you get the memory map correct.
FDS games map code at 6000-DFFF, then the FDS BIOS lives at E000-FFFF.

For games that do not need to load, you can copy the 6000-7FFF bank into WRAM at bootup, copy the reset/nmi/irq vectors to FFFF, then jump to the reset vector.

The pirate mapper 42 was designed for this task as it gives a swappable bank at 6000.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

lidnariq
Posts: 9282
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Decompiling/recompiling

Post by lidnariq » Thu Jan 04, 2018 7:43 pm

There have been a whole bunch of different pirate carts made for FDS ports. Not all of them are shaped like mappers 40/42/50.

Per FCEUX's source, iNES mapper 103 and UNIF MAPRs KS7030, KS7031, KS7037, KS7057, LE05, LH01, LH53, and MARIO1-MALEE2 are other shapes that have been used.

User avatar
rainwarrior
Posts: 7800
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Decompiling/recompiling

Post by rainwarrior » Thu Jan 04, 2018 7:47 pm

At least when disassembling FDS files, there's convenient data in the disk format about where every PRG block should be addressed. ;)

Oziphantom
Posts: 825
Joined: Tue Feb 07, 2017 2:03 am

Re: Decompiling/recompiling

Post by Oziphantom » Thu Jan 04, 2018 9:48 pm

http://csdb.dk/release/?id=149429

IF you want to search for others its Dissasmebly not decompile, the code is not being converted back into a high level language. Although there are decompilers out there.

DrWho198
Posts: 25
Joined: Mon Feb 23, 2015 8:05 pm

Re: Decompiling/recompiling

Post by DrWho198 » Mon Jan 22, 2018 5:02 am

Thanks for all the help.
Right now the project is not my priority anymore but I'm probably going to have a look at it in the future.

@Oziphantom:
Thank you for that out to me. Somehow I always mixed those two up.

Post Reply