11 March 2016 - Forum Rules

Main Menu

BZK 6502 Disassembler

Started by Cyneprepou4uk, December 03, 2020, 01:29:15 PM

Previous topic - Next topic


Let's create a quick disassembly of your game!  :)

This disassembler is a CDL-based Lua script. Mostly targeted on romhackers who just want to have a better view at the game code with little effort. By editing the config file you can properly disassemble any game on any mapper.

Disassembler features:
- Separate code from data using a CDL file
- Display all 6 CDL flags, ROM File and NES Memory address
- Use several table files to display symbols
- Auto adding labels to RAM addresses
- Additional info about each CPU address

Notepad++ scripts features:
- Convert .byte to instructions
- Convert .byte to .word/.dbyt + labels
- Auto adding labels to Branches, Tables and JMP/JSR instructions
- Other manipulations with bytes

Final output files are compatible with ca65 assembler (after deleting "garbage" text using a single regex). Assembles files into a 1:1 copy of the original ROM.



If you wanna try it, read the manual. Let me know if you have any questions.


Oh! That's pretty neat, and seems super useful, nice!


This looks really cool! Can't wait to try it out on a couple games.

Thank you!


Good, you might unlock "the 1st tester" achievement  :cookie:


Quote from: Cyneprepou4uk on December 03, 2020, 01:29:15 PM
Let's create a quick disassembly of your game!  :)

This disassembler is a CDL-based Lua script (CDL is a file created by Code/Data Logger). It's an updated version of my own disassembler which I was using to create a CT2 disassembly, taken into account all my previous experience with 3 (successful) attempts to manually create a disassembly for other games from scratch without any scripts.

It produces assembly files with additional information like CDL flags, ROM File and NES Memory addresses. Also you can use several advanced table files to look for the text bytes. Then you polish your assembly files with my Notepad++ LuaScript plugin scripts.



The disassembler is mostly targeted on romhackers who want to have a better view at the game code with little effort. At the same time output files can easily be made compatible with ca65 assembler, including some other features.

If you wanna try it, read the manual. Let me know if you have any questions.

Hope to see Captain Tsubasa 1 NES translation  :)


I don't like CT1, but I'll be hoping so too, maybe it will help   :D


Version 1.6.0 is available. Since last time I've fixed a couple of bugs and improved some scripts.


How does the disassembler differentiate between code and other data?



Version 1.6.1 is available with a small bugfix (not really important one).

I've recorded an example of disassembling Mappy game using this disassembler.

Fox Cunning

That's one great little utility! I primarily use Mesen, which can also export CDL files. I'll let you know if it works with those too.



February 10, 2021, 12:09:08 PM - (Auto Merged - Double Posts are not allowed before 7 days.)

I assume that both FCEUX and Mesen produce the same cdl format.

However I'm not sure about bit7. At some point FCEUX reserved this bit as "code being executed at $6000-$7FFF" flag. My disassembler marks this case as "D 4" in output files (didn't test it though).

But Mesen might be using bit7 for other purpose.

If that post is correct, and my untested function works, then output files will have a little more useful info when using cdl from Mesen.


A big update is coming soon  :)

You know that Trace Logger tool in FCEUX emulator, right? You know how laggy the emulator gets while using it? You know those enormous output files it produces?

That's all in the past now. I've hacked the emulator to output only the most important data that I need, while doing it as fast as my C++ skills (which are at the beginning level) can afford.

Despite being a noob, I still did a pretty good job. Right now I'm running my Double Dragon 2 walkthrough movie file at turbo speed while tracing, and still get 100+ FPS.

I've also found and hacked a tool called Remove Duplicate Lines, in order to work with all the files in a folder, not manually selecting a file after another. This reduces total 27,7 GB output files from a 45 min movie to 1,7 GB.

When I accumulate all that data and produce a 15,7 MB dump with my script, I get:
- all A, X and Y values, presented at the moment when the instruction was about to be executed
- if it was a JSR, absolute JMP or indirect JMP, I have info about all ROM and RAM addresses they've jumped to, not NES addresses
- all ROM and RAM addresses to which RTS was leading to
- all ROM and RAM addresses, calculated via instructions like LDA (addr),Y and LDA (addr,X)

If you know a thing or two about NES romhacking, and also about making disassemblies, I think you understand the value of this dump. And when I pass it to my disassembler, a true magic will happen  >:D

The whole collecting data thing took me about 80 min in this case.

I think that I probably won't be needed a CDL file for my disassembler anymore. By having info about X and Y values I can determine which bytes were read via absolute indexed instructions, so what else can I ask for? The only thing that I can think of is being able to see DPCM samples with a CDL.

Other not so important things that I wanted to log are the state of status flags register, and also banks id for 8000, A000, C000 and E000 NES addresses. But the emulator started to get a bit laggy, and that info isn't very useful comparing to other, which is sufficient.

If you have any other ideas, I'm all ears.