Nintendo DMG-01 Manual - Page 25

Sprites

Page 25 highlights

Game BoyTM CPU Manual 2.8.2. Sprites 2.8.2. Sprites GameBoy video controller can display up to 40 sprites either in 8x8 or in 8x16 pixels. Because of a limitation of hardware, only ten sprites can be displayed per scan line. Sprite patterns have the same format as tiles, but they are taken from the Sprite Pattern Table located at $8000-8FFF and have unsigned numbering. Sprite attributes reside in the Sprite Attribute Table (OAM - Object Attribute Memory) at $FE00-FE9F. OAM is divided into 40 4-byte blocks each of which corresponds to a sprite. In 8x16 sprite mode, the least significant bit of the sprite pattern number is ignored and treated as 0. When sprites with different x coordinate values overlap, the one with the smaller x coordinate (closer to the left) will have priority and appear above any others. When sprites with the same x coordinate values overlap, they have priority according to table ordering. (i.e. $FE00 - highest, $FE04 - next highest, etc.) Please note that Sprite X=0, Y=0 hides a sprite. To display a sprite use the following formulas: SpriteScreenPositionX (Upper left corner of sprite) = SpriteX - 8 SpriteScreenPositionY (Upper left corner of sprite) = SpriteY - 16 by DP Page 25

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139

Game Boy
TM
CPU Manual
2.8.2. Sprites
2.8.2.
Sprites
GameBoy video controller can display up to 40 sprites
either in 8x8 or in 8x16 pixels. Because of a
limitation of hardware, only ten sprites can be
displayed per scan line. Sprite patterns have the same
format as tiles, but they are taken from the Sprite
Pattern Table located at $8000-8FFF and have unsigned
numbering. Sprite attributes reside in the Sprite
Attribute Table (OAM - Object Attribute Memory) at
$FE00-FE9F. OAM is divided into 40 4-byte blocks each
of which corresponds to a sprite.
In 8x16 sprite mode, the least significant bit of the
sprite pattern number is ignored and treated as 0.
When sprites with different x coordinate values
overlap, the one with the smaller x coordinate (closer
to the left) will have priority and appear above any
others.
When sprites with the same x coordinate values
overlap, they have priority according to table
ordering. (i.e. $FE00 - highest, $FE04 - next highest,
etc.)
Please note that Sprite X=0, Y=0 hides a sprite. To
display a sprite use the following formulas:
SpriteScreenPositionX (Upper left corner of sprite)
= SpriteX - 8
SpriteScreenPositionY (Upper left corner of sprite)
= SpriteY - 16
by DP
Page 25