@@ -251,6 +251,7 @@ static struct {
251
251
bool first_range_setx;
252
252
bool first_range_sety;
253
253
bool in_UIR;
254
+ bool polled;
254
255
uint8_t mode;
255
256
int16_t gran_x,gran_y;
256
257
int scrollwheel;
@@ -428,6 +429,23 @@ void ChangeMouseReportRate(unsigned int new_rate) {
428
429
}
429
430
}
430
431
432
+ int KEYBOARD_PS2REPORT_Active ();
433
+
434
+ bool MouseInterruptEnabled (void ) {
435
+ if (!IS_PC98_ARCH && KEYBOARD_AUX_Active ())
436
+ return true ;
437
+ if (KEYBOARD_PS2REPORT_Active ()) // FIXME: INT 15h needs to issue keyboard command "enable AUX"
438
+ return true ;
439
+ if (mouse.polled )
440
+ return true ;
441
+ if (mouse.sub_mask )
442
+ return true ;
443
+ if (!mouse.hidden )
444
+ return true ;
445
+
446
+ return false ;
447
+ }
448
+
431
449
void MOUSE_Limit_Events (Bitu /* val*/ ) {
432
450
mouse.timer_in_progress = false ;
433
451
@@ -442,7 +460,7 @@ void MOUSE_Limit_Events(Bitu /*val*/) {
442
460
PIC_AddEvent (MOUSE_Limit_Events,MOUSE_DELAY);
443
461
444
462
if (MOUSE_IRQ != 0 ) {
445
- if (!IS_PC98_ARCH)
463
+ if (!IS_PC98_ARCH && MouseInterruptEnabled () )
446
464
PIC_ActivateIRQ (MOUSE_IRQ);
447
465
}
448
466
}
@@ -468,7 +486,7 @@ INLINE void Mouse_AddEvent(uint8_t type) {
468
486
PIC_AddEvent (MOUSE_Limit_Events,MOUSE_DELAY);
469
487
470
488
if (MOUSE_IRQ != 0 ) {
471
- if (!IS_PC98_ARCH)
489
+ if (!IS_PC98_ARCH && MouseInterruptEnabled () )
472
490
PIC_ActivateIRQ (MOUSE_IRQ);
473
491
}
474
492
}
@@ -1567,6 +1585,7 @@ static Bitu INT33_Handler(void) {
1567
1585
switch (reg_ax) {
1568
1586
case 0x00 : /* MS MOUSE - RESET DRIVER AND READ STATUS */
1569
1587
Mouse_ResetHardware ();
1588
+ mouse.polled = false ;
1570
1589
goto software_reset;
1571
1590
case 0x01 : /* MS MOUSE v1.0+ - SHOW MOUSE CURSOR */
1572
1591
if (mouse.hidden ) mouse.hidden --;
@@ -1594,6 +1613,7 @@ static Bitu INT33_Handler(void) {
1594
1613
}
1595
1614
reg_cx=POS_X;
1596
1615
reg_dx=POS_Y;
1616
+ mouse.polled = true ;
1597
1617
mouse.first_range_setx = false ;
1598
1618
mouse.first_range_sety = false ;
1599
1619
if (en_int33_hide_if_polling) int33_last_poll = PIC_FullIndex ();
@@ -1639,6 +1659,7 @@ static Bitu INT33_Handler(void) {
1639
1659
}
1640
1660
if (en_int33_hide_if_polling) int33_last_poll = PIC_FullIndex ();
1641
1661
}
1662
+ mouse.polled = true ;
1642
1663
Mouse_Used ();
1643
1664
break ;
1644
1665
case 0x06 : /* MS MOUSE v1.0+ - RETURN BUTTON RELEASE DATA */
@@ -1668,6 +1689,7 @@ static Bitu INT33_Handler(void) {
1668
1689
}
1669
1690
if (en_int33_hide_if_polling) int33_last_poll = PIC_FullIndex ();
1670
1691
}
1692
+ mouse.polled = true ;
1671
1693
Mouse_Used ();
1672
1694
break ;
1673
1695
case 0x07 : /* MS MOUSE v1.0+ - DEFINE HORIZONTAL CURSOR RANGE */
@@ -1839,6 +1861,7 @@ static Bitu INT33_Handler(void) {
1839
1861
DrawCursor ();
1840
1862
break ;
1841
1863
case 0x0b : /* MS MOUSE v1.0+ - READ MOTION COUNTERS */
1864
+ mouse.polled = true ;
1842
1865
Mouse_Read_Motion_Data ();
1843
1866
break ;
1844
1867
case 0x0c : /* MS MOUSE v1.0+ - DEFINE INTERRUPT SUBROUTINE PARAMETERS */
@@ -2042,6 +2065,7 @@ static Bitu INT33_Handler(void) {
2042
2065
reg_dx = (uint16_t )mouse.max_y ;
2043
2066
break ;
2044
2067
case 0x27 : /* MS MOUSE v7.01+ - GET SCREEN/CURSOR MASKS AND MICKEY COUNTS */
2068
+ mouse.polled = true ;
2045
2069
reg_ax = mouse.textAndMask ;
2046
2070
reg_bx = mouse.textXorMask ;
2047
2071
Mouse_Read_Motion_Data ();
@@ -2465,6 +2489,7 @@ void MOUSE_Startup(Section *sec) {
2465
2489
mouse.timer_in_progress = false ;
2466
2490
mouse.mode = 0xFF ; // Non existing mode
2467
2491
mouse.scrollwheel = 0 ;
2492
+ mouse.polled = 0 ;
2468
2493
2469
2494
mouse.sub_mask =0 ;
2470
2495
mouse.sub_seg =0x6362 ; // magic value
0 commit comments