Sprite Noob Question

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
Anes
Posts: 702
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Sprite Noob Question

Post by Anes »

Im rewriting my sprites engine since i was using the old "brad taylor" method as we know is outdated.
I find a problem when sprites have X=255 or 0xFF. When a sprite has this coordinate value is it visible?, since im getting errors.

Thanks in advance.
ANes
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Sprite Noob Question

Post by lidnariq »

Sprite 0 hits don't trigger on sprites with X=255, even if there are visible pixels. Otherwise I think it's normal?
User avatar
Anes
Posts: 702
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Sprite Noob Question

Post by Anes »

I know it doesn't trigger when its 255, but my question is if X is set intentionally at 255, is the the sprite pixel shown??
ANes
User avatar
Anes
Posts: 702
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Sprite Noob Question

Post by Anes »

mean this:
I have 8 output units wich this unit is a C struct:

Code: Select all

typedef struct
{
	unsigned char Y, TileIndex, Attr, PT0, PT1, pre_spr_zero, spr_zero;
	int X;
} SPRBUFFER, * PSPRBUFFER;
"X" is copied from "sprite temp" memory in sprite fetches phase.

When rendering each ppu cc i decrese this "X", when X == 0 the unit is "active" and check if the sprite is not transparent.

What i got is this:


Image
ANes
mkwong98
Posts: 282
Joined: Mon May 30, 2011 9:01 pm

Re: Sprite Noob Question

Post by mkwong98 »

The game should not set 255 to the left sprite when Mario moves to the left edge of the screen so I think it is a bug with the CPU, not PPU.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Sprite Noob Question

Post by Sik »

Maybe it just assumes that Mario can never be off-screen horizontally? Especially since it'd be impossible to see on a TV anyway (due to overscan).
User avatar
Anes
Posts: 702
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Sprite Noob Question

Post by Anes »

I solved it!! it was an sprite logic problem anyway I tested it in a real NES and it doesn't produce that effect.
ANes
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Sprite Noob Question

Post by Zepper »

Now I'm curious. :oops: :oops: :oops:

Is this a bug? Isn't Mario sprite supposed to wrap?
Attachments
Super Mario Bros. (JU) (PRG1) 000.bmp
mkwong98
Posts: 282
Joined: Mon May 30, 2011 9:01 pm

Re: Sprite Noob Question

Post by mkwong98 »

Zepper wrote:Now I'm curious. :oops: :oops: :oops:

Is this a bug? Isn't Mario sprite supposed to wrap?
You are right, somehow that glitch didn't cross my mind when I saw the first picture.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Sprite Noob Question

Post by Zepper »

Anes wrote:I solved it!! it was an sprite logic problem anyway I tested it in a real NES and it doesn't produce that effect.
What was your fix?? I'd like to know in details to fix my emu too.
nostromo
Posts: 9
Joined: Tue Aug 12, 2014 11:25 pm
Location: Sonora, Mexico

Re: Sprite Noob Question

Post by nostromo »

I've tested it in my Sony Triniton using service menu and it happends on real hardware(sorry by the image).
Attachments
IMG0231A.jpg
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Sprite Noob Question

Post by tokumaru »

IIRC, SMB calculates sprite positions in a strange way, it doesn't surprise me that this bug is actually in the game.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Sprite Noob Question

Post by tepples »

Is this along the glitches that ShaneM fixed?
User avatar
Anes
Posts: 702
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Re: Sprite Noob Question

Post by Anes »

Yeah it happens in real hardware.

I have a real NES and a PAL Dendy. The thing that i couldn't test it in the real NES yestarday becouse my current transformer was broken and i tought that Dendy was the same, but not.

I have just bought one for the NES and IT DO HAPPEN.
ANes
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Sprite Noob Question

Post by Zepper »

This sprite wrapping occurs in Nintendulator, but not on puNES. If Anes "has fixed it", it just took ppu_cycle MINUS sprite_xpos > 0 (should be >= 0).

So, that's it. No panic - it's not an emulator glitch.
Post Reply