Nintendo DMG-01 Manual - Page 26

V 1.01

Page 26 highlights

2.8.2. Sprites Game BoyTM CPU Manual To display a sprite in the upper left corner of the screen set sprite X=8, Y=16. Only 10 sprites can be displayed on any one line. When this limit is exceeded, the lower priority sprites (priorities listed above) won't be displayed. To keep unused sprites from affecting onscreen sprites set their Y coordinate to Y=0 or Y=>144+16. Just setting the X coordinate to X=0 or X=>160+8 on a sprite will hide it but it will still affect other sprites sharing the same lines. Blocks have the following format: Byte0 Byte1 Byte2 Byte3 Y position on the screen X position on the screen Pattern number 0-255 (Unlike some tile numbers, sprite pattern numbers are unsigned. LSB is ignored (treated as 0) in 8x16 mode.) Flags: Bit7 Bit6 Bit5 Priority If this bit is set to 0, sprite is displayed on top of background & window. If this bit is set to 1, then sprite will be hidden behind colors 1, 2, and 3 of the background & window. (Sprite only prevails over color 0 of BG & win.) Y flip Sprite pattern is flipped vertically if this bit is set to 1. X flip Sprite pattern is flipped horizontally if this bit is set to 1. Page 26 V 1.01

  • 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

2.8.2. Sprites
Game Boy
TM
CPU Manual
To display a sprite in the upper left corner of the
screen set sprite X=8, Y=16.
Only 10 sprites can be displayed on any one line.
When this limit is exceeded, the lower priority
sprites (priorities listed above) won't be displayed.
To keep unused sprites from affecting onscreen sprites
set their Y coordinate to Y=0 or Y=>144+16. Just
setting the X coordinate to X=0 or X=>160+8 on a
sprite will hide it but it will still affect other
sprites sharing the same lines.
Blocks have the following
format:
Byte0
Y position on the screen
Byte1
X position on the screen
Byte2
Pattern number 0-255 (Unlike some tile
numbers, sprite pattern numbers are unsigned.
LSB is ignored (treated as 0) in 8x16 mode.)
Byte3
Flags:
Bit7
Priority
If this bit is set to 0, sprite is
displayed on top of background & window.
If this bit is set to 1, then sprite
will be hidden behind colors 1, 2, and 3
of the background & window. (Sprite only
prevails over color 0 of BG & win.)
Bit6
Y flip
Sprite pattern is flipped vertically if
this bit is set to 1.
Bit5
X flip
Sprite pattern is flipped horizontally
if this bit is set to 1.
Page 26
V 1.01