I've seen that some people made a comprehensive disassembly of some Mario games and possibly others.
I've no experience disassembling NES games, but I know it's possible that the 6502, as any other CPU, interpret any byte as an opcode, so for example, it could interpret some instruction on some address in one way, and then jump back to it but into the second byte (the operand) and interpret that byte as the opcode, so the rest of the program from there until the next jump would be different. There's also interpreting data in ROM as both data and instructions, and executing RAM which changes, so statically disassembling a program that does all that is practically impossible.
But I guess at least most of NES games would only execute PRG-ROM and interpret all the instructions at the same offset always, so in that cases a static disassembly is possible.
I guess an emulator could run such a game, and log a disassembly of each instruction that it executes, looking out for repeated addresses and making sure that when the same address is executed more than once, it's always interpreted as the same instruction.
That way the emulator could make an automatic static disassembly at least of the code that was executed, possibly with some gapes that can be filled in subsequent runs of the game.
Is it done like this? is there any other methods?
I've no experience disassembling NES games, but I know it's possible that the 6502, as any other CPU, interpret any byte as an opcode, so for example, it could interpret some instruction on some address in one way, and then jump back to it but into the second byte (the operand) and interpret that byte as the opcode, so the rest of the program from there until the next jump would be different. There's also interpreting data in ROM as both data and instructions, and executing RAM which changes, so statically disassembling a program that does all that is practically impossible.
But I guess at least most of NES games would only execute PRG-ROM and interpret all the instructions at the same offset always, so in that cases a static disassembly is possible.
I guess an emulator could run such a game, and log a disassembly of each instruction that it executes, looking out for repeated addresses and making sure that when the same address is executed more than once, it's always interpreted as the same instruction.
That way the emulator could make an automatic static disassembly at least of the code that was executed, possibly with some gapes that can be filled in subsequent runs of the game.
Is it done like this? is there any other methods?