|
Forum Index : Microcontroller and PC projects : Portable MMBasic
| Author | Message | ||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
Even with Claude and Codex it's been a good amount of work. I do a good amount of planning, and then sometimes find that the LLM hasn't done what I asked. They are almost uniquely suited to just moving code around and splitting up files, but their own native ideas of the 'right' way to do it isn't always the best, and sometimes they get lazy and don't what was planned. So it's taken about two months to get here. Likely would have taken a year or more on my own. I will also say that using an LLM encourages you to do things that you probably should not do, and to move too fast. In a complex interrelated code base like this, not a good idea. I will take a look at MMB4L repo and see how you've approached things. As v6 of mmbasic is already amazingly competent, I think even if I mostly stopped taking new features this fork would still be incredibly useful. But I do want to track any big new features as they come along. |
||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
It works for me in Chrome and Firefox on MacOS, I can't really try native firefox on windows 11 - I might have to borrow one of my kid's laptop. 'NEW' is now fixed, there was a bug in how the WASM build emulates flash. |
||||
| Plasmamac Guru Joined: 31/01/2019 Location: GermanyPosts: 619 |
Still on chemo but i like the idea and concept so i chime in here . A bytecodecompiler is a great idea. Like and cant wait ! Plasma |
||||
| Plasmamac Guru Joined: 31/01/2019 Location: GermanyPosts: 619 |
Works on safari with iphone 16e ![]() Edited 2026-05-16 12:59 by Plasmamac Plasma |
||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
The bytecode compiler is in the WASM demo, just use 'FRUN' instead of RUN. Try it with 'mand.bas'. With a slowdown (click the gear) of about 10us, it should approximate device speeds. FRUN will be 10x faster than RUN. It really only works for math heavy loops, for most other things mmbasic has a native C implementation of the slow stuff. Heck, it even recently got a mandelbrot function (not used in this demo). And then there's the issue that creating bytecode native VM syscalls for every single basic statement just was not a realistic target, it would have meant basically re-implementing the entire mmbasic function surface area. So the bytecode compiler 'thunks' down to the interpreter for most functions, which means it has to dummy up the interpreter globals and any other variables in scope, and cart around tokenized versions of the code, call the interpreter function, and then re-sync the results with the vm. So that slows things down a bit and tends to cancel out any speedup. But where it can really shine is in tight math loops. It will try to auto optimize and run them in a special zero dispatch kernel with a slimmed down instruction set focused on math. And in fact the compiler allows you to hand write such loops with the same slimmed down instruction set in 'assembly'. See 'mand_asm.bas' in the demo, though that version has some issues that make it not as fast as the auto optimized mand.bas. |
||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
So it does, that's surprising. How do you type? I think I need to provide some sort of keyboard mechanism for mobile. |
||||
| thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4369 |
I've taken a brief look this morning and parked the code better: https://github.com/thwill1000/mmb4l/commits/develop-v0.8-7/ My highest priority when normality resumes is to get a v0.8 released and burn all these working branches. Tom Edited 2026-05-16 20:33 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1453 |
It's looking pretty good already ![]() I've had a bit of a go :-) The keyboard is a bit slow to respond and the keystrokes aren't being recognised yet. Edited 2026-05-17 02:52 by Martin H. 'no comment |
||||
| LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 578 |
It would be great if this refactoring of the interpreter architecture could be merged into the main version. This can help to avoid the nightmare of bringing the new releases changes to this version. |
||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
Looks great! Do you have the source available? They keyboard being a bit slow I think is my overaggressive matching of the slower key repeat on the PicoCalc - I should perhaps make that adjustable. What do you mean by the keystrokes not being recognized? Could be a need to create some onscreen helpers for device keycodes. |
||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
I am ok with it being a slightly different thing that perhaps doesn't perfectly track the upstream. If for example, this is the only way to get an esp32 port, I am not sure people will care that it doesn't have all the latest and greatest. One of the issues is that the upstream isn't really following a git workflow that easily allows PRs and merges, as files are added via bulk upload by Peter Mather. Again, no shade, I don't want to step on toes or break a workflow that works for him. But I've also radically restructured things in a way that just doesn't easily allow for sharing, even if the upstream had a more traditional approach to git. If it had it might be easier to merge or cherrypick a change to a file that hadn't changed much in either of our repos, but I've changed most everything, for better or for worse. There was perhaps an approach where I tried to minimize code base disruption while maximizing portability, I did not take that path :) |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1453 |
Of course. The source code can be found here You can also find an overview of Picomite Games with relevant links here Cheers Martin Edited 2026-05-17 03:17 by Martin H. 'no comment |
||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
Found it, I've got a patched version that works better, mind if I include it (with attribution in the source) in the webasm demo? This version also exposed some holes in the bytecode compiler. MMBasic really is an amazing language with a very liberal syntax. |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1453 |
Feel free to adapt the code to suit your needs and publish it alongside the demos. One thing I noticed was that your Basic doesn't recognise the “Mode” command, so you basically have to switch the screen "externally" to 320x240 for it to run properly (as it does on the Pico). Cheers, Martin 'no comment |
||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
Feel free to adapt the code to suit your needs and publish it alongside the demos. One thing I noticed was that your Basic doesn't recognise the “Mode” command, so you basically have to switch the screen "externally" to 320x240 for it to run properly (as it does on the Pico). Cheers, Martin Thanks, I'll put it in there. Thanks for reminding me on MODE, it's more that webasm port doesn't have the mode command compiled in. My VGA/HMDI version does - but there's no reason I shouldn't compile it in and have it switch the web resolutions. Edited 2026-05-17 05:38 by jvanderberg |
||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
Feel free to adapt the code to suit your needs and publish it alongside the demos. One thing I noticed was that your Basic doesn't recognise the “Mode” command, so you basically have to switch the screen "externally" to 320x240 for it to run properly (as it does on the Pico). Cheers, Martin Ok, I've updated the emulator to support 'mode' - you can edit which mode is associated with which resolution in the config. There's also a key repeat setting now, so your original, unmodified version of Picovaders should run well if you edit the settings in the wasm emulator. But I made a slightly updated version to handle the typical key repeat speed and fix some key handling issue, it's include in the demo - you might need to click the 'refresh' button to reload the files. There's also a Picovaders_fastgfx.bas - which used a lightweight framebuffer to provide faster graphics without flicker. Fastgfx is a bit like FRAMEBUFFER, but with a much simpler api. You can also attempt to run the original Picovaders in the byte code compiler with the lightning icon. It does run quite a bit faster. Your game found like 5 bugs in the bytecode compiler, so thank you. |
||||
| toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 632 |
Do you have the code on a git repo where we can contribute for? Sorry, it's kind of linked by the demo, but yes, the repo is https://github.com/jvanderberg/PicoMiteAllVersions I will likely change the name, as it's not really PicoMite any longer, just the pico port is 'PicoMite'. It's a bit of a mess with some half finished plans and audits, but it should be in reasonably good shape, the Pico builds are usable on real hardware. I can't seem to compile for linux. I get a lot of output then this: /usr/bin/ld: /home/tom/Downloads/PicoMiteAllVersions-jvanderberg/ports/host_native/build/FileIO.o:/home/tom/Downloads/PicoMiteAllVersions-jvanderberg/FileIO.c:270: multiple definition of `FileTable'; /home/tom/Downloads/PicoMiteAllVersions-jvanderberg/ports/host_native/build/host_runtime.o:/home/tom/Downloads/PicoMiteAllVersions-jvanderberg/ports/host_native/host_runtime.c:95: first defined here collect2: error: ld returned 1 exit status make[1]: *** [/home/tom/Downloads/PicoMiteAllVersions-jvanderberg/ports/host_native/Makefile:113: /home/tom/Downloads/PicoMiteAllVersions-jvanderberg/host/mmbasic_test] Error 1 make[1]: Leaving directory '/home/tom/Downloads/PicoMiteAllVersions-jvanderberg/host' make: *** [Makefile:16: all] Error 2 |
||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
I can't seem to compile for linux. I get a lot of output then this: /usr/bin/ld: /home/tom/Downloads/PicoMiteAllVersions-jvanderberg/ports/host_native/build/FileIO.o:/home/tom/Downloads/PicoMiteAllVersions-jvanderberg/FileIO.c:270: multiple definition of `FileTable'; /home/tom/Downloads/PicoMiteAllVersions-jvanderberg/ports/host_native/build/host_runtime.o:/home/tom/Downloads/PicoMiteAllVersions-jvanderberg/ports/host_native/host_runtime.c:95: first defined here collect2: error: ld returned 1 exit status make[1]: *** [/home/tom/Downloads/PicoMiteAllVersions-jvanderberg/ports/host_native/Makefile:113: /home/tom/Downloads/PicoMiteAllVersions-jvanderberg/host/mmbasic_test] Error 1 make[1]: Leaving directory '/home/tom/Downloads/PicoMiteAllVersions-jvanderberg/host' make: *** [Makefile:16: all] Error 2 I've updated it to compile and build on Linux, this was needed to support linux tests and build artifacts anyway, so it was good to get done. If you want to run it on Linux, there are three ways: - the WASM build with a local server, which will launch a python server that runs a website to host the WASM build. - the mmbasic-ansi build, which is kind of wild. You'll need to run it in a browser zoomed way out, as it uses half block rendering for pixels. It runs in full graphics mode, just using text for pixels. So if you want 320x320, you'll need a 320x160 terminal. - then finally there's the 'stdio' version, which is really just for testing. It just runs a program and outputs text to stdout - no graphics. |
||||
| Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 1098 |
@jvanderberg Your HTML version is very cool! Is there a way to use it offline as well? That would be great! Frank |
||||
| jvanderberg Newbie Joined: 06/05/2026 Location: United StatesPosts: 34 |
Your HTML version is very cool! Is there a way to use it offline as well? That would be great! Frank https://jvanderberg.github.io/PicoMiteAllVersions/ Will install as a PWA - the help instructions walk you through it for all major browser versions. It will work offline, and get a desktop icon. I could build binaries for various platforms, but for a simulator, it's just easier to target web. I imagine I could create an Electron app if there's some demand, but that's yet another build to support, and there are a lot of builds in here, all wanting to break at the drop of a hat :) Edited 2026-05-19 00:04 by jvanderberg |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |