nesdev.com
http://forums.nesdev.com/

Disassemble & Reassemble?
http://forums.nesdev.com/viewtopic.php?f=2&t=15618
Page 1 of 1

Author:  FARID [ Mon Mar 06, 2017 11:39 am ]
Post subject:  Disassemble & Reassemble?

I tested a few tools to disassemble and reassemble "Super Mario Bros. (W) [!].nes" but most of them give me strange errors.
Here is the only method which worked for me to some extent :

How to Disassemble :
Disassemble mario.nes with NESrevPlus
Select DASM format and Save "mario.asm"
Open "mario.asm" and find JMP $0006 and change it to JMP ($0006) [it seems to be a bug of disassembler]

How to Reassemble :
Use dasm to generate "mario.prg" : dasm mario.asm -f3 -omario.prg
Seperate "mario.chr" by using famiROM
Take out 16bytes header by using HxD and save it as "mario.hed"
Use cmd to generate "mario.nes" : copy /b mario.hed+mario.prg+mario.chr mario.nes

I would like to know how other people disassemble & reassemble a nes game.

Author:  lidnariq [ Mon Mar 06, 2017 11:58 am ]
Post subject:  Re: Disassemble & Reassemble?

Bisqwit's clever-disasm.

Author:  dougeff [ Mon Mar 06, 2017 1:16 pm ]
Post subject:  Re: Disassemble & Reassemble?

I have a disassembler half done, put it on the 'back burner' to work on some other things.

It separates the PRG and CHR ROMs and writes a file (with header) that can reassemble them. The ASM it generates is not great, lots of assembler errors of labels not found.

I've used frantiks tool and reassembled with asm6.

Author:  FARID [ Mon Mar 06, 2017 1:50 pm ]
Post subject:  Re: Disassemble & Reassemble?

Thanks for the comments but please give more details

Author:  tepples [ Mon Mar 06, 2017 2:04 pm ]
Post subject:  Re: Disassemble & Reassemble?

About which step of the process would you like more detail?

Otherwise, it becomes more difficult to "explain more please" with "much detail".

Author:  FARID [ Mon Mar 06, 2017 2:15 pm ]
Post subject:  Re: Disassemble & Reassemble?

tepples wrote:
About which step of the process would you like more detail?

Otherwise, it becomes more difficult to "explain more please" with "much detail".


Just use the first post as a template

Author:  rainwarrior [ Mon Mar 06, 2017 2:53 pm ]
Post subject:  Re: Disassemble & Reassemble?

I use cc65's disassembler, code-data logs from FCEUX, and iteratively re-disassemble adding labels to an annotation file as I analyze the code.

Here's how I described this a previous time it was asked:
http://forums.nesdev.com/viewtopic.php?p=158176#p158176

Author:  dougeff [ Mon Mar 06, 2017 4:18 pm ]
Post subject:  Re: Disassemble & Reassemble?

More details...

Frantiks DISASM6 tool...

http://www.romhacking.net/forum/index.p ... #msg178059

Sometimes with a CDL file from FCEUX (made by playing the game with CDL logger turned 'on')

Manually type header at top of file. Manually type .incbin "CHR.chr" at the bottom.

Cut and paste CHR ROM in hex editor to a new file (I use an old obsolete one).

Assemble with asm6.

Author:  Oziphantom [ Tue Mar 07, 2017 6:25 am ]
Post subject:  Re: Disassemble & Reassemble?

I use Regenerator http://csdb.dk/release/?id=149429, I have to pull the ROMs out of the NES first though . It now has a NES mode and outputs in TASS64 format. Its an interactive dissasmbler similar to FCEX et al, but with a lot more features to handle words, lo/hi hi/lo address tables, rts format etc. I did start making a Super Regenerator which might handle NES better, but its SNES LOROM only at the moment, which might or might not work depending upon your Mapper.
Then if I wanted to put it all back together, I would use a batch file to assemble the ROMs then use a asm file to pack them altogether again. Could easily be automated I would think for volume.

Author:  FARID [ Tue Mar 07, 2017 10:33 am ]
Post subject:  Re: Disassemble & Reassemble?

Ok here is another method by using NESrevPlus and ASM6 :

How to Disassemble :
Disassemble mario.nes with NESrevPlus
Select X816 format and Save "mario.asm"

How to Reassemble :
Take out 16bytes header by using HxD and save it as "mario.hed"
Seperate "mario.chr" by using famiROM
Open "mario.asm" with Notepad++
Add to the first line of the file : .incbin "mario.hed"
Remove : .MEM 8
Remove : .INDEX 8
Add to the last line of the file : .incbin "mario.chr"
Find JMP $0006 and change it to JMP ($0006) [it seems to be a bug of disassembler]
Use ASM6 to generate "mario.nes" : asm6 mario.asm mario.nes

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/