How does the default mouse cursor in MS-DOS work without erasing whatever is underneath it?

399 Views Asked by At

My understanding of VGA graphics may be flawed, but it seems to have only one layer of graphics, yet the mouse cursor in MS-DOS (or at least DOSBox) appears to be independent of the graphics beneath, much like a "sprite layer" on most video game consoles of the time. Yet DOSBox's VGA mode appears to be a one-layer bitmap screen. Is the mouse on a separate layer that only it can occupy? Furthermore, is there a way for VGA to output hardware sprites?

1

There are 1 best solutions below

0
On

As far as I know VGA has no hardware support for a mouse cursor or sprites. With the introduction of XGA sprites became available. But VGA only supports a text cursor but no graphical cursor.

So my guess is that the mouse driver reads the 16x16 pixels (or whatever the size of the mouse pointer is) and then stores it somewhere. Then it can draw the mouse pointer into the frame buffer. When the pointer is moved a bit to the left (for example) then the driver can restore the original 16x16 pixels in the frame buffer. Then it reads 16x16 pixels from the new location and then draws the pointer again.

As long as DOS Box is in windowed mode (means not in full screen) it doesn't access the VGA registers anyway but draws on a canvas provided by the operating system. So DOS Box can use hardware sprites even if VGA doesn't support it. Because in this situation VGA is not used at all.