Odd quirk with BBCSDL WASM build
I'm trying to get this program to load - https://wasm.bbcbasic.co.uk/bbcsdl.html?app=http://www.matrixnetwork.co.uk/NoteQuiz/NoteQuiz.bbc - but it's failing with "Number too big". After RENUMBERing the loader, it's line 880 that is failing loading L% with the first 4 bytes of the program - 12 0A 00 EE - yet at the immediate mode prompt I'm dropped into, if I try to do L%=&EE000A12 it works but doing L%=&12 + &0A*&100 + &EE * &1000000 it fails with "Number too big".
Now it's quite possible my program is somehow corrupt however it loads fine in BBCSDL for Linux and the BB4C console version - and indeed I used BB4C to convert it from plain-text to this file with tokenised BASIC.
Now it's quite possible my program is somehow corrupt however it loads fine in BBCSDL for Linux and the BB4C console version - and indeed I used BB4C to convert it from plain-text to this file with tokenised BASIC.
0
Comments
-
L%=&12 + &0A * &100 + &EE * &1000000
fails with "Number too big".L=&12 + &0A * &100 + &EE * &1000000 PRINT L
That prints 3.99297999E9 and the largest number which can be stored in a signed 32-bit integer is 2.14748365E9.
So this isn't the reason for your code running in BBCSDL and the Console Mode editions but not in a browser. That is indeed concerning, and if you can create some minimal code which reproduces it I will investigate.
0 -
It is repeatable - visit the link above, when it fails with "Number too big" the program currently visible is your downloader - so if you RENUMBER then RUN it again, it fails with "Number too big at line 880".
Line 880 has it reading the file in 4 bytes at a time, and populating L% with it. That's part of your loader code, not my program.
This also fails https://wasm.bbcbasic.co.uk/bbcsdl.html?app=http://www.matrixnetwork.co.uk/NoteQuiz/test.bbc
The entire code of this is:>NEW >10 ON ERROR H%=FALSE: GOTO 40 >20 H%=TRUE >40 MODE 7 >SAVE"test"
0 -
Richard_Russell wrote: »Indeed it should - the number is too big to fit in a signed 32-bit signed integer!
0 -
Yep, as I would expect. However that really doesn't explain why I get that same error in exactly the same place, doing the same thing, with that test.bbc program which is doing nothing with numbers. My suspicion is it's choking on the token of ON ERROR.0
-
That's part of your loader code, not my program.
I could avoid the error, even in the case of a corrupted file, by replacing the + with OR:L% = BGET#F% OR BGET#F% * &100 OR BGET#F% * &10000 OR BGET#F% * &1000000
but all that would do is result in another error occurring downstream.
If you have a corrupted .bbb file which provokes the 'Number too big' error please send it to me.
0 -
How do I make a .bbb file? It ran quite happily with an earlier .bbc file where ON ERROR wasn't the first line of the program, though that sounds like it worked due to dumb luck than actually getting it right!
Edit: Found it, under Utilities -> Compile in SDLIDE.0 -
It ran quite happily with an earlier .bbc file where ON ERROR wasn't the first line of the program
I wonder why you used ?app= rather than ?chain= in the first place. The supported URL parameters are documented here.0 -
I didn't know about ?chain= - and that works for the .bbc file straight off. That makes my life a WHOLE lot easier - thank you! My google-fu totally failed me, I had never found that page. I found another example of a program being loaded somewhere and just blindly copied the approach (and missed the fact it was .bbb)0
-
My google-fu totally failed me, I had never found that page.
1