-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Garbage function calls break valid ASM instructions #24
Comments
"Garbage" label creation is fairly widespread ( Sometimes it's intentional, too: jr nz, .notZero
db $3E ; ld a, $AF
.notZero
xor a
ld [wFlag], a ; Write $AF or $00 |
I'm not sure how this could be fixed, beyond adding some sort of data section recognition. There might be some heuristics that could be applied, like loading a register with two different values right after each other, etc. But maybe it would suffice to be even clearer in the README that properly labeling data sections is very important to get a good disassembly? It already suggests doing a trace in an emulator. |
Without perfectly knowing what is code or data this will always an issue, in particular with bank 0. I believe originally mgbdis did not create labels in bank 0 for calls/jumps originating from other banks, however this changed while back. We could go back to that old behaviour by default and add an option to enable labels to be generated in bank 0 from other banks (useful for 32KB ROMs). Another thing that could improve it is to only generate labels in bank 0 from other banks when the call/jump originates in a known code block (from the sym file). |
I have an example of the issue.
Explanation: A garbage function call from a data section of the ROM broke what should have been a 3-byte instruction. Screenshot shows comparison in Ghidra.
The text was updated successfully, but these errors were encountered: