Nintendo DMG-01 Manual - Page 136

V 1.01

Page 136 highlights

5.1. Emulator Notes Game BoyTM CPU Manual 6. If you are using sprites then you should not use the following commands when their register contents are in the range $fe00-$feff. inc bc inc de inc hl dec bc dec de dec hl If you don't follow this rule, sprite trash in the form of sprite "blink" will randomly affect your sprites. 7. Normally you should only make changes to Sprite RAM during V-Blank unless you are an expert and know exactly what you are doing. The common way to do this is to use the GB DMA register ($ff46) to do a fast copy from your sprite table in RAM to $fE00-$fe9f. A. You need a sprite table in RAM with a starting address of $XX00 and with a length of 160 ($a0). Many often use $c000-$c09f for this purpose but anywhere in RAM starting with $XX00 is fine. B. You need to create a VBlank interrupt routine that contains the DMA command, followed by a short delay to allow the DMA to complete, and copy this routine to high RAM ($ff00-$fffe). The DMA command WILL NOT WORK in ROM or low RAM because these are disabled during DMA. C. After copying this routine to high RAM you then need to enable the VBLANK interrupt and then enable interrupts. Page 136 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

5.1. Emulator Notes
Game Boy
TM
CPU Manual
6. If you are using sprites then you should not use the
following commands when their register contents are
in the range $fe00-$feff.
inc bc
inc de
inc hl
dec bc
dec de
dec hl
If you don't follow this rule, sprite trash in the
form of sprite "blink" will randomly affect your
sprites.
7. Normally you should only make changes to Sprite RAM
during V-Blank unless you are an expert and know
exactly what you are doing. The common way to do this
is to use the GB DMA register ($ff46) to do a fast
copy from your sprite table in RAM to $fE00-$fe9f.
A. You need a sprite table in RAM with a starting
address of $XX00 and with a length of 160 ($a0). Many
often use $c000-$c09f for this purpose but anywhere
in RAM starting with $XX00 is fine.
B. You need to create a VBlank interrupt routine that
contains the DMA command, followed by a short delay
to allow the DMA to complete, and copy this routine
to high RAM ($ff00-$fffe). The DMA command WILL NOT
WORK in ROM or low RAM because these are disabled
during DMA.
C. After copying this routine to high RAM you then need
to enable the VBLANK interrupt and then enable
interrupts.
Page 136
V 1.01