![]() |
![]() |
Sega Megadrive Assembly Programming BasicsCopyright, Lewis Bassett, December 2005
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.
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.
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.
This is the Megadrive's display, in basic. As we progress, I'll explain each part in greater detail. |