- The in-browser edition is relatively slow compared with the others; after all the BBC BASIC program is being interpreted to Web Assembly code, which is in turn having to be interpreted (or JITted) to native machine code. Reading data from a file seems to be particularly slow. Don't use *DISPLAY multiple times to plot images, load them into memory once and use *MDISPLAY.
- The total amount of memory available (i.e. the maximum value to which one can raise HIMEM) is about 16 megabytes compared with the 256 megabytes typically available in the desktop and mobile editions (although that depends on the degree of memory fragmentation).
- To keep the size of the initial download manageable (it must of course be loaded every time a program is run, so this is important) I only bundle the DejaVuSans and DejaVuSansMono fonts in the library directory. If you want to use a different font (e.g. FreeSans) you will need to supply it alongside your program.
- The range of API functions available to be called using SYS is very limited: there are only about 80 in all compared with more than 650 in the other editions! If an API function that you want to call is missing let me know, I may be able to add it. If you use SYS "SDL_SetWindowTitle" you must add @memhdc% as the last parameter, otherwise it will crash.
- Similarly the range of OpenGL/GLES functions available is also very limited (about 50), and their addresses must be obtained by calling SYS "SDL_GL_GetProcAddress" (or use the FN_gpa function in webgllib.bbc).
Deploying programs in a browser
Deploying programs in a browser
There isn't a section of the forum dedicated to the in-browser (Emscripten / Web Assembly) edition of BBCSDL [admin: How about creating one?] so I'm posting here instead. The compatibility of the in-browser edition with the others is very good, indeed considerably better than I initially expected. Many programs can be expected to run without any modification but there are a few things to bear in mind:
Re: Deploying programs in a browser
Hi Richard,
I can take a hint! Forum created and topic moved. Let me know if the name doesn't suit...
D
I can take a hint! Forum created and topic moved. Let me know if the name doesn't suit...
D
Re: Deploying programs in a browser
Cross-posted from The Distillery forum
This information can be found elsewhere, including in the main BBCSDL documentation, but for the record this is the easiest way of deploying a BBC BASIC program for running in a browser:
This information can be found elsewhere, including in the main BBCSDL documentation, but for the record this is the easiest way of deploying a BBC BASIC program for running in a browser:
- Having written your BBC BASIC program, first test that it runs correctly in a browser. To do that open the Compile dialogue in SDLIDE (click on the 'cogs' button in the toolbar, or select 'Utilities... Compile' from the menus).
- In the Compile dialogue that is displayed, select the 'Deploy as a web application' checkbox and click the Test button. That will run your program in your default browser; if it runs OK you are good to go, otherwise you will need to fix any problems identified.
- Once your program is running in your own browser as you want it to, click on the Create Application button (again, with the 'Deploy as a web application' checkbox selected). This will create a 'web bundle' file, with a .bbb extension, in the location specified in the 'App bundle' field.
- Upload that .bbb file to your website (or to Dropbox) and publish the following URL for people to be able to run it:
substituting URL_of_web_bundle_file with the URL of where you have uploaded your .bbb file.
Code: Select all
https://wasm.bbcbasic.co.uk/bbcsdl.html?app=URL_of_web_bundle_file