spark2k06 wrote: ↑Mon Sep 12, 2022 9:31 am
Mouse support over the COM2 port, based on the great work Antonio has done with the PS/2 to Serial wrapper he has developed:
https://github.com/MiSTer-devel/PCXT_Mi ... com2-mouse
For now, I am using a 1.844262 MHz clock via PLL for clk_uart for both ports, so that it is compatible with the 1200 baudrate required by the serial port. So, the disk image must be set to 115.2Kbps for it to be recognised.
The serial port is working correctly, the problem here seems to be the handling of the PS/2 signal coming from the MiSTer mouse emulator:
mouse_com2.jpg
Although mouse events are detected and generated, the results are not correct because it performs random movements and records mouse button presses when they are not actually taking place.
@kitune-san, maybe you could give us a clue on this, I would appreciate it... I am stuck on these points.kitune-san wrote:
Mouse Support Over the COM2 Port in PCXT Core
- spark2k06
- Core Developer
- Posts: 876
- Joined: Sat Jun 06, 2020 9:05 am
- Has thanked: 409 times
- Been thanked: 969 times
Mouse Support Over the COM2 Port in PCXT Core
I am moving the question of the Mouse support to a new thread:
Re: Mouse Support Over the COM2 Port in PCXT Core
I've been testing for the direct DeMiSTify ports the latests improvements done by Antonio (@thesonders) with the PS/2 to Serial wrapper.
What I've reached so far is that the mouse is recognized well as Microsoft mouse mode and I could test the mouse in Norton Commander, Monkey Island and Arkanoid games, but after a few seconds (sometimes minutes) the mouse stops working.
When I do the tests with Norton Commander I can see that if I don't access any folder the mouse keeps working, but when Serdrive at COM1 starts working it hangs the mouse most of the time.
We are very close to get the mouse working in direct ports (not using MiSTer framework and it's HPS) but there seems to be maybe a synchronism problem or interference with COM1 port. I cannot explain exactly what is going on.
The wrapper's output is at exactly 1200 bps.
COM2 was added here at https://github.com/somhi/PCXT_DeMiSTify ... pherals.sv by the previous work done by @spark2k06.
We need some help by @kitune-san on these to check what is going on with the COM Ports. After we get it working here I thing it will be easier to port to MiSTer.
What I've reached so far is that the mouse is recognized well as Microsoft mouse mode and I could test the mouse in Norton Commander, Monkey Island and Arkanoid games, but after a few seconds (sometimes minutes) the mouse stops working.
When I do the tests with Norton Commander I can see that if I don't access any folder the mouse keeps working, but when Serdrive at COM1 starts working it hangs the mouse most of the time.
We are very close to get the mouse working in direct ports (not using MiSTer framework and it's HPS) but there seems to be maybe a synchronism problem or interference with COM1 port. I cannot explain exactly what is going on.
The wrapper's output is at exactly 1200 bps.
COM2 was added here at https://github.com/somhi/PCXT_DeMiSTify ... pherals.sv by the previous work done by @spark2k06.
We need some help by @kitune-san on these to check what is going on with the COM Ports. After we get it working here I thing it will be easier to port to MiSTer.
https://github.com/somhi/PCXT_DeMiSTify Non-MiSTer ports
https://github.com/sockitfpga/PCXT_SoCkit SoCkit FPGA (MiSTer) port
https://github.com/sockitfpga/PCXT_SoCkit SoCkit FPGA (MiSTer) port
- Caldor
- Top Contributor
- Posts: 930
- Joined: Sat Jul 25, 2020 11:20 am
- Has thanked: 112 times
- Been thanked: 111 times
Re: Mouse Support Over the COM2 Port in PCXT Core
Ahh, that sounds like some good progress Once mouse is working I plan on making some more videos of this core. I have been testing several games and found a collection I want to show off that uses CGA and Tandy graphics, but I have a few games that I want to show in those that actually refuse to load if no mouse is detected. Most games do support just moving a cursor around with the arrow keys or something like that, but The Adventures of Robin Hood f.ex. refuses to load without a mouse. But its an action adventure game and without a mouse you would not be able to react fast enough and such. I think there were one or two other games as well, but I do not remember any other specific names right now.
- spark2k06
- Core Developer
- Posts: 876
- Joined: Sat Jun 06, 2020 9:05 am
- Has thanked: 409 times
- Been thanked: 969 times
Re: Mouse Support Over the COM2 Port in PCXT Core
Fortunately, there are mouse emulators based on keystrokes such as cursors:Caldor wrote: ↑Tue Oct 04, 2022 8:07 am Ahh, that sounds like some good progress Once mouse is working I plan on making some more videos of this core. I have been testing several games and found a collection I want to show off that uses CGA and Tandy graphics, but I have a few games that I want to show in those that actually refuse to load if no mouse is detected. Most games do support just moving a cursor around with the arrow keys or something like that, but The Adventures of Robin Hood f.ex. refuses to load without a mouse. But its an action adventure game and without a mouse you would not be able to react fast enough and such. I think there were one or two other games as well, but I do not remember any other specific names right now.
https://ftp.sunet.se/mirror/archive/ftp ... dos/mouse/
http://www.lanet.lv/simtel.net/msdos/mouse.html
Don't let that stop you from making the video
Re: Mouse Support Over the COM2 Port in PCXT Core
@kitune-san, some notes of the mouse testing done today by @thesonders:
Well, I'll explain what I do and you can discuss it with whoever you want:
-ctmouse /s2
- Correctly detected with a Microsoft mode
- Open Norton (NC)
- The mouse works correctly
- When I open the Windows directory (it takes a few seconds), the mouse stops responding
- I leave Norton
-ctmouse /u
-ctmouse /s2
- Mouse is not detected well (is detected as mouse systems mode)
- While doing so, the wrapper continues to transmit and function well (output signal redirected to a signal analyser)
- "Flushing" the COM port with command > copy COM2 empty.txt
- CTRL+PAUSE
- Reinstall ctmouse and it works correctly again
My CONCLUSION: when COM1 is accessed (or COM2 get stuck) the UART buffer fills up and ctmouse do not receive data from COM2.
Once COM2 is emptied or flushed, everything works again.
Well, I'll explain what I do and you can discuss it with whoever you want:
-ctmouse /s2
- Correctly detected with a Microsoft mode
- Open Norton (NC)
- The mouse works correctly
- When I open the Windows directory (it takes a few seconds), the mouse stops responding
- I leave Norton
-ctmouse /u
-ctmouse /s2
- Mouse is not detected well (is detected as mouse systems mode)
- While doing so, the wrapper continues to transmit and function well (output signal redirected to a signal analyser)
- "Flushing" the COM port with command > copy COM2 empty.txt
- CTRL+PAUSE
- Reinstall ctmouse and it works correctly again
My CONCLUSION: when COM1 is accessed (or COM2 get stuck) the UART buffer fills up and ctmouse do not receive data from COM2.
Once COM2 is emptied or flushed, everything works again.
https://github.com/somhi/PCXT_DeMiSTify Non-MiSTer ports
https://github.com/sockitfpga/PCXT_SoCkit SoCkit FPGA (MiSTer) port
https://github.com/sockitfpga/PCXT_SoCkit SoCkit FPGA (MiSTer) port
-
- Top Contributor
- Posts: 401
- Joined: Wed May 18, 2022 11:20 am
- Has thanked: 127 times
- Been thanked: 412 times
Re: Mouse Support Over the COM2 Port in PCXT Core
Sorry. I have not been able to act on this matter yet.
As I recall, the mouse is a device that generates many interrupts.
It might easily hang up when other interrupt processes are busy.
As I recall, the mouse is a device that generates many interrupts.
It might easily hang up when other interrupt processes are busy.
-
- Top Contributor
- Posts: 401
- Joined: Wed May 18, 2022 11:20 am
- Has thanked: 127 times
- Been thanked: 412 times
Re: Mouse Support Over the COM2 Port in PCXT Core
memorandum
- Check that hardware flow control is enabled.
- when unable to accept reception, PS2 CLK signal is set Low.
- Check that hardware flow control is enabled.
- when unable to accept reception, PS2 CLK signal is set Low.
-
- Top Contributor
- Posts: 552
- Joined: Sun May 24, 2020 8:07 pm
- Has thanked: 185 times
- Been thanked: 310 times
- Contact:
Re: Mouse Support Over the COM2 Port in PCXT Core
This topic sparked a memory for me with the PCJr and the keyboard issues when running at a higher baud rate when connecting to a BBS, it would cause issues if you had lots of data coming in and pressed a keyboard key at the same time. Could this be happening due to the XTIDE COM data + the mouse data coming in similar to the notes below? Not sure what you all can do with this but maybe it could give you some insights.
From Using a modem section of the FAQ here: https://www.brutman.com/PCjr/pcjr_tips.html
_________________________________________________________________________________________
[Using a Modem]
My PCjr spent a lot of time connected to other machines, via a modem. For many years it was used to dial BBS systems and trade DOS utility programs. When I went to college, it was used to connect to the Unix hosts there.
The best modem to use is an external modem. The internal modem that IBM offered only transferred data at 300bps, and it had a strange command set that was not Hayes compatible. Any old (9600 bps or less) external modem using the Hayes command set is a good choice.
Note: According to the technical reference guide for the PCjr, it is not recommended to drive a modem faster than 1200bps. The PCjr is just too slow. Here is the technical explanation (paraphrased):
The PCjr uses the Non-Maskable Interrupt of the 8088 processor to handle the keyboard, which is a departure from other PCs of the era. Non-Maskable means that the interrupt can't be ignored. At 2400bps data is coming in fast, but the PCjr is fast enough to read it. However, if you press a key on the keyboard, the PCjr will drop what it is doing and decode the key. Keyboard decoding time is too long, which can cause data to be missed at the serial port.
The 8250 UART chip can be programmed to do 4800 baud. The machine is certainly fast enough. You just can't type while it is happening.
Another problem for the PCjr is the lack of a DMA controller. If you are receiving data at any speed from the serial port and the diskette drive is activated, you will lose data from the serial port. The processor will spend all of it's time servicing the disk drive, causing the serial port bits to "drop on the floor."
I used my PCjr for years at 2400bps with few problems. Here is why it worked for me, and how you can make it work for you:
Use a PCjr with expanded memory, and run your program from that memory. Memory accesses above the 128KB mark are faster because the PCjr's video hardware does not intefere. See "The Memory Subsystem" for details. If you do this, you should drop less bytes because the machine has more time to monitor the serial port. Keystrokes may still cause you pain.
Add a NEC V20 to your PCjr to speed the processor up. The extra 5 or 10% performance improvement might allow keyboard decoding to happen and finish between bytes coming in on the serial port.
Don't type while data is coming in.
Don't use the diskette drive while data is coming in. If you need to download, download files to a ram disk and transfer the files to floppy after the download has completed.
Super Hackers only: The 8250 can be replaced with the 16550 rather easily. The 16550 is capable of buffering up to 16 bytes. With some software to drive it, you can cut the interrupt overhead a lot by processing more than one character at a time.
Faster modems may work with the PCjr, although your risk of data loss increases. You are better off if you just limit the interface speed to 2400bps, even if you have a faster modem.
You will need the serial port adapter to do this. You will also need software, such as Qmodem, Procomm, PC Talk, or any old DOS based program. And finally, you may need the COMSWAP utility to correct the COM port weirdness discussed in the hardware section.
See "The Serial Ports" for a discussion on the PCjr serial port hardware.
From Using a modem section of the FAQ here: https://www.brutman.com/PCjr/pcjr_tips.html
_________________________________________________________________________________________
[Using a Modem]
My PCjr spent a lot of time connected to other machines, via a modem. For many years it was used to dial BBS systems and trade DOS utility programs. When I went to college, it was used to connect to the Unix hosts there.
The best modem to use is an external modem. The internal modem that IBM offered only transferred data at 300bps, and it had a strange command set that was not Hayes compatible. Any old (9600 bps or less) external modem using the Hayes command set is a good choice.
Note: According to the technical reference guide for the PCjr, it is not recommended to drive a modem faster than 1200bps. The PCjr is just too slow. Here is the technical explanation (paraphrased):
The PCjr uses the Non-Maskable Interrupt of the 8088 processor to handle the keyboard, which is a departure from other PCs of the era. Non-Maskable means that the interrupt can't be ignored. At 2400bps data is coming in fast, but the PCjr is fast enough to read it. However, if you press a key on the keyboard, the PCjr will drop what it is doing and decode the key. Keyboard decoding time is too long, which can cause data to be missed at the serial port.
The 8250 UART chip can be programmed to do 4800 baud. The machine is certainly fast enough. You just can't type while it is happening.
Another problem for the PCjr is the lack of a DMA controller. If you are receiving data at any speed from the serial port and the diskette drive is activated, you will lose data from the serial port. The processor will spend all of it's time servicing the disk drive, causing the serial port bits to "drop on the floor."
I used my PCjr for years at 2400bps with few problems. Here is why it worked for me, and how you can make it work for you:
Use a PCjr with expanded memory, and run your program from that memory. Memory accesses above the 128KB mark are faster because the PCjr's video hardware does not intefere. See "The Memory Subsystem" for details. If you do this, you should drop less bytes because the machine has more time to monitor the serial port. Keystrokes may still cause you pain.
Add a NEC V20 to your PCjr to speed the processor up. The extra 5 or 10% performance improvement might allow keyboard decoding to happen and finish between bytes coming in on the serial port.
Don't type while data is coming in.
Don't use the diskette drive while data is coming in. If you need to download, download files to a ram disk and transfer the files to floppy after the download has completed.
Super Hackers only: The 8250 can be replaced with the 16550 rather easily. The 16550 is capable of buffering up to 16 bytes. With some software to drive it, you can cut the interrupt overhead a lot by processing more than one character at a time.
Faster modems may work with the PCjr, although your risk of data loss increases. You are better off if you just limit the interface speed to 2400bps, even if you have a faster modem.
You will need the serial port adapter to do this. You will also need software, such as Qmodem, Procomm, PC Talk, or any old DOS based program. And finally, you may need the COMSWAP utility to correct the COM port weirdness discussed in the hardware section.
See "The Serial Ports" for a discussion on the PCjr serial port hardware.
- Caldor
- Top Contributor
- Posts: 930
- Joined: Sat Jul 25, 2020 11:20 am
- Has thanked: 112 times
- Been thanked: 111 times
Re: Mouse Support Over the COM2 Port in PCXT Core
So... a simple solution might be to boot from a floppy and mouse should work? That is, boot from a floppy and not have any HDD at all, to avoid the HDD from disrupting the mouse?
Amazing how many of the things that seems to be bugs and problems are really just the core acting the way its supposed to
Amazing how many of the things that seems to be bugs and problems are really just the core acting the way its supposed to
Re: Mouse Support Over the COM2 Port in PCXT Core
Yes, but if the mouse doesn't move, uart2's buffer shouldn't be filled, so it shouldn't generate interrupts.kitune-san wrote: ↑Wed Oct 05, 2022 12:25 am Sorry. I have not been able to act on this matter yet.
As I recall, the mouse is a device that generates many interrupts.
It might easily hang up when other interrupt processes are busy.
When the ps2 mouse doesn't move, the wrapper doesn't even output the serial start bit. There is no transmission.
I have RTS/CTS enabled on COM1 for serdrive.kitune-san wrote: ↑Wed Oct 05, 2022 12:25 am memorandum
- Check that hardware flow control is enabled.
- when unable to accept reception, PS2 CLK signal is set Low.
https://github.com/somhi/PCXT_DeMiSTify Non-MiSTer ports
https://github.com/sockitfpga/PCXT_SoCkit SoCkit FPGA (MiSTer) port
https://github.com/sockitfpga/PCXT_SoCkit SoCkit FPGA (MiSTer) port
-
- Top Contributor
- Posts: 401
- Joined: Wed May 18, 2022 11:20 am
- Has thanked: 127 times
- Been thanked: 412 times
Re: Mouse Support Over the COM2 Port in PCXT Core
Could you confirm that the irq signal on the uart goes low each time one byte of data is read?
Or could you check if the irq signal goes low when the mouse hangs up?
I remember that pcxt bios was set to accept interrupts on the rising edge.
If irq does not go low until fifo is empty, then there may be a problem with uart interrupt.
Or could you check if the irq signal goes low when the mouse hangs up?
I remember that pcxt bios was set to accept interrupts on the rising edge.
If irq does not go low until fifo is empty, then there may be a problem with uart interrupt.
Re: Mouse Support Over the COM2 Port in PCXT Core
Thanks kitune-san, we will check it.
One thing to notice is that I was able to check a direct PS2 mouse attached to external pins of the Sockit fpga with the same Core and MiSTer framework as De10-nano with only FDD (no using Serdrive at all) and I could see the mouse cursor moving in Norton Commander but it hanged after a few seconds of moving the mouse.
One thing to notice is that I was able to check a direct PS2 mouse attached to external pins of the Sockit fpga with the same Core and MiSTer framework as De10-nano with only FDD (no using Serdrive at all) and I could see the mouse cursor moving in Norton Commander but it hanged after a few seconds of moving the mouse.
https://github.com/somhi/PCXT_DeMiSTify Non-MiSTer ports
https://github.com/sockitfpga/PCXT_SoCkit SoCkit FPGA (MiSTer) port
https://github.com/sockitfpga/PCXT_SoCkit SoCkit FPGA (MiSTer) port
-
- Top Contributor
- Posts: 401
- Joined: Wed May 18, 2022 11:20 am
- Has thanked: 127 times
- Been thanked: 412 times
Re: Mouse Support Over the COM2 Port in PCXT Core
Now I am reading the wrapper code....somhi wrote: ↑Sat Oct 08, 2022 9:06 am Thanks kitune-san, we will check it.
One thing to notice is that I was able to check a direct PS2 mouse attached to external pins of the Sockit fpga with the same Core and MiSTer framework as De10-nano with only FDD (no using Serdrive at all) and I could see the mouse cursor moving in Norton Commander but it hanged after a few seconds of moving the mouse.
The PS/2 data and the ByteSync signal may not be synchronized.
- spark2k06
- Core Developer
- Posts: 876
- Joined: Sat Jun 06, 2020 9:05 am
- Has thanked: 409 times
- Been thanked: 969 times
Re: Mouse Support Over the COM2 Port in PCXT Core
I have updated the exp-com2-mouse branch with the latest release, which has FDD support and also has the new UART 16750:kitune-san wrote: ↑Sun Oct 09, 2022 12:47 pm
Now I am reading the wrapper code....
The PS/2 data and the ByteSync signal may not be synchronized.
https://github.com/MiSTer-devel/PCXT_Mi ... com2-mouse
On the other hand, you will notice that I have made a small change suggested by Antonio, author of the MouseWrapper:
https://github.com/MiSTer-devel/PCXT_Mi ... 8721226a80
Despite these changes, the stream version needed for MiSTer still doesn't work, it doesn't respond to PS/2 events, however, as you can see, it has recognised the 4Dh byte corresponding to the Microsoft mode mouse protocol, so that's where we are.
I have passed your query on to Antonio, and what he tells me is as follows:
In the stream version, in the screenshot you have sent, line 275 is the one in charge of synchronisation
-
- Top Contributor
- Posts: 401
- Joined: Wed May 18, 2022 11:20 am
- Has thanked: 127 times
- Been thanked: 412 times
Re: Mouse Support Over the COM2 Port in PCXT Core
- Attachments
-
- PCXT.zip
- (1.34 MiB) Downloaded 257 times
- spark2k06
- Core Developer
- Posts: 876
- Joined: Sat Jun 06, 2020 9:05 am
- Has thanked: 409 times
- Been thanked: 969 times
Re: Mouse Support Over the COM2 Port in PCXT Core
It is too sensitive, but it works!kitune-san wrote: ↑Mon Oct 10, 2022 8:46 am Could you try this?
https://github.com/kitune-san/PCXT_MiST ... ture-mouse
The mouse must move very very slowly, but apart from that, it is very stable
Re: Mouse Support Over the COM2 Port in PCXT Core
Thanks!.kitune-san wrote: ↑Mon Oct 10, 2022 8:46 am Could you try this?
https://github.com/kitune-san/PCXT_MiST ... ture-mouse
Y axis looks ok, X axis has issues, cursor gets stuck at the borders.
- spark2k06
- Core Developer
- Posts: 876
- Joined: Sat Jun 06, 2020 9:05 am
- Has thanked: 409 times
- Been thanked: 969 times
Re: Mouse Support Over the COM2 Port in PCXT Core
I with both axes... the Y immediately overflows too if you move a bit too fast when it should reach each end and that should be its limit.Mills wrote: ↑Mon Oct 10, 2022 11:21 amThanks!.kitune-san wrote: ↑Mon Oct 10, 2022 8:46 am Could you try this?
https://github.com/kitune-san/PCXT_MiST ... ture-mouse
Y axis looks ok, X axis has issues, cursor gets stuck at the borders.
-
- Top Contributor
- Posts: 401
- Joined: Wed May 18, 2022 11:20 am
- Has thanked: 127 times
- Been thanked: 412 times
- spark2k06
- Core Developer
- Posts: 876
- Joined: Sat Jun 06, 2020 9:05 am
- Has thanked: 409 times
- Been thanked: 969 times
Re: Mouse Support Over the COM2 Port in PCXT Core
That was the reason, thank you very much!kitune-san wrote: ↑Mon Oct 10, 2022 1:11 pm Maybe following modifications are needed
2022-10-10 223225.png
I attach it here, but it will be available in the next release.
- Attachments
-
- PCXT_mouse-feature.zip
- (1.33 MiB) Downloaded 258 times
- spark2k06
- Core Developer
- Posts: 876
- Joined: Sat Jun 06, 2020 9:05 am
- Has thanked: 409 times
- Been thanked: 969 times
Re: Mouse Support Over the COM2 Port in PCXT Core
@kitune-san, I'll pull request myself on the prerelease branch with your changes.
Thanks for everything!
Thanks for everything!
Re: Mouse Support Over the COM2 Port in PCXT Core
Great! Now all that's left is a Hercules garphic module transplant? The "ski or die" game is not running normally yet, and I hope this will be resolved too. Thank you.
Re: Mouse Support Over the COM2 Port in PCXT Core
have you tried as tandy or cga modes?
- spark2k06
- Core Developer
- Posts: 876
- Joined: Sat Jun 06, 2020 9:05 am
- Has thanked: 409 times
- Been thanked: 969 times
Re: Mouse Support Over the COM2 Port in PCXT Core
The problem is that there is no Hercules module, someone has to make it from scratch.
Regarding the ski or die game, there must be some versions that crash more than others, and it also happens in PCem, as far as I have been able to check. It's a matter of finding the right version of the game,
Re: Mouse Support Over the COM2 Port in PCXT Core
I know it. I think the hercules mode is not very interested in Westerners, I know that hercules graphic adaptor was developed to express the language of Asians. I just want someone to develop it, but it's a pity that it's not possible. And "ski or die" ran all versions with "google search" but I failed to work, other XT machine versions with pcem I remember this game was running on it.spark2k06 wrote: ↑Tue Oct 11, 2022 9:31 amThe problem is that there is no Hercules module, someone has to make it from scratch.
Regarding the ski or die game, there must be some versions that crash more than others, and it also happens in PCem, as far as I have been able to check. It's a matter of finding the right version of the game,
- spark2k06
- Core Developer
- Posts: 876
- Joined: Sat Jun 06, 2020 9:05 am
- Has thanked: 409 times
- Been thanked: 969 times
Re: Mouse Support Over the COM2 Port in PCXT Core
It would be more interesting to have a real 8-bit IDE to avoid serdrive and we are still in the situation we are in. It's not that it's impossible, it's that the developer who does it has to have a lot of interest in it and that it's really worthwhile compared to other projects.suww37 wrote: ↑Tue Oct 11, 2022 9:44 am I know it. I think the hercules mode is not very interested in Westerners, I know that hercules graphic adaptor was developed to express the language of Asians. I just want someone to develop it, but it's a pity that it's not possible. And "ski or die" ran all versions with "google search" but I failed to work, other XT machine versions with pcem I remember this game was running on it.
Regarding ski or die, don't you remember.... then check it out, and if it works but not here in the core, give us the link and maybe we can find out why