VDP Sprites

From MegaDrive Development Wiki
Jump to navigation Jump to search

Sprites

Display Position

The sprite position defined where to start drawing the sprite from the top-left corner.

Horizontal

The sprite H position is between 0 and 511 but the display area is from 128 to 383 in H32 mode and 128 to 447 in H40 mode.

When the sprite H position is 0 this is a special mode. All the sprites on the same line with low priority will not be displayed.

Vertical Non-interlace

The sprite V position is between 0 and 511 but the display area is from 128 to 351 in V28 mode and 128 to 367 in V30 mode.

Vertical Interlace mode 2

The sprite V position is between 0 and 1024 but the display area is from 256 to 703 in V28 mode and 256 to 735 in V30 mode.

Attribute Table

The Sprite attribute table address is defined via the vdp register 0x5.

Each sprites require 4 words.

0
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def Unused Vertical Position
1
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def Unused Horizontal size Vertical size Unused Link
2
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def Priority Palette ID Vertical Reverse Horizontal Reverse Tile ID
3
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Def Unused Horizontal Position

Size

16 different sprite size are selectable

The relationship between the tile id and the placement follow a top-left to bottom-right order.

V = 0 V = 1 V = 2 V = 3
H = 0
0
0
1
0
1
2
0
1
2
3
H = 1
0 1
0 2
1 3
0 3
1 4
2 5
0 4
1 5
2 6
3 7
H = 2
0 1 2
0 2 4
1 3 5
0 3 6
1 4 7
2 5 8
0 4 8
1 5 9
2 6 A
3 7 B
H = 3
0 1 2 3
0 2 4 6
1 3 5 7
0 3 6 9
1 4 7 A
2 5 8 B
0 4 8 C
1 5 9 D
2 6 A E
3 7 B F

Link