It's stable now. And worked on 6 of 7 files that I tested. (Haven't had time to look into why the 1 didn't work. It seems to do great on smaller files). Definitely not 'finished'. Feel free, any of you, to make changes to this file, as you see fit. It works with Python 3, on Windows. May work on other platforms, IDK. Reassembles with asm6.

Known issues. For some reason, I made it absolutely require that the filesize match what the iNES header claims. In my tests, I have been having to edit the file in a hex editor, to remove signatures appended to the end of the ROM.

EDIT - another issue, is filenames with spaces in them, asm6 was confused when I typed the name in...like each word of the name was a separate argument. Just remove spaces from the original name before disassembling.

Other uses of this file. 1.It tells you (in the command line dialog) lots about the file. How many banks. What mapper. Mirroring. Etc. Some emulators do this too. No big deal.

2.It splits the PRG-ROM and CHR-ROM and saves them (minus the header) as 2 binary files. This might be useful to people planning to burn actual hardware ROMs.

Again, feel free, to fix or improve this file. I know nothing about Python. Also, read the usage for lots of ominous warnings about how it can delete / erase files if you are not careful.

EDIT - you will have to edit line 34 of the python script (path to file) to make this work. See usage for more info.

EDIT2 - This is a no brainer disassembler...you (maybe) will have to literally do nothing to the output file to get it to reassemble correctly with asm6.

EDIT3 - Only for whole .NES files. Won't work for anything else. Maybe I'll edit it later to be more general.

_________________nesdoug.com -- blog/tutorial on programming for the NES

Last edited by dougeff on Thu May 10, 2018 7:38 pm, edited 2 times in total.

By the way. The only thing that part of the code is doing, is comparing the first 4 bytes of the ROM to $4E $45 $53 $1A. As "usage" says. I don't know Python. I don't know why it doesn't work. It works for me.

EDIT - actually, I left the debugging test there, just uncomment (remove the # from) line 886 that says...

print (workArray[i], " ", testarray[i])

I get... (printed in the command line box)...78 7869 6983 8326 26

What do you get?

_________________nesdoug.com -- blog/tutorial on programming for the NES

If you want to mark a Python program as 3-only, test for the specific behaviors you're expecting

Why would you need to test for behaviours that Python 3 guarantees in a program that's only supposed to run on Python 3?

Also, to know what to test requires an encyclopedic knowledge of the differences between Python 2 and 3.

The hashbang line is very useful, though, because it can be used to automatically select Python 3 on systems with both 2 and 3 installed. I'd recommend that, combined with thefox's assert, which will give a helpful error in the case that Python 2 is used by mistake.

The first one, Valid.py, is just a gutted version of the disassembler. And I added a little bit. It checks if valid header, and calculates the expected filesize, and warns you if it's different. (it doesn't do any disassembly)

You will have to (just like 6502d.py) edit line 29 with an actual path to the file. On windows, you can Shiftt+Right Click and choose 'copy as path' on the .NES file. Paste it on line 29 after the r like...

path = r"C:\Users\Doug\Desktop\PowerPak\py_backup\test.nes"

Neither one creates a new file, so they are safer to use than the 6502d disassembler.

_________________nesdoug.com -- blog/tutorial on programming for the NES

The added benefit of GitHub is the fact that you can add some collaborators. I see some ways the output can be improved, like identifying the NMI and jump points, and labeling the PPU registers.

There seems to be plenty of NES-related code on GitHub already, so I doubt it would get taken down for copyright reasons. But in the event that it does, you could always move it to a less popular platform like GitLab.

Who is online

Users browsing this forum: No registered users and 7 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum