Sprite logic

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

Yes, but you're right, I recalled the behavior quite incorrectly. Much simpler than I thought, when $00 underflows, the sprite is at $FF which is valid, rest is clipped.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »

What just happens is that there is NEVER negative coordinate on a sprite pos on the NES (at least not in hardware) so you cannot display part a sprite from the top or the left of the screen without tricks.
And yes OAM has to always be cleaned with any value between $f0-$ff for sprites you don't use, $00 isn't what you want. "Cleaning" the OAM with $00 will have the effect to supperpose 64 sprites using tile $00 and palette 0 at position 0,0. This is bad.
User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

I need it to be $00 for the correct palette since I always update $0, $1 and $3 but never $2 of sprites. I know that all the excess sprites may appear at 0,0 depending on how the RAM is starts up, it doesn't matter. This is just a hacky program I will probably delete tomorrow, you guys are being way too serious about the small stuff that I already said doesn't matter and I'm very aware of.

I now know that there isn't anything logically wrong with my program and that the clipping is just a quirk of the PPU. Nintendo could have done better but they didn't, and it's not something I can change by thinking about it, so I'll just have to move my square to the background and scroll that, no big deal.
Post Reply