Hi, thanks for your replies.
I must confess I'm a total noob regarding ASM
(although I start to get a few glimpse of it after using it to declare resources in PVSNESLib, or when I had issues with SNESmod).
Is BSNES debugger available in compiled form (windows) somewhere?
In the meantime, I tried to do this manipulation with NoSNS:
I've made several different builds (crashing, non-crashing, etc.), and when the game was crashed (or rather "stuck"), I looked at the lines in the NoSNS debugger. By using "animate", I noticed that two cursor is jumping between two lines when the game is stuck:
crashing code (but sound glitch):
Code:
0001:FAAB EC 40 21 cmp x,[2140]
0001:FAAE D0 FB jnz FAA7
(I have no clue about what those line are doing - is it some kind of "while (x == 2140){ }")If I remove some code elsewhere, I can have a non-crashing build, but with sound glitch. The same code as above is present, but in different lines:
Code:
0001:FAA7 EC 40 21 cmp x,[2140]
0001:FAAA D0 FB jnz FAA7
And, last but not least, whenever I remove the last function I programmed entirely, it reverses the game to a "no crash / no glitch" state. The two lines above aren't present (using "Search" I can't find them, and they are not located around the 0001:FAAA space - I've searched them manually)
So could it be a simpler case of badly produced code in the last function I wrote, which will make the game crash / glitch only if there as at least XXX lines of codes in the total program?
It seems very strange to me, because if I keep this last function, but I remove another one, the games run great (no glitch no crash). So it's the addition of my previous code + the new one that doesn't please the compiler. At least it would match the "broken toolchain" theory (both Shiru and you seem to agree on this point).
If that's the case, what would be the best way to fix it?
Do I simply try to rewrite my function in a different way so the compiled code is different?
Or are there known workaround / guideline to try to avoid such compiler quirks?
Thanks again a lot for your help!