Sprite 0 Hit Question

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
ace314159
Posts: 27
Joined: Tue Apr 17, 2018 3:40 am

Sprite 0 Hit Question

Post by ace314159 »

I have a question with how sprite 0 hits work in. My emulator currently fails with error code #6 on blargg's test 05.left_clip. Looking at the readme, it says that the flag should not be set:

Code: Select all

lda   #upper_left_tile
sta   sprite_tile
lda   #7
sta   sprite_x
lda   #6;) Should miss; sprite pixel covered by left-edge clip
ldx   #$18
jsr   sprite_should_miss
But looking at the code (and my emulator's logs), isn't the sprite x set to 7? And doesn't that mean that if there is an opaque pixel after the first pixel, the flag should be set?
Am I misunderstanding something?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Sprite 0 Hit Question

Post by tepples »

The window function can disable sprites, background, or both at x=0 through 7. When background is disabled in this region, the pixel pipeline treats those background pixels as transparent. When sprites are disabled in this region, the pixel pipeline treats those sprite pixels as transparent. And transparent pixels never cause a sprite 0 hit.
ace314159
Posts: 27
Joined: Tue Apr 17, 2018 3:40 am

Re: Sprite 0 Hit Question

Post by ace314159 »

Thanks, that clarified my doubt. My logic was correct but I got the color incorrectly, so that gave me false positives and negatives.
Post Reply