Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mechanism to communicate from emulated OS to API #993

Open
cognitivegears opened this issue Feb 14, 2024 · 9 comments
Open

Mechanism to communicate from emulated OS to API #993

cognitivegears opened this issue Feb 14, 2024 · 9 comments

Comments

@cognitivegears
Copy link
Contributor

I'm not sure if this is a question or a feature request - if it's a feature and straightforward I'd be happy at giving it a go at coding it too.

I'm trying to find a way for a emulated OS to notify the API of an event or to get information. For example, in DOSEMU you can use the "exitemu.com" to exit the emulator from the emulated OS, and "isemu.com" to return whether it is running in DOSEMU. For v86 I wouldn't want something so specific (since this can run in multiple OSes) but the ability to do something similar, like fire events in the js api or get info, etc.

One way I know of to do this is to use a serial port to send these communications. This works great, but I was wondering if a more "standardized interface" either exists or should exist?

The immediate reason I have for such a mechanism is with running BBS "doors" from node.js, so that after the door program exits (because the user quits the door) it can notify the API so it can clean up and close. For now I'll use the serial mechanism, but a) this uses up one of the serial ports which could be used for a multi-line door game :) and b) I'll have to make up my own comm mechanism for it. No big deal but just wanted to see what you all thought!

@copy
Copy link
Owner

copy commented Feb 15, 2024

virtio would be the "modern" option, we've received support for that recently, but it requires a driver in the guest OS: #949

Using the serial port is a reasonable option too.

I wouldn't be opposed to implementing vmcall, i.e. a specific instruction sequence that gets a callback in the api.

@cognitivegears
Copy link
Contributor Author

virtio would be the "modern" option, we've received support for that recently, but it requires a driver in the guest OS: #949

Using the serial port is a reasonable option too.

I wouldn't be opposed to implementing vmcall, i.e. a specific instruction sequence that gets a callback in the api.

Thanks! Unfortunately I don't think virtio works in my case specifically because I can't find a DOS driver for it; the standard looks pretty straightforward I might be able to write one but hat would definitely be shaving yaks. For now I'll stick with the serial I suppose. I definitely wouldn't be opposed to trying my hand at implementing the vmcall, though I haven't messed with the webassembly side of v86 yet, I would appreciate any pointers you have would be appreciated at where to start looking.

I appreciate the response, and thanks for an amazing project!

@giulioz
Copy link
Contributor

giulioz commented Mar 18, 2024

@cognitivegears
I did something similar to communicate to/from Windows 98, so it should work fine with MS-DOS as well.
It works with I/O ports and sharing memory.
https://github.com/giulioz/react-95-fiber/blob/main/src/emulator95/RpcAdapter.ts

@bit-lang
Copy link

@cognitivegears

I did something similar to communicate to/from Windows 98, so it should work fine with MS-DOS as well.

It works with I/O ports and sharing memory.

https://github.com/giulioz/react-95-fiber/blob/main/src/emulator95/RpcAdapter.ts

I wonder if it is possible to build upon your solution to implement a host-guest shared clipboard.
It would be great if that's a yes.

@giulioz
Copy link
Contributor

giulioz commented Aug 27, 2024

@bit-lang on which guest OS?

@bit-lang
Copy link

@bit-lang on which guest OS?

Windows 9x

@giulioz
Copy link
Contributor

giulioz commented Aug 27, 2024

Ah yes with windows 9x 100%.
If you are ok with a simpler method, I wrote a blog post about it: https://giuliozausa.dev/posts/bm-1-clipboard/

@bit-lang
Copy link

Ah yes with windows 9x 100%.

If you are ok with a simpler method, I wrote a blog post about it: https://giuliozausa.dev/posts/bm-1-clipboard/

Thank you. I will take a look at it

@bit-lang
Copy link

bit-lang commented Sep 2, 2024

Ah yes with windows 9x 100%.

If you are ok with a simpler method, I wrote a blog post about it: https://giuliozausa.dev/posts/bm-1-clipboard/

I found that your solution is very brilliant and implementation is almost complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants