+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  [BGB] How to break on OAM write event?
Pages: [1]
Author Topic: [BGB] How to break on OAM write event?  (Read 1 times)
ubitux
Guest
« on: March 17, 2010, 02:21:12 pm »

Hi,

In the same vein as my last post, I'm now trying to break on an OAM event: my goal is to know how some particular sprites are loaded.

The OAM is bounded between 0xFE00 and 0xFE9F. According to the BGB VRAM viewer, the sprite is written at 0xFE10, and it's the tile located at 0:8300. So I tried to put some (read/write) access breakpoints on 0xFE10 and 0x8300 but it never breaks.

Can anyone provide more information about this?

Thanks
Tauwasser
Guest
« Reply #1 on: March 17, 2010, 03:16:06 pm »

This is transferred via DMA, so BGB won't break, because it's not a read/write command, but hardware action. Usually, there is only one routine which will DMA the sprite data from WRAM to OAM. It was recommended to put this routine into high ram (F000+) for some reason I currently forgot, so most likely you can find it there and set an execution breakpoint on it. The OAM DMA code won't differ much from game to game, so you will most likely be able to find it quickly if you search the way the docs do it.

cYa,

Tauwasser
ubitux
Guest
« Reply #2 on: March 18, 2010, 02:43:43 pm »

Thanks, I managed to do it: as you said, it's transferred via DMA, so I just put an access breakpoint on 0xff48 (DMA address). It broke immediately, so I just rewind until the first ret/reti to get the beginning of the function. Then, I look for codes who were calling this function.

But in fact, it was a bad strategy for what I was looking for. At least I learned something, thanks!
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC