Oricutron or Euphoric in the browser anyone ?

Comments, problems, suggestions about Oric emulators (Euphoric, Mess, Amoric, etc...) it's the right place to ask. And don't hesitate to give your tips and tricks that help using these emulations in the best possible way on your favorite operating system.
User avatar
jbperin
Flight Lieutenant
Posts: 480
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: Oricutron or Euphoric in the browser anyone ?

Post by jbperin »

Thank you very much.
That's really cool.

I consider you've just invented the easiest and most convenient way of using Oric software on nowaday computers.

Very valuable contribution
User avatar
Hialmar
Flight Lieutenant
Posts: 349
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: Oricutron or Euphoric in the browser anyone ?

Post by Hialmar »

Thanks ;)
Hialmar
CEO and Silicium member.
User avatar
Hialmar
Flight Lieutenant
Posts: 349
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: Oricutron or Euphoric in the browser anyone ?

Post by Hialmar »

You can now save snapshots and ort tapes in the browser storage (IndexedDB).

This was easier than the download option.
I'll work on the download thing during the week-end if I can.
Hialmar
CEO and Silicium member.
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: Oricutron or Euphoric in the browser anyone ?

Post by xahmol »

Nice!
What would be server side requirements of embedding this in your own website? Or would framing in your hosted version be the best option?

(background: my work in progress 8 bit website is an Amazon Web Services hosted static website hosted from a S3 bucket via an AWS Cloudfront distribution, deployed via AWS Amplify from a source based on Gatsby/React. Needing a 24/7 online EC2 instance just for embedding this emulator is not a very attractive option from a cost and maintainance perspective. If it would be possible to run this with AWS Lambda and AWS Dynamo DB serverless components that would be ideal)
User avatar
Hialmar
Flight Lieutenant
Posts: 349
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: Oricutron or Euphoric in the browser anyone ?

Post by Hialmar »

I'm unsure about this. I have absolutely no experience with AWS.

Basically you just need some webspace anywhere and if you are lazy (like me) PHP installed.

If you don't have PHP installed then you'll have to update the index_nophp.html webpage by hand.
There are two JavaScript static arrays there that you need to populate with the names of the files.

The dir.php file does that automatically. It should be easy to port it to NodeJS if this is more available on AWS.

Anyway, I have now added the button that will let you download your files on your computer so that you resume playing on your own machine after downloading a real emulator.
Hialmar
CEO and Silicium member.
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: Oricutron or Euphoric in the browser anyone ?

Post by xahmol »

Well, if I Google around Emcripten should work on AWS Lambda using NodeJS indeed. But really have to delve in the how sometime then.
Alternative would be using an AWS Lightsail instance that I use for another website (Lightsail provides a full virtual server including PHP and Wordpress in my case) but wanted to avoid cross domain issues. Or seeing if I can run it via Docker in AWS Fargate (on demand Docker compute).
But if Lambda/Dynamo DB would suffice that would be so much more cost effective as AWS serverless components are very cost efficient if traffic is very low (like what I suspect for my humble website). Presently my website runs for less than three dollars a month while still offering blazing fast speeds as it is locally cached via Cloudfront CDN globally. For a few months still even for free as it fully falls under the first year free tier. Also maintenance for the server is zero as AWS does all the patching for you.
(But will stop hijacking this threat now. Reason I really want to do it in AWS also is because I want to hobby in AWS also for professional reasons and to keep knowledge up to date also for my AWS certification).
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: Oricutron or Euphoric in the browser anyone ?

Post by iss »

@Hialmar: Great work! I have the good feeling we are very close to the for-a-long-time-expected Oricutron's version 1.3 ;).
Personally I have few small improvements to commit (which will not change anything globally) but I wish to run all sources trough a code formatter and make them in shape as Xeron choose to be and keep them persistent in good outlook - IMO this is important for all Oric/Oricutron users.

Related to your work: do you have any idea about JS-toolkit for a kind of future web-GUI? Or we leave it just as 'widged' (with some API).
User avatar
Hialmar
Flight Lieutenant
Posts: 349
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: Oricutron or Euphoric in the browser anyone ?

Post by Hialmar »

A web GUI would be good indeed. I'll think about it.
Hialmar
CEO and Silicium member.
User avatar
jbperin
Flight Lieutenant
Posts: 480
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: Oricutron or Euphoric in the browser anyone ?

Post by jbperin »

Hi,

I've installed the OricutronJS on a mini site on my RPI at home and I'm getting ready to serve my own TAP file from home thank to this marvel !!

I want to reiterate my deepest congrats and my warmest thanks for this great tool. It's so so so so coooooOOOooollll


I have one question about the caching of the TAP file.

I put a .tap file in the web server directory and added its name in the list in the javascript (because i don't use php) of the index_nophp.html
But I realise that the first time the web browser read the .tap file is also the last time.

It's like if, once the .tap file is in the readwritefs of the browser storage, it will not be updated when the version on the server changes.

Unless the domain name changes or the name of the tap file changes.
Is there a way to force reloading of the tap file rather than always using the same version saved in the browser once for ever ?
User avatar
jbperin
Flight Lieutenant
Posts: 480
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: Oricutron or Euphoric in the browser anyone ?

Post by jbperin »

jbperin wrote: Thu Mar 04, 2021 12:19 pm Is there a way to force reloading of the tap file rather than always using the same version saved in the browser once for ever ?
This lil hack in oricutron.html does the job :

Code: Select all

<script>
    Module.preRun.push(function () {
        ENV.FILE = sessionStorage.file+"?"+Math.floor(Math.random() * Math.floor(1973))
    });
</script>
Adding "?<aRandomNumber>" to the url of file bypass the cache mecanism of oricutron.js.
And the part following the "?" is just ignored by my nginx.

Then the page always reloads the last up-to-date .tap file.
jumpjack
1st Star Corporal
Posts: 10
Joined: Tue Nov 08, 2022 9:42 am

Re: Oricutron or Euphoric in the browser anyone ?

Post by jumpjack »

Is this project still under development?
Can this source code be used to implement loading of dsk files from user PC in modern browsers?

https://github.com/jumpjack/ReadWriteJS
OulanB
2nd Star Corporal
Posts: 17
Joined: Wed Jan 08, 2014 9:49 am

Re: Oricutron or Euphoric in the browser anyone ?

Post by OulanB »

For a JS Oric emulator you can try https://github.com/OulanB/OricJS. You can install in Chrome as Extension, developper mode, unpacked app ... click on screen to get the tape interface

Keymap is for a french apple keyboard (can be changed in io.js). Very small base code, only tapes are emulated
jumpjack
1st Star Corporal
Posts: 10
Joined: Tue Nov 08, 2022 9:42 am

Re: Oricutron or Euphoric in the browser anyone ?

Post by jumpjack »

I forked only the www folder of www branch into my repository:

https://github.com/jumpjack/oricutronJS

But I don't get how the disk filename is passed to oricutronJS upon clicking a link to oricutron.html. I see that PHP is actually not mandatory at all, but I can't go further. I know how to load a binary file from local hard disk or from remote server, but then how do I pass it to oricutron engine?
User avatar
Hialmar
Flight Lieutenant
Posts: 349
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: Oricutron or Euphoric in the browser anyone ?

Post by Hialmar »

Hi there.

We'd better talk here.

I'll copy paste our conversation so far.

About the filename passed to OricutronJS:
In the index.html I copy the filename in the sessionstorage:
https://github.com/pete-gordon/oricutro ... x.html#L24

Then in oricutron.html I get the file name from the sessionstorage and copy it to the emulator's environment:
https://github.com/pete-gordon/oricutro ... .html#L191

Lastly, in the emulator code I retrieve the filename from the environment:
https://github.com/pete-gordon/oricutro ... in.c#L1826
About files that can't be downloaded from remote websites:

jumpjack:
Replacing "fetch->url" in these lines:

oricutron/main.c

Line 1793 in 075c517

sprintf(path, "/readwritefs/%s", fetch->url),
oricutron/main.c

Line 1804 in 075c517

success(path, fetch->url);

by just the filename if the string contains a remote url, would allow loading any remote file into the emulator.
For example, the download of https://jumpjack.github.io/oricutronJS/space1999-en.dsk succeeds, but of course creation of emulator file

/readwritefs/https://jumpjack.github.io/oricutronJS/space1999-en.dsk
fails (but error is shown only in browser console, not in emulator console, where only the same messages of a valid download appear: "MFM DISK" and "STATUS 200").

Probably an alternative mode to use remote files in the emulator would be retrieving them from the web page and storing them into /readwritefs/ session storage key.... but I have no idea of how to do it. :-)

As a side note, probably this couple of lines ( https://github.com/pete-gordon/oricutro ... in.c#L1830 ) should be moved before the "downloading file" message.
Me:
Good idea. I'll try to do this ASAP. I need to merge changes from the main branch as well.
jumpjack:
In the meantime I found a method to load local files from user's PC:

https://jumpjack.github.io/oricutronJS/

I see there are two DBs, "/readwritefs" and "emscripten_filesystem", but the second one is apparently never used by the emulator, so I just ignore it.
Me:
It doesn't work on Chrome on a Mac. What browser did you test it on ?
Hialmar
CEO and Silicium member.
User avatar
Hialmar
Flight Lieutenant
Posts: 349
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: Oricutron or Euphoric in the browser anyone ?

Post by Hialmar »

Here is what I get in the JS console:

Code: Select all

sessionStorage.file= undefined
oricutron.html:172 Unable to open 'assets/roms/bd500.rom'
printErr @ oricutron.html:172
oricutron.html:172 
printErr @ oricutron.html:172
oricutron.html:172 Unable to open 'assets/roms/8dos2.rom'
printErr @ oricutron.html:172
oricutron.html:172 
printErr @ oricutron.html:172
Oricutron.js:1453 [Deprecation] The ScriptProcessorNode is deprecated. Use AudioWorkletNode instead. (https://bit.ly/audio-worklet)
63532 @ Oricutron.js:1453
4oricutron.html:172 ubsan: shift-out-of-bounds
printErr @ oricutron.html:172
oricutron.html:172 Assertion failed: undefined
printErr @ oricutron.html:172
Oricutron.js:964 Uncaught RuntimeError: abort(Assertion failed: undefined). Build with -s ASSERTIONS=1 for more info.
    at abort (Oricutron.js:963:10)
    at assert (Oricutron.js:641:3)
    at Oricutron.js:1209:4
    at doCallback (Oricutron.js:2896:11)
    at done (Oricutron.js:2903:13)
    at Oricutron.js:2261:21
    at Oricutron.js:2367:12
    at req.onsuccess (Oricutron.js:2300:4)
Hialmar
CEO and Silicium member.
Post Reply