2022-04-13 22:46:39 I think I figured out how to fix the Javascript implementation of RetroForth! 2022-04-13 22:47:05 The problem with the last implementation that I looked at was that it had a long running `while` loop to run through Nga opcodes. 2022-04-13 22:47:55 That means that the JS environment can't service event function calls, so you can't move the mouse or click anything on the page while RetroForth is executing (in newer FF versions, it would actually kill the script) 2022-04-13 22:48:08 I tried to fix this by doing a refactor but I was never successfuly. 2022-04-13 22:48:17 *successful 2022-04-13 22:48:54 I just realized it would be pretty easy to do via the new-ish "generator" function. Very little modification of the existing codebase would be required. Going to try it out now. 2022-04-13 22:53:45 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function* 2022-04-13 23:19:42 It works! 2022-04-13 23:20:33 crc I will try to post this to Github soon. It is _very_ slow, but it is nice because you can execute the script and still have control of the browser (does not hang, UI stays responsive, minimal changes) 2022-04-13 23:22:33 I just ran a benchmark, it tooks 1733 milliseconds to run the "99 bottles of beer" example from retroforth.org 2022-04-13 23:23:09 Which is not great, but the important thing is that the UI stayed responsive, which is important for something like a "RetroForth Playground", which might be possible now. 2022-04-13 23:26:12 (18 ms / token, looks like) 2022-04-13 23:32:13 https://github.com/RickCarlino/retro-ts 2022-04-13 23:32:41 needs a lot of cleanup, but it works now