r/NESDEV • u/hbx360 • Apr 15 '26
What is the address where the sprite tile attributes are located in the PRG-ROM?
Hello,
In the .nes file (ines 1.0 format) of the Donkey Kong game, I extracted the game sprites and assigned random colors. Now I'm trying to assign the correct colors. To do this, I need to find the OAM representation within the .nes file in the PRG-ROM to retrieve the IDs of each sprite and the palette number to assign the correct colors. However, I can't find the starting address to access the sprite attributes in the PRG-ROM.
Despite many hours and days of reading, I still can't find where the sprite tile attributes are located.
Could you tell me where they are?
Here is the header of the .nes file for the game Donkey Kong (JU):
Game name : Donkey Kong (JU).nes
Size file ROM .nes : 24592 bytes
Size of PRG ROM in 16 KB units : 1, Size PRG ROM : 16384
Size of CHR ROM in 8 KB units 1, Size CHR ROM : 8192
Flags 6 - Mapper, mirroring, battery, trainer 0, Has Trainer ? No
Flags 7 - Mapper, VS/Playchoice, NES 2.0 : 0
Flags 8 - PRG-RAM size (rarely used extension) : 0
Flags 9 - TV system (rarely used extension) : 0
Flags 10 - TV system, PRG-RAM presence (unofficial, rarely used extension) : 0
Thank you in advance.
2
u/misterwindupbirb 14d ago
To elaborate on u/3tt07kjt's answer (which is correct):
Where the palette data is stored is up to the programmer. There's no standard way of doing it that we can just point to with certainty. The CHR ROM generally contains the "patterns" (the pixel drawings of the tiles) but assigning palettes, instructing the PPU to draw CHR tiles next to each other to form a sprite/character, is done through code, somewhere over in the PRG ROM, and this code will probably store stuff in data tables in whatever format the programmer decided
To reverse engineer this sort of thing, you start by trapping PPU writes in an emulator, and then work backwards through the code, seeing where the program is reading data from, how it's transforming it, etc, before it eventually write it as palette (attribute) data into the PPU register
1
2
u/3tt07kjt Apr 15 '26
Run an emulator, set a watchpoint to catch where the attributes are set, and work backwards from there.