Do you know if there is a limit in the total numbers of "if / else if / else" that can appear in the C code converted into ASM with tcc816?
With my current codebase, I'm regularly getting the following error with tcc816.
Code: Select all
game.asm:23: INPUT_NUMBER: Out of 16bit range.
game.asm:23: ERROR: Couldn't parse "sbc".
Code: Select all
sbc #__init_locals
tcc816 doesn't seem to be able to process code with too many "if / else if / else" instructions.
Indeed, whenever I hit this issue, if I remove regular instructions, it doesn't solve the issue. If I remove some if / else if / if instead, the code gets compiled again. A "else if" has the same "weight" for this limit as a single "if". Likewise, using an OR (condition 1 || condition 2) seems to be counted as "2" instead of "1" for this limit. Of course, this limit is happening even if the code is split in several functions (i.e. even with code spanned over several rom banks): it's the total number of "if" in the code that make tcc816 unable to compile for some reason.
Regarding my current codebase, I have about 2000 lines of C code, organized in several functions, but all the code is written in a single C file (besides the code coming from the PVSNESlib itself, and the ASM files used to store the graphics and audio assets).
Do any of you have encountered this issue before?
If not, maybe you have some ideas of the source of the problem (I remembered reading here that tcc816 isn't able to "shorcut" if conditions or something like that, I don't know if it's related to the issue I'm having).
Thanks again a lot for your help!