Graphical glitch

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Graphical glitch
by on (#22010)
I'm having a problem with my emulator that I'm finding hard to fix... A picture's worth a thousand words, so here's what the Mario sprite looks like.

Image

All sprites in the game have the same problem - any tips on what could be wrong? All games I've tried display this issue, although they play fine.

Thanks 8)

by on (#22013)
Does it screw up when he faces both directions or just that one?

by on (#22014)
Both directions, and ALL sprites are affected... I've looked over my code again, but I can't spot the problem. I was hoping this was a commonly seen problem or something :wink:

Thanks for the reply.

by on (#22016)
Maybe your handling for 8x16 sprites is incorrect ?

by on (#22018)
SMB1 is 8x8.

by on (#22021)
Looks like tile fetching is incorrect. If you look closely, you can see that the weird colours around Mario, are actual tiles that have been fetched incorrectly. Yes, Super Mario Bros. is 8x8 only. Yeah, it is really common to see such a thing when writing your emulator, we've all been there.

Nice palette btw, where did you get it?

by on (#22026)
WedNESday wrote:
Looks like tile fetching is incorrect. If you look closely, you can see that the weird colours around Mario, are actual tiles that have been fetched incorrectly.


Nope, it's the wrong sprite horizontal flipping.

by on (#22054)
Fx3 wrote:
WedNESday wrote:
Looks like tile fetching is incorrect. If you look closely, you can see that the weird colours around Mario, are actual tiles that have been fetched incorrectly.


Nope, it's the wrong sprite horizontal flipping.


If there was a prize to be won, WedNESday would get it - I was screwing up the byte order in my tile fetching code :) I'm not sure how I managed it yet, but it's fixed now and working great. Time to add sound support!

Thanks guys.

Oh, and I don't remember exactly where I stole the palette from... Some other emulator anyway, it's not my own work.

by on (#22055)
bigrob wrote:
If there was a prize to be won, WedNESday would get it - I was screwing up the byte order in my tile fetching code :) I'm not sure how I managed it yet, but it's fixed now and working great.


Fine. Two guesses.
Glad you fixed it.

by on (#22073)
Fx3 wrote:
bigrob wrote:
If there was a prize to be won, WedNESday would get it - I was screwing up the byte order in my tile fetching code :) I'm not sure how I managed it yet, but it's fixed now and working great.


Fine. Two guesses.
Glad you fixed it.


:P :wink: