Difference between revisions of "Sega Mega Drive/Planes"
From Sega Retro
(Created page with "In addition to sprites, the Sega Mega Drive uses three '''planes''' to display graphics. These planes consist of two grids of tiles - a foregro...") |
|||
Line 16: | Line 16: | ||
| <tt>move.w #$8400+($xxxx>>13),($c00004).l</tt> | | <tt>move.w #$8400+($xxxx>>13),($c00004).l</tt> | ||
|- | |- | ||
− | | Window (320 pixel wide mode) | + | | Window ([[Sega Mega Drive/VDP registers#0C|320 pixel wide mode]]) |
| 0, $1000, $2000, $3000, $4000, $5000, $6000, $7000, $8000, $9000, $A000, $B000, $C000, $D000, $E000, $F000 | | 0, $1000, $2000, $3000, $4000, $5000, $6000, $7000, $8000, $9000, $A000, $B000, $C000, $D000, $E000, $F000 | ||
| <tt>move.w #$8300+($xxxx>>10),($c00004).l</tt> | | <tt>move.w #$8300+($xxxx>>10),($c00004).l</tt> | ||
|- | |- | ||
− | | Window (256 pixel wide mode) | + | | Window ([[Sega Mega Drive/VDP registers#0C|256 pixel wide mode]]) |
| 0, $800, $1000, $1800, $2000, $2800, $3000, $3800, $4000, $4800, $5000, $5800, $6000, $6800, $7000, $7800, $8000, $8800, $9000, $9800, $A000, $A800, $B000, $B800, $C000, $C800, $D000, $D800, $E000, $E800, $F000, $F800 | | 0, $800, $1000, $1800, $2000, $2800, $3000, $3800, $4000, $4800, $5000, $5800, $6000, $6800, $7000, $7800, $8000, $8800, $9000, $9800, $A000, $A800, $B000, $B800, $C000, $C800, $D000, $D800, $E000, $E800, $F000, $F800 | ||
| <tt>move.w #$8300+($xxxx>>10),($c00004).l</tt> | | <tt>move.w #$8300+($xxxx>>10),($c00004).l</tt> |
Revision as of 19:01, 13 June 2018
In addition to sprites, the Sega Mega Drive uses three planes to display graphics. These planes consist of two grids of tiles - a foreground (plane A) and background (plane B) - which can be moved independently, as well as a static window plane. The content of the planes is determined by nametables, which are stored in VRAM. Planes A & B can be moved around by modifying the horizontal scroll table (in VRAM) and vertical scroll table (in VSRAM).
Contents
Nametables
Location
Nametables for all three planes are stored in VRAM, and their location is set by VDP registers 02, 03 and 04. Nametables can't be placed anywhere in VRAM, rather they must be aligned to particular multiples.
Nametable | Valid locations | Code |
---|---|---|
Foreground (Plane A) | 0, $2000, $4000, $6000, $8000, $A000, $C000, $E000 | move.w #$8200+($xxxx>>10),($c00004).l |
Background (Plane B) | 0, $2000, $4000, $6000, $8000, $A000, $C000, $E000 | move.w #$8400+($xxxx>>13),($c00004).l |
Window (320 pixel wide mode) | 0, $1000, $2000, $3000, $4000, $5000, $6000, $7000, $8000, $9000, $A000, $B000, $C000, $D000, $E000, $F000 | move.w #$8300+($xxxx>>10),($c00004).l |
Window (256 pixel wide mode) | 0, $800, $1000, $1800, $2000, $2800, $3000, $3800, $4000, $4800, $5000, $5800, $6000, $6800, $7000, $7800, $8000, $8800, $9000, $9800, $A000, $A800, $B000, $B800, $C000, $C800, $D000, $D800, $E000, $E800, $F000, $F800 | move.w #$8300+($xxxx>>10),($c00004).l |
Format
A nametable consists of one word per tile, with the following format:
7
6
5
4
3
2
1
0
PR
PL
V
H
T10-T8
7
6
5
4
3
2
1
0
T7-T0
- PR: Priority. 1 = high; 0 = low.
- PL: Palette line.
- V: Vertical flip. 1 = flipped; 0 = normal.
- H: Horizontal flip. 1 = flipped; 0 = normal.
- T10-T0: Tile index. The number of the tile in VRAM to use, or its address divided by $20.