jverkoey/windfish

Type inference: data infered as code

kemenaran opened this issue · 8 comments

In the link_awakening_gb project you provided, after running the game on the intro and file menus (whose code instructions are mostly stored in bank 01), the disassembler labels 01:5731 as being code - but it looks like data.

Would that be a type-inference issue, or a leftover from a previous analysis using a previous version of windfish?

Ah hm I can't reproduce this behavior; can you run md5 against the rom you're using? It should be c4360f89e2b09a21307fe864258ecab7 for the Link's Awakening project's rom.

#62 to track md5 verification.

$ md5sum Links_Awakening.gb
c4360f89e2b09a21307fe864258ecab7  Links_Awakening.gb

Looks like it's the same. But if you can't reproduce, it may means the Links_Awakening_gb.windfish you provided a while ago has already this error, or something like this.

Ahh strange strange; can you upload your .windfish project? I'm curious if perhaps there's something in the config that has led Windfish to disassemble that block incorrectly.

For reference, this is what I see in bank $01 for the latest version of the Link's Awakening Windfish project at HEAD around $5731:

Screen Shot 2021-02-14 at 5 26 48 PM

Here it is. When opening the project, the section at 01:5731 is correctly infered as data - but as soon as the rom starts (and the intro plays for a while), the section is infered as code.

Links_Awakening_gb.windfish.zip

Ahh I think I found the issue. At some point I changed the name of the method for changing the current bank during the linearSweepDidStep from registerBankChange to changeBank because there's a slight difference in behavior between the two functions.

I discovered this because the scripts were throwing registerBankChange is not defined errors during disassembly, but because logs are only showing in a console window there's no way to have known that from the WindfishIDE. I generally need to do a better job of surfacing errors when they occur...

So the fix is simple: in scripts/call_changebank.js change the registerBankChange at line 17 to changeBank; all should work as expected after that.

That fixed it indeed. Thanks :)