Post Reply 
DB48X: HP48-like RPL implementation for DM42
06-24-2024, 07:23 PM (This post was last modified: 06-24-2024 07:24 PM by c3d.)
Post: #218
RE: DB48X: HP48-like RPL implementation for DM42
Hi Franco,


(05-20-2024 05:03 AM)sunpazed Wrote:  Hi Christophe — you might be interested in this little side project of mine. As a proof-of-concept, I built a version of your simulator that runs in the web-broswer (and therefore on mobile devices). I found that Qt runs fairly sluggishly after some time, so that was part of my motivation. It's also quite nice to use db48x in the palm of your hand (as I don't yet have a dm42!).

Here's what it looks like on my iPhone;


Try it in your browser here — the simulator can be run fullscreen by selecting "Add to Home Screen" on iOS or your Android device;
https://sunpazed.github.io/db48x-wasm/bin/index.html

Be warned that there are many bugs, with the simulator hanging when accessing system services (help, save state, system menu) which are not implemented .

And finally here's the repo for review; https://github.com/sunpazed/db48x-wasm — apologies in advance for butchering your excellent code.

Your idea and a lot of your code (notably the index.html and emcc.h files) were integrated in the main repository. I could not merge your code directly because you started with an initial commit that had a different structure. To test it, just use "make wasm", and this should be all you need.

I hope you won't mind if I added you to the list of authors. I tagged the first WASM commit with "Co-authored-by" to give you some credit.

Then, I did another iteration where I used the pthread emulation in emscripten.

The upside is that it fixes most of the issues you reported in your proof of concept, e.g. the system menus not working.

The downside is that it requires the web server to enable HTML COOP and COEP, otherwise the necessary WASM features are disabled by the browser. This is semi-trivial to do, and a simple Python web server doing that is included in that commit, but it't worth keeping in mind.

Another aspect that I'm looking into is that the JavaScript event loop is a bit busy, since it calls window.requestAnimationFrame. You had some code that rate-limited the fetching of the LCD buffer. I replaced that with a mixed use of window.setTimeout to fetch keyboard / LCD status, and only calling window.requestAnimationFrame when the screen actually changed. This improves things a little bit, but I still see my desktop browsers pegged at high CPU (tested with Safari and Brave).

My concern here is that this makes it a "dangerous" solution for mobile phones, where this application is likely to train the battery at high speed. I'm likely to throttle the refresh rate on the JavaScript side in a way similar to what happens on the RPL side, i.e. decrease the polling frequency over time.

In any case, if you have time to review and comment, I'd appreciate it. And obviously, if you want to keep improving this aspect of the work, we can do that on the main DB48X repo (unless of course you have reasons to want to keep your own fork).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
DB48X v0.4.8 is out - c3d - 10-22-2023, 11:31 PM
Release v0.5.0: Statistics and flags - c3d - 11-20-2023, 08:57 AM
v0.6.5: Minor bug fixes - c3d - 02-11-2024, 11:23 PM
Release 0.7.1 "Whip" - Bug fixes - c3d - 03-04-2024, 12:46 AM
DB48X v0.7.4 release is out - c3d - 04-14-2024, 03:05 PM
DB48X v0.7.6: Solving menu - c3d - 05-13-2024, 12:04 AM
RE: DB48X: HP48-like RPL implementation for DM42 - c3d - 06-24-2024 07:23 PM
DB48X v0.7.7: Units in solver - c3d - 06-02-2024, 11:36 PM
v0.7.10 - Interactive stack - c3d - 07-14-2024, 11:31 PM
DB48X v0.7.13 is out - c3d - 08-05-2024, 07:31 AM
DB48X v0.7.15 - c3d - 08-25-2024, 08:45 PM
DB48X v0.7.16 - c3d - 09-02-2024, 01:36 AM
DOSUBS command - grbrum - 09-04-2024, 03:37 PM
v0.7.18 - APPLY, SUBST, WHERE - c3d - 09-15-2024, 11:58 PM
Program Editing Question - spiff72 - 09-16-2024, 03:27 PM
press 2 simultaneous buttons? - grbrum - 09-30-2024, 09:01 PM
CST Custom Menu - grbrum - 10-04-2024, 05:00 AM
v0.8.2: Assignments, Custom menu - c3d - 10-21-2024, 05:49 AM
CST - grbrum - 11-05-2024, 08:07 PM
Stuttgart video - c3d - 11-07-2024, 08:22 PM
Long Name Menus - usability - grbrum - 11-08-2024, 07:47 PM
Release v0.8.5: Keyboard fixes - c3d - 11-12-2024, 01:05 AM
CONVERT bug - grbrum - 11-12-2024, 07:44 PM
Christmas wishlist is open - c3d - 12-02-2024, 07:09 PM
DB48X/50X CATALOG 'behaviour' - n1msr - 12-03-2024, 10:24 AM
DB48x v0.8.8 - Power usage reduction - c3d - 12-08-2024, 11:40 PM



User(s) browsing this thread: 7 Guest(s)