I don't know anything about Python. If it doesn't work, I won't know why.
Works with Python 3 on Windows
This can and WILL erase files, if they are named the same as your .nes file with extension .bin or .chr or .asm -Copy the .nes file in an EMPTY folder before attempting this. REALLY! I MEAN IT!
How to use
Run 6502d in a command prompt or terminal emulator, and type
$ python3 6502d.py <path_to_nes_file>
If the file is a good .NES file, and the filesize matches the header, it should ask you... Default Program Bank size OK? Y/N -if type anything other than 'Y' or 'y' "1 = 8192, 2 = 16384, 4 = 32768:"
It really doesn't make much difference, except that you will generate more .asm files with a smaller Bank size, but they should all assemble the same.
It should generate a .bin file (=the PRG ROM minus the header, not needed for reassembly), a .chr file (if present), and 1 or more .asm file
Assemble with asm6 like this (using the test.nes)
asm6 test.asm test.nes
The very first .nes file I tested...Failed the filesize check. Whoever dumped the ROM, put about 64 bytes at the end of the file, a signature. You would have to open the ROM in a hex editor and delete that part to get it to function...or maybe edit the source code.
Also, if there is a signature in the header (DISKDUDE, etc), my program will not copy it, but remove it. The ROM will run the same, but its hash value will be different (for comparison / security). I also didn't implement any iNES 2.0 stuff...those bytes will be zero.
You may have to edit the .base directives in the main .asm file. Especially if you are editing the source in the file. Do NOT assume that my program has any idea about what address each bank should start with.
You may have to remove spaces from the .nes filename, before disassembling. The file would probably disassemble correctly, but, asm6 will give error messages for filenames with spaces in them.
I didn't use any illegal opcodes. Feel free to edit the source, if you want them in.
Feel free to use this, change the source code, etc. I'd appreciate if you credit me somewhere in the new version. Thanks. Dougeff.