Skip to content

Commit 1f23229

Browse files
TheRektafireISSOtm
andcommitted
Clarify "Writing Data to OAM Memory" in OAM page
Co-Authored-By: ISSOtm <[email protected]>
1 parent b4c4b3c commit 1f23229

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/OAM.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ tile is "NN & $FE", and the bottom 8x8 tile is "NN | $01".
5454
Bit2-0 Palette number **CGB Mode Only** (OBP0-7)
5555
```
5656

57+
## Writing data to OAM
58+
59+
The recommended method is to write the data to a buffer in normal RAM
60+
(typically WRAM) first, then to copy that buffer to OAM using
61+
[the DMA transfer functionality](<#OAM DMA Transfer>).
62+
63+
While it is also possible to write data directly to the OAM area
64+
[by accessing it normally](<#OAM (memory area at $FE00-$FE9F) is accessible during Modes 0-1>),
65+
this only works [during the HBlank and VBlank periods](<#LCD Status Register>).
66+
5767
## Object Priority and Conflicts
5868

5969
There are two kinds of "priorities" as far as objects are concerned.
@@ -113,12 +123,3 @@ This can be exploited to only hide parts of an object behind the background
113123
A similar behaviour [can be seen on the NES](https://forums.nesdev.com/viewtopic.php?f=10&t=16861)).
114124

115125
:::
116-
117-
## Writing Data to OAM
118-
119-
The recommended method is to write the data to normal RAM first, and to
120-
copy that RAM to OAM by using the DMA transfer function, initiated
121-
through DMA register (FF46). Besides, it is also possible to
122-
write data directly to the OAM area by using normal LD instructions, but this
123-
works only during the HBlank and VBlank periods. The current state of
124-
the LCD controller can be read out from the STAT register (FF41).

0 commit comments

Comments
 (0)