@@ -669,13 +669,25 @@ static uint8_t * VGA_Draw_Linear_Line_24_to_32_HWMouse(Bitu vidstart, Bitu /*lin
669
669
uint8_t bitsB = vga.mem .linear [m+2 ];
670
670
for (uint8_t bit=(0x80 >> cursorStartBit); bit != 0 ; bit >>= 1 ) { // for each bit
671
671
cursorStartBit=0 ;
672
- if (bitsA&bit) {
673
- if (bitsB&bit) *xat ^= ~0U ;
674
- // else Transparent
675
- } else if (bitsB&bit) {
676
- *xat = *(uint32_t *)vga.s3 .hgc .forestack ;
672
+ if (vga.s3 .reg_55 & 0x10 ) {
673
+ // X11 mode: draw when mask bit is set, otherwise transparent
674
+ if (bitsA & bit) {
675
+ if (bitsB & bit) {
676
+ *xat = *(uint16_t *)vga.s3 .hgc .forestack ;
677
+ } else {
678
+ *xat = *(uint16_t *)vga.s3 .hgc .backstack ;
679
+ }
680
+ }
677
681
} else {
678
- *xat = *(uint32_t *)vga.s3 .hgc .backstack ;
682
+ // MS Windows mode
683
+ if (bitsA&bit) {
684
+ if (bitsB&bit) *xat ^= ~0U ;
685
+ // else Transparent
686
+ } else if (bitsB&bit) {
687
+ *xat = *(uint32_t *)vga.s3 .hgc .forestack ;
688
+ } else {
689
+ *xat = *(uint32_t *)vga.s3 .hgc .backstack ;
690
+ }
679
691
}
680
692
xat++;
681
693
}
@@ -1410,13 +1422,25 @@ static uint8_t * VGA_Draw_VGA_Line_Xlat32_HWMouse( Bitu vidstart, Bitu /*line*/)
1410
1422
for (uint8_t bit=(0x80 >> cursorStartBit); bit != 0 ; bit >>= 1 ) {
1411
1423
// for each bit
1412
1424
cursorStartBit=0 ; // only the first byte has some bits cut off
1413
- if (bitsA&bit) {
1414
- if (bitsB&bit) *xat ^= 0xFFFFFFFF ; // Invert screen data
1415
- // else Transparent
1416
- } else if (bitsB&bit) {
1417
- *xat = vga.dac .xlat32 [fg]; // foreground color
1425
+ if (vga.s3 .reg_55 & 0x10 ) {
1426
+ // X11 mode: draw when mask bit is set, otherwise transparent
1427
+ if (bitsA & bit) {
1428
+ if (bitsB & bit) {
1429
+ *xat = *(uint16_t *)vga.s3 .hgc .forestack ;
1430
+ } else {
1431
+ *xat = *(uint16_t *)vga.s3 .hgc .backstack ;
1432
+ }
1433
+ }
1418
1434
} else {
1419
- *xat = vga.dac .xlat32 [bg];
1435
+ // MS Windows mode
1436
+ if (bitsA&bit) {
1437
+ if (bitsB&bit) *xat ^= 0xFFFFFFFF ; // Invert screen data
1438
+ // else Transparent
1439
+ } else if (bitsB&bit) {
1440
+ *xat = vga.dac .xlat32 [fg]; // foreground color
1441
+ } else {
1442
+ *xat = vga.dac .xlat32 [bg];
1443
+ }
1420
1444
}
1421
1445
xat++;
1422
1446
}
@@ -1486,13 +1510,25 @@ static uint8_t * VGA_Draw_VGA_Line_HWMouse( Bitu vidstart, Bitu /*line*/) {
1486
1510
for (uint8_t bit=(0x80 >> cursorStartBit); bit != 0 ; bit >>= 1 ) {
1487
1511
// for each bit
1488
1512
cursorStartBit=0 ; // only the first byte has some bits cut off
1489
- if (bitsA&bit) {
1490
- if (bitsB&bit) *xat ^= 0xFF ; // Invert screen data
1491
- // else Transparent
1492
- } else if (bitsB&bit) {
1493
- *xat = vga.s3 .hgc .forestack [0 ]; // foreground color
1513
+ if (vga.s3 .reg_55 & 0x10 ) {
1514
+ // X11 mode: draw when mask bit is set, otherwise transparent
1515
+ if (bitsA & bit) {
1516
+ if (bitsB & bit) {
1517
+ *xat = *(uint16_t *)vga.s3 .hgc .forestack ;
1518
+ } else {
1519
+ *xat = *(uint16_t *)vga.s3 .hgc .backstack ;
1520
+ }
1521
+ }
1494
1522
} else {
1495
- *xat = vga.s3 .hgc .backstack [0 ];
1523
+ // MS Windows mode
1524
+ if (bitsA&bit) {
1525
+ if (bitsB&bit) *xat ^= 0xFF ; // Invert screen data
1526
+ // else Transparent
1527
+ } else if (bitsB&bit) {
1528
+ *xat = vga.s3 .hgc .forestack [0 ]; // foreground color
1529
+ } else {
1530
+ *xat = vga.s3 .hgc .backstack [0 ];
1531
+ }
1496
1532
}
1497
1533
xat++;
1498
1534
}
@@ -1561,16 +1597,28 @@ static uint8_t * VGA_Draw_LIN16_Line_HWMouse(Bitu vidstart, Bitu /*line*/) {
1561
1597
for (uint8_t bit=(0x80 >> cursorStartBit); bit != 0 ; bit >>= 1 ) {
1562
1598
// for each bit
1563
1599
cursorStartBit=0 ;
1564
- if (bitsA&bit) {
1565
- // byte order doesn't matter here as all bits get flipped
1566
- if (bitsB&bit) *xat ^= ~0U ;
1567
- // else Transparent
1568
- } else if (bitsB&bit) {
1569
- // Source as well as destination are uint8_t arrays,
1570
- // so this should work out endian-wise?
1571
- *xat = *(uint16_t *)vga.s3 .hgc .forestack ;
1600
+ if (vga.s3 .reg_55 & 0x10 ) {
1601
+ // X11 mode: draw when mask bit is set, otherwise transparent
1602
+ if (bitsA & bit) {
1603
+ if (bitsB & bit) {
1604
+ *xat = *(uint16_t *)vga.s3 .hgc .forestack ;
1605
+ } else {
1606
+ *xat = *(uint16_t *)vga.s3 .hgc .backstack ;
1607
+ }
1608
+ }
1572
1609
} else {
1573
- *xat = *(uint16_t *)vga.s3 .hgc .backstack ;
1610
+ // MS Windows mode
1611
+ if (bitsA&bit) {
1612
+ // byte order doesn't matter here as all bits get flipped
1613
+ if (bitsB&bit) *xat ^= ~0U ;
1614
+ // else Transparent
1615
+ } else if (bitsB&bit) {
1616
+ // Source as well as destination are uint8_t arrays,
1617
+ // so this should work out endian-wise?
1618
+ *xat = *(uint16_t *)vga.s3 .hgc .forestack ;
1619
+ } else {
1620
+ *xat = *(uint16_t *)vga.s3 .hgc .backstack ;
1621
+ }
1574
1622
}
1575
1623
xat++;
1576
1624
}
@@ -1634,13 +1682,25 @@ static uint8_t * VGA_Draw_LIN32_Line_HWMouse(Bitu vidstart, Bitu /*line*/) {
1634
1682
uint8_t bitsB = vga.mem .linear [m+2 ];
1635
1683
for (uint8_t bit=(0x80 >> cursorStartBit); bit != 0 ; bit >>= 1 ) { // for each bit
1636
1684
cursorStartBit=0 ;
1637
- if (bitsA&bit) {
1638
- if (bitsB&bit) *xat ^= ~0U ;
1639
- // else Transparent
1640
- } else if (bitsB&bit) {
1641
- *xat = *(uint32_t *)vga.s3 .hgc .forestack ;
1685
+ if (vga.s3 .reg_55 & 0x10 ) {
1686
+ // X11 mode: draw when mask bit is set, otherwise transparent
1687
+ if (bitsA & bit) {
1688
+ if (bitsB & bit) {
1689
+ *xat = *(uint16_t *)vga.s3 .hgc .forestack ;
1690
+ } else {
1691
+ *xat = *(uint16_t *)vga.s3 .hgc .backstack ;
1692
+ }
1693
+ }
1642
1694
} else {
1643
- *xat = *(uint32_t *)vga.s3 .hgc .backstack ;
1695
+ // MS Windows mode
1696
+ if (bitsA&bit) {
1697
+ if (bitsB&bit) *xat ^= ~0U ;
1698
+ // else Transparent
1699
+ } else if (bitsB&bit) {
1700
+ *xat = *(uint32_t *)vga.s3 .hgc .forestack ;
1701
+ } else {
1702
+ *xat = *(uint32_t *)vga.s3 .hgc .backstack ;
1703
+ }
1644
1704
}
1645
1705
xat++;
1646
1706
}
0 commit comments