Skip to content

[WebAssembly] Better browser support#100

Merged
mist64 merged 1 commit into
commanderx16:masterfrom
sebastianvog:webkit
Sep 22, 2019
Merged

[WebAssembly] Better browser support#100
mist64 merged 1 commit into
commanderx16:masterfrom
sebastianvog:webkit

Conversation

@sebastianvog

Copy link
Copy Markdown
Contributor

Webkit, Safari, Chrome on Android and Opera supported now.
Removed threading as it is not supported currently on browsers other than Chrome Desktop.
Changed Main emulator loop to yield control back to the browser after a complete frame.
Setting emscripten main loop fps parameter to 0, as this is highly recommended in emscripten documentation.
Lastly, reworked imports for *sdcard_file, due to a compile error using the llvm webassembly backend.

Comment thread sdcard.c Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone could take a look at the sdcard_file declarations/imports ... To be honest, I am slightly unsure about the importing (I really should refresh my C knowledge). Reason I am doing it that i got "asm-ld: error: duplicate symbol: sdcard_file" error when compiling with latest WebAssembly llvm.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your patch is correct. externed variables should go in the headers.

Comment thread Makefile Outdated
@madebr

madebr commented Sep 21, 2019

Copy link
Copy Markdown
Contributor

I have tested this on firefox using cmake and emscripten 1.38.29 (I used conan package manager).
My build has a big lag and audio is not working.

@sebastianvog

Copy link
Copy Markdown
Contributor Author

I have tested this on firefox using cmake and emscripten 1.38.29 (I used conan package manager).
My build has a big lag and audio is not working.

thank you for testing this.
Are you talking about compile time or execution speed in the browser? The browser is unfortunately lacking quite behind in speed. I started looking into optimizations but so far could only find a few percentage % improvements by using the emscripten llvm backend. I think i would have to profile to get a better understanding where the time is spent.
I have not looked at audio yet, I can check if that would be something easy to address. or could be limitation by emscripten/sdl implementation, not sure.

Webkit, Safari, Chrome on Android and Opera supported now.
Removed threading as it is not supported currently on browsers other than Chrome Desktop.
Changed Main emulator loop to yield control back to the browser after a complete frame.
Setting emscripten main loop fps parameter to 0, as this is highly recommended in emscripten documentation.
Lastly, reworked imports for *sdcard_file, due to a compile error using the llvm webassembly backend.
@madebr

madebr commented Sep 21, 2019

Copy link
Copy Markdown
Contributor

I was talking about input lag.
Sometimes it works fine, sometimes it lags severely.

@madebr

madebr commented Sep 21, 2019

Copy link
Copy Markdown
Contributor

I don't know how, but the emulator at http://www.frank-buss.de/x16/x16emu.html has working copy/paste on firefox.

@sebastianvog

Copy link
Copy Markdown
Contributor Author

http://www.frank-buss.de/x16/x16emu.html

@Frank-Buss modified getClipboard() function to read the text from the textarea and pass it to the emulator. the original code reads from navigator.clipboard.readText() and that call unfortunately doesn't work on Firefox.

@Frank-Buss

Copy link
Copy Markdown
Contributor

I think an additional textarea would be nice. Not only as a workaround for the clipboard functionality, but if the focus works properly, someone could even develop longer BASIC programs in the textarea and when done, can copy it elsewhere to save it. I guess currently there is no other way to get something out of the emulator, and it is lost when the browser is closed?

@Tmp2k

Tmp2k commented Sep 22, 2019

Copy link
Copy Markdown
Contributor

I'm working on a simple BASIC web IDE at the moment, the concept being the page is split 50/50 with a basic editor on the left and the emulator on the right. Rather than just pasting in text, you can use the editor and hit "Run". You could add on the ability to save to local disk, or whatever you like using JS.

If people would find this useful I can add the basics into this repo, rather than starting my own?

My plan is to include some compilers in the long run, allowing you to code in C, ASM or BASIC and have it run instantly on-page using the emulator. (if anyone wants to help with this, I'm just trying to get to grips with the emscr virtual file system)

@mist64 mist64 merged commit 27616c7 into commanderx16:master Sep 22, 2019
@mist64

mist64 commented Sep 22, 2019

Copy link
Copy Markdown
Collaborator

Excellent, thanks!

@Tmp2k

Tmp2k commented Sep 22, 2019

Copy link
Copy Markdown
Contributor

BTW, I've fixed the focus / keypress issue and added an extra textinput for entering basic. I've also got it to auto detect the key map from the browser locale. Plus a few other tweaks. I started with the code from this pull request as it already fixed a lot of issues. I'll submit a new pull request this evening.

@sebastianvog

Copy link
Copy Markdown
Contributor Author

That’s excellent! I couldn’t figure out the keyboard/ focus issue and detectIng the keyboard Layout is great !

fvdhoef pushed a commit that referenced this pull request Apr 17, 2020
Webkit, Safari, Chrome on Android and Opera supported now.
Removed threading as it is not supported currently on browsers other than Chrome Desktop.
Changed Main emulator loop to yield control back to the browser after a complete frame.
Setting emscripten main loop fps parameter to 0, as this is highly recommended in emscripten documentation.
Lastly, reworked imports for *sdcard_file, due to a compile error using the llvm webassembly backend.
jestin pushed a commit to jestin/x16-emulator that referenced this pull request May 15, 2023
* [CI/CD] Build README.pdf

* CI fixes

* CI fixes

* CI enhancements

* no need to build the ROM anymore

* fix paths

* include x16-docs PDFs

* some additional doc fixes

* add dependency tree for workflows

* CI fix

* Reorganize CI dependency tree

* Reorganize CI dependency tree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants