WasmPascal v1.1.4: The WEB Unit Expands

20-09-2026



The uses WEB unit got some attention and better examples. String and number handling bugs got fixed. There's also a bunch of small bug fixes in error and warning messages and I have been busy writing a lot more tests for features to try and prevent drift as this project is getting really complicated really fast.

The new compiler and examples are live at wasmpascal — the version badge in the toolbar should read v1.1.4.


1. The WEB unit Expands

Until now, working directly with the DOM was a bit cumbersome. I realised that there were some opportunities to improve things, so the WEB unit got some much-needed updates.

program paint;
uses WEB;
begin
  { ... no hand-rolled bridge anymore ... }
end.
            

I updated pascalsweep, paint, musicbox and colors to use the uses WEB unit. Paint and MusicBox were still hand-rolling bridges, which is just a lot of work.

There is also a new debug message: putting uses WEB next to another ABI's entry point is now a compile error. Before, it produced a blank page and no explanation at all which was really irritating.


2. Strings bugs addressed

Strings had a 255-byte concatenation cap because I had trouble getting memory allocation working properly. I finally figured this out and I believe you can now have proper strings in the code with concatenation. I've updated some of the examples along the way, but that's an ongoing effort.

Val got two updates: It now zeroes its target when the string fails to parse (previously the old value survived, which made debugging a pain), and Val into a Single parses through a scratch value so the conversion is precise. Previously this was pretty lose...


3. Numbers bugs fixed

Three fixes landed for Numbers:

First, writeln(x:8:2), compiled with exit code 0 and then failed to start, because the compiler emitted a console_float import that didn't exist yet. readln(name) on a string had the same issue with (console_read_str). This has been addressed.

Second, passing a Single to Sin, Cos and such emitted an invalid module: the argument went over as f32 while the import expects f64. I've fixed this, hopefully, in all places.

Lastly, Str on reals was rather crappy and I have rewritten it. It should be more reliable and accurate now.


Try it out

Everything is live at https://wasmpascal.com/. Try writeln(pi:0:4) in the console example, check out the uses WEB unit, or feed Val a string that is not a number and watch the target come back zeroed. Then pick an example — Flight Leader, Pascaloids, Xonix, Minesweeper, Pong — hit Run, and have some fun with Pascal in your browser.

The examples and tutorials live in the wasmpascal_examples repository, and earlier writing about the project is on the blog:



Return to the blog index