Curs

Back to the Game Files

curs
The curs file contains the mouse cursors of the game. The file is not encrypted or compressed in any way. But the storage of the pixel values is quite strange. The file contains eight mouse cursors. Each mouse cursor has a size of 16x16 pixels and can contain all 16 EGA colors. Each mouse cursor also has a transparency mask. But this mask is not a simple bitmask. Even these masks can have all 16 colors. The game does not use this feature but a 4 bit transparency mask allows to define for example that only the red component of a pixel is transparent while the blue, green and the intensity bit is opaque.

Instead of storing the full color of two pixels in one byte the curs file first contains all the blue component bits, then the green component bits, then the red component bits and then the intensity component bits. And if this is not complicated enough the cursor mask is not stored after the cursor image. Instead the mask and the cursor image is interleaved in the file. So the first 64 bytes of the file contain the blue components of the image and the mask of the first cursor. The first two bytes contain the 16 blue component bits of the first line in reverse order (byte 0 contains the upper right pixels; byte 1 contains the upper left). Bytes 2 and 3 contain the corresponding mask bits. However, these bits are inversed from a normal mask: 1 means include the color bit, 0 means don't. Repeat this 16 times to read all 16 lines of the cursor image and its mask.

The next 64 bytes contain the green component bits in the same format. The next 64 bytes contain the red component bits and the next 64 bytes the intensity component bits. Now you have read 256 bytes and the first cursor is complete. Do the same seven times again and you have all eight cursors.

Technical
The CURS file is loaded as part of the game startup, and is placed into Seg000:7E0B. Oddly, although the cursors file is 0x7FF bytes in size, the loader only requests 0x7E0 bytes to be read, leaving the last 32 bytes of the file unread. This may be a bug since omitting the last 32 bytes chops the last cursor. Anyone want to look at this and comment?