Plane mappings
From Sega Retro
This article is too Mega Drive-specific. This is an old page originating from Sonic Retro and was originally designed to assist with Sonic the Hedgehog ROM hacking. The article should be modified to better reflect the scope of Sega Retro. |
A plane map, in Mega Drive games, describes how to arrange 8x8 tiles to form a plane. Its format is simple - one word per 8x8 tile to display, that word having the format PCCV HAAA AAAA AAAA, where P is the high priority flag, CC is the palette line to use, V and H are the vertical and horizontal flip flags, respectively, and AAA AAAA AAAA is the tile index of the 8x8 tile (i.e. VRAM location / $20).
Although the display area for Mega Drive Sonic games is usually 320x224, internally the VDP actually manages a playfield of size 512x256. Thus a plane map also contains information for tiles which are off the screen, and horizontal and vertical scrolling allow the game to choose which part of the playfield to display on-screen.
Plane maps are generally compressed using the Enigma format, which was specifically designed for this purpose and thus has a very high compression ratio for such data. They are also usually transferred to VRAM using a special routine (titled TilemapToVRAM in the SVN Sonic the Hedgehog disassembly), which takes as parameters the number of rows and columns in the map, and adjusts the transfer accordingly.