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

Issues with serial port on Win9x hosts #610

Closed
giulioz opened this issue Jan 30, 2022 · 5 comments
Closed

Issues with serial port on Win9x hosts #610

giulioz opened this issue Jan 30, 2022 · 5 comments
Labels

Comments

@giulioz
Copy link
Contributor

giulioz commented Jan 30, 2022

While the JS->Win communication works without any problem, sending things from the guest to the hosts works only on the first call.

If I set an event handler on the JS side with emulator.add_listener("serial0-output-char", console.log); and I try sending multiple data from the windows side (using WriteFile(hComm, data, length, &written, NULL);), only the data of the first WriteFile gets received. I've tried multiple combinations of stop bits, baud rate, timeouts, flow control. In QEMU, instead, it works fine.

This can be further reproduced with the Windows 98 example, using HyperTerminal (http://copy.sh/v86/?profile=windows98):

image

The first letter wrote using HyperTerminal is received in the serial console, while all the other ones are not. Communicating from the host to the guest, though, works perfectly.

Any pointer? Thanks!

@giulioz
Copy link
Contributor Author

giulioz commented Jan 30, 2022

For further info, this is the configuration being used with HyperTerminal:
image

@giulioz
Copy link
Contributor Author

giulioz commented Jan 30, 2022

Even easier way to reproduce: http://copy.sh/v86/?profile=windows31
Program Manager > Accessories > Terminal > COM1 > Write something in the terminal

@giulioz
Copy link
Contributor Author

giulioz commented Jan 30, 2022

Update: apparently, after each data receive the ints property of UART0 is set from 4 to 0.
Setting it to 4 using emulator.v86.cpu.devices.uart0.ThrowInterrupt(2) fixes the problem and enables receiving another chunk. Seems a bit hacky though, I need to do this every time I use a WriteFile from the windows side.

@giulioz
Copy link
Contributor Author

giulioz commented Jan 30, 2022

Update 2: calling ThrowInterrupt manually doesn't always fixes the problem, but commenting this line does:
https://github.com/copy/v86/blob/master/src/uart.js#L174

@copy
Copy link
Owner

copy commented Feb 2, 2022

I can reproduce this issue. Unfortunately, I don't know a proper fix. The code is shared with jor1k: https://github.com/s-macke/jor1k/blob/e07dbe1/js/worker/dev/uart.js#L215

@copy copy added the bug label Feb 2, 2022
@copy copy mentioned this issue Jun 5, 2022
copy added a commit that referenced this issue Jun 19, 2022
@copy copy closed this as completed in ca9aa5e Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants