Micro Machines Code Card Format
| Format type | Executable / Script |
|---|---|
| Type | Compiled |
| Platform | MS-DOS |
| Code | x86 real mode, loaded at offset 0 and far-called |
| Hidden data? | No |
| Games |
Despite its name, FONT.BIN in Micro Machines is not a font. It is the code card copy protection: a module of x86 code with its own graphics, loaded and called by the game once at startup. The player is asked to find the symbol at a given column and row of the code card that came with the game, and pick it from a grid of 64 symbols. The file is 27084 bytes long.
The game reads the file into a fixed segment and makes a far call to offset 0 with AX = 0. The module returns AX = 0 if the answer was right and 0xFFFF if not; in that case the game quits to DOS without a message. The same memory is used for the sound driver afterwards.
The screen uses EGA mode 10h (640×350, 16 colours). The text is printed with the BIOS font.
File format
Offsets are file offsets, which are also the offsets in memory.
| Offset | Size | Content |
|---|---|---|
| 0x0000 | - | Code and text messages (in three languages) |
| 0x256A | 32×22 | Selection cursor (planar bitmap, 4 bytes per row) |
| 0x26CA | 208×162 | The 8×8 grid of 64 symbols (planar bitmap, 26 bytes per row) |
| 0x689A | 16 bytes | EGA palette (attribute controller values) while the screen is shown |
| 0x68AA | 16 bytes | All-dark EGA palette used before |
| 0x68BA | 8 × UINT16LE | Pointers to code cards. The entry is picked by AX; all but the first point to the end of the file, so only one card exists. |
| 0x68CC | 256 bytes | The code card |
Bitmaps
The bitmaps are stored as 4 planes one after another, each plane being rows × bytes per row, with the most significant bit being the leftmost pixel. Plane p gives bit p of the colour.
Code card
The card is 16 rows of 16 bytes. Row r (1-16) and column c (A-P) give the correct symbol, 0-63, a position in the symbol grid counted row by row.
The question is taken from the BIOS timer: column = ticks & 0x0F, row = (ticks >> 3) & 0x0F. Two questions must be answered correctly.
Notes
In the commonly found copy of the game both compare instructions are patched (at offsets 0xAB and 0x13A), so any answer is accepted. The original bytes were most likely E8 E5 00 3A C2 74 54 and E8 56 00 3A C2 75 2A at offsets 0xA8 and 0x137.
Credits
This file format was reverse engineered by VorticonCmdr. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)