Page 1 of 1

Decompiling/recompiling

Posted: Thu Jan 04, 2018 10:23 am
by DrWho198
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.

Re: Decompiling/recompiling

Posted: Thu Jan 04, 2018 11:16 am
by lidnariq
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.

Re: Decompiling/recompiling

Posted: Thu Jan 04, 2018 7:21 pm
by Dwedit
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.

Re: Decompiling/recompiling

Posted: Thu Jan 04, 2018 7:43 pm
by lidnariq
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.

Re: Decompiling/recompiling

Posted: Thu Jan 04, 2018 7:47 pm
by rainwarrior
At least when disassembling FDS files, there's convenient data in the disk format about where every PRG block should be addressed. ;)

Re: Decompiling/recompiling

Posted: Thu Jan 04, 2018 9:48 pm
by Oziphantom
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.

Re: Decompiling/recompiling

Posted: Mon Jan 22, 2018 5:02 am
by DrWho198
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.