joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.55k stars 373 forks source link

Mouse Cursor Position Not Updating with Mouse Movement #4801

Open alexanderdillard opened 5 months ago

alexanderdillard commented 5 months ago

Describe the bug

In regard to running the ASIC editor (https://en.wikipedia.org/wiki/ASIC_programming_language) within DOSBox-X's integrated DOS emulation, there appears to potentially be an issue with mouse support. When the ASIC editor is first started (with the "asic" command) the mouse cursor follows physical mouse movements as expected. However, after using the ASIC editor's "Run your program" option to run a compiled ASIC program, upon returning to the ASIC editor after the program completes the mouse cursor is no longer following physical mouse movements. If the mouse's left button is pressed or a key on the keyboard is pressed the mouse cursor position will perform an instantaneous update but does not resume continuously updating.

On the ASIC Wikipedia page (https://en.wikipedia.org/wiki/ASIC_programming_language) under External Links there is a link to a page which hosts a download of ASIC which you can use to replicate this issue.

Steps to reproduce the behaviour

  1. Download and install ASIC*
  2. Start the ASIC editor with the "asic" command
  3. On the ASIC editor screen, write a simple ASIC program (typing the command "beep", without the quotes, will suffice for this step)
  4. Save the ASIC program using File>Save (this is required for ASIC to compile the program)
  5. Compile the ASIC program using Compile > Compile program
  6. Run the ASIC program using Run > Run your program
  7. Upon returning to the ASIC editor after the program completes you should find that the mouse cursor position is no longer following the movements of your physical mouse.

*Note that on the ASIC Wikipedia page (https://en.wikipedia.org/wiki/ASIC_programming_language) under External Links there is a link to a page which hosts a download of ASIC which you can use to replicate this issue.

Expected behavior

After running a program from within the ASIC editor, the mouse cursor position on the screen should continue to update as the physical mouse is moved, not only when pressing the left mouse button or when pressing a key on the keyboard.

What operating system(s) this bug have occurred on?

Windows 7 64-bit

What version(s) of DOSBox-X have this bug?

2023.10.06

Used configuration

I'm using the default configuration.

Output log

No response

Additional information

I've tried using every build of the latest release of DOSBox-X and also various adjustments to the configuration file, mainly to the int33 options, but I haven't yet found a way to resolve this issue by adjusting settings. I have found three environments which demonstrate what I believe is the correct behavior: 1. MS-DOS 5.0 from within DOSBox-X 2. Plain vanilla DOSBox (0.74-3), 3. MS-DOS 5.0 on native hardware.

Have you checked that no similar bug report(s) exist?

Code of Conduct & Contributing Guidelines

joncampbell123 commented 5 months ago

That would suggest IRQ 12 (the PS/2 mouse interrupt) is getting masked somewhere between running the second program and returning from it.

alexanderdillard commented 4 months ago

I tried pulling out the PIC1 and PIC2 values by creating an executable containing the "in al, 21h" and "in al, A1h" instructions and using the ASIC editor's run function to start the executable. This process found the following PIC values:

Native DOSBox-X PIC1 11111000b PIC2 00101100b

MS-DOS 5.0 inside of DOSBox-X PIC1 11111000b PIC2 00101100b

So, as best I can tell, neither IRQ 2 or IRQ 12 are masked initially in either native DOSBox-X or MS-DOS 5.0 inside of DOSBox-X. In native DOSBox-X, as previously described, after running the executable and returning to the ASIC editor the mouse position is not updating. However, restarting the executable from the editor yields exactly the same PIC1 and PIC2 values as before, IRQs 2 and 12 are still not masked.

In an attempt to validate my process and results I tried toggling IRQ 12 (while running MS-DOS 5.0 inside of DOSBox-X) to see if the mouse functionality in the ASIC editor would start and stop as expected, just to make sure I really am looking at PIC2 and not something else. This was accomplished via "mov ax, 0000000000101100b"; "out A1h, al" and "mov ax, 0000000000111100b"; "out A1h, al". The mouse functionality stops and starts as expected in MS-DOS 5.0 inside of DOSBox-X. In native DOSBox-X toggling IRQ 12 has no observable effect, the mouse works initially and then does not work after the first run whether IRQ 12 is masked or not. I decided to also try this in the native DOS in vanilla DOSBox, in that environment the mouse continues to work, run after run, whether IRQ 12 is masked or not.

alexanderdillard commented 4 months ago

This might be related to issue #4796 "interrupt masking not working (port 21h)".