uli / dragonbasic

Dragon BASIC compiler for Game Boy Advance
Other
42 stars 7 forks source link

What do MF errors regarding "assert(abs(off) < 2048);" really mean? #23

Open supercom32 opened 6 years ago

supercom32 commented 6 years ago

When working with a large method that has many calls to other methods (with large strings as their parameters - Ie. game dialog text), I noted that at some point I got the following error:

mf: MF.cpp:918: void Output::reloc10(unsigned int, unsigned int): Assertion `abs(off) < 2048' failed.

Regardless of where in the Sub I placed my new lines, it threw that error. When I broke my Sub down into smaller Subs, then it all worked just fine. Is this because I somehow ran out of memory (stack?) for this Sub and I need to break it up? I assume so, since I can't think of any other reason. (^_^);

EDIT: I guess what I really should be doing is declaring dialog as "#Constants" instead so that everything gets stored into ROM instead?

supercom32 commented 6 years ago

Ok, a quick update! I was able to do a test, where all my dialog was declared as Constants instead of being passed "in-line". This still resulted in the same error as above so I assume Subs do have some kind of size limit.

If I get some spare time, I'll try and see if I can get a more simple test case to produce this.