News
Documents
Source Code
Downloads
Message Board


Sega Megadrive Assembly Programming Basics

Copyright, Lewis Bassett, December 2005


Chapter 6 - VDP - Tiles, Colours and Planes

In Chapter 2, I briefly mentioned how the VDP controls everything that is output to the TV. In the next two chapters, I'll explain how it is used to draw graphics onto the screen.

The Video Display Processor, or VDP for short, works independantly from the M68000. We can use it to draw graphics by sending encoded commands to it. Because the VDP takes care of all the graphics, the M68000 is free to perform other tasks.


Control and Data Ports

The M68000 communicates with the VDP by using two different registers (which are actually addresses in memory): the data port, and the control port.

The control port is located at address $c00004, and is used to send encoded commands to the VDP. We simply send the command to memory address $c00004, and the VDP takes it and performs whatever operation we asked it to do!

In order for the VDP to do something, we often have to send it some data. For this we use the data port, which is located at address $c00000. Data we would send to it would include graphics, screen maps, coordinates and colours.

Using these two registers, our main ROM (which runs on the M68000) is able to communicate with the VDP, to draw graphics.


The Megadrive's Display

So how exactly is the Megadrive's display made up then?

What you see on the screen is actually made up from four different layers, which are each used for different things, which I'll explain.

The very bottom layer of the screen is the background colour. This is often also called the transparency colour.

The next layer up is Plane B. Plane B is simply a large scrollable area, often a few times larger that the actually screen itself. This can be scrolled around, so that the screen can display different parts of the plane at different times. In most games, the background art (eg, trees or buildings) is put on Plane B.

The next layer up is Plane A. Plane A is just like Plane B, except it sits on top. Any graphics on Plane A will be displayed on top of Plane B. Plane B is often used for platforms.

The final layer of the screen are the sprites. Sprites are little graphical entities, which can move around anywhere ontop of Plane A. Sprites are used for characters, enemies, objects and anything which moves around Plane A or Plane B.

In this game, Sonic Crackers, Sonic and Tails are drawn using sprites. The platform they're running on is drawn onto Plane A, and the machines in the background are drawn onto Plane B.

This is the Megadrive's display, in basic. As we progress, I'll explain each part in greater detail.



Chapter5 - Section 5 Contents Chapter 6 - Section 1


Designed & maintained by Lewis AS Bassett
SEGA, Megadrive, Genesis, Sonic the Hedgehog, etc are all owned by Sega Enterprises Ltd