Random glitchy line in Super Mario Bros. on real hardware?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
MARIO CHIP 1
Posts: 5
Joined: Thu May 16, 2013 9:16 am

Random glitchy line in Super Mario Bros. on real hardware?

Post by MARIO CHIP 1 » Thu May 16, 2013 10:30 am

This little thing has been bothering me for some time now, so I though I should try to get to the bottom of it. It's a bit hard to explain, but basically it's a one pixel/scanline tall, variable length line of "glitchyness" that appear seemingly completely randomly during SMB gameplay, about once a minute on average on my AV Famicom. However, it only happens on some "runs" of the game. Power cycling the system can either make it appear or go away. It also appears in SMB2 for the Disk System in the same manner.
I've been looking on the internet for real hardware videos of SMB showing this and it's not easy to find anything, but here is what I got:

First is this niconico video of some guy playing Mario blindfolded:
http://www.nicovideo.jp/watch/sm17492296
http://www.nicozon.net/watch/sm17492296 (no account needed)
http://www.nicozon.net/downloader.html? ... sm17492296 (download link page)
6:45~6:49 you can clearly see it around the middle of the screen.
Again at 7:02.

Second, this shaky video of a US NES playing back a TAS:
http://www.youtube.com/watch?v=T1Ps1O6sZX4
1:10, you can see it above the "WELCOME TO WARP ZONE" text.
3:05, above the castle.

So...what is going on here? Of course no emulator does this. Does this ever happen on your NES/Famicom? What causes it?

For all I know this has been discussed before, but googling this kind of thing is, of course, impossible.

(I wasn't sure which subforum to post this in, by the way)

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by thefox » Thu May 16, 2013 11:03 am

It always seems to happen close to a screen transition (when entering a warp, when a level has been finished), so I'm going to guess that it's an artifact from doing something with PPU (e.g. turning off rendering momentarily) when the rendering happens to be in the middle of the screen. Hard to say what exactly, but doppel's SMB disassembly should have the answer. Might be hard to find though if it's not reproducible.

Technically I don't see a reason why it shouldn't also happen on emulators.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

doppelganger
Posts: 184
Joined: Tue Apr 05, 2005 7:30 pm

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by doppelganger » Thu May 16, 2013 11:17 am

Is this glitchy line exclusive to Super Mario Bros? I can't think of any reason at the moment why that line should be occurring at all, since the only time anything is written to the PPU during display is after a sprite #0 hit is detected. And that happens farther up the screen.
Be whatever the situation demands.

3gengames
Formerly 65024U
Posts: 2269
Joined: Sat Mar 27, 2010 12:57 pm

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by 3gengames » Thu May 16, 2013 11:57 am

Weird, I've never seen it.

Grapeshot
Posts: 85
Joined: Thu Apr 14, 2011 9:27 pm
Contact:

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by Grapeshot » Thu May 16, 2013 2:36 pm

I don't think this glitch is exclusive to Super Mario Bros. I'm actually the one who made that second shaky video, and I think the glitch is not code related at all, but power related. Specifically, tiny dips in the supply voltage combined with an oxidized cartridge slot mean the PPU will read incorrect data for a few bytes. That Super Mario Bros. cartridge I was using is fairly temperamental even after cleaning, it needs to be jiggled around in the slot several times to work without showing horizontal or vertical glitchy lines.

I should recreate the recording setup I used there and try to get a less shaky video, but I would want to port the code to the new ARM Launchpad and I haven't gotten around to it. I never got it to work with any other TAS but Super Mario Bros. because I only had room for 6 minutes of controller data on the chip, and streaming more from the PC would eventually cause a missed controller interrupt and desync.

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by thefox » Thu May 16, 2013 3:42 pm

Ah, I didn't see the long glitchy line (I only looked at the short white line). The long line showed up long before the screen transition so my theory is out.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

ccovell
Posts: 1006
Joined: Sun Mar 19, 2006 9:44 pm
Location: Japan
Contact:

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by ccovell » Thu May 16, 2013 4:07 pm

Yes, I've seen the glitches in FDS SMB2 as well... I'm imagining it is power-related, or perhaps the CPU reads the PPU in some odd way mid-screen?

User avatar
koitsu
Posts: 4216
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by koitsu » Thu May 16, 2013 5:35 pm

My theory is that the issue has to do with bad pin/edge connector contact.

As has been discussed here on nesdev many times over, both the classic slot-loader NES, the Famicom, and the top-loader NES all have problems relating to cartridge connection (I will be a dick and state boldly that anyone who tells you otherwise is flat out wrong); this has plagued the console since its existence. Sometimes jostling/wobbling can cause a single pin to lose contact (or possibly still have contact but the signal is not as strong) which can cause anomalies of sorts; the results would vary depending upon what the entire system (CPU, PPU, and all other circuitry) was doing at that moment in time (we're talking microseconds here). Such jostling/wobbling could be caused by wiggling of the controller cord, or even stomping of feet against a floor (vibration going up through the table, etc.). Naturally every environment/situation is different, thus troubleshooting this is impossible. The older the carts (dirty/damaged contacts), the older the console (more worn the edge connector), the worse it gets -- even slot-loading NESes with new/replaced edge connectors have this problem (sometimes the edge connector is too tight, as crazy as that sounds).

This would also explain why such anomalies are not seen using emulators but only actual hardware.

Power-related issues, sure -- I can't refute that possibility. But please apply Occam's razor first.

P.S. -- I seriously don't know what it is about the NES/Famicom that drives OCD people to it. I have found this to be the case for decades now; you won't find the quantity of OCD people with any other console. It's utterly creepy. I don't know why things like "strange anomalies" (see OP), blowing on cartridge connectors, turning the console upside-down, etc. can't just be considered part of the whole actual experience of using the console. I had to do such in the late 80s/early 90s, so why is this such a big deal to people now? *shakes head*

Grapeshot
Posts: 85
Joined: Thu Apr 14, 2011 9:27 pm
Contact:

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by Grapeshot » Thu May 16, 2013 7:31 pm

Well, I actually replicated this, with a completely different NES, TV, and cartridge in a different city. The glitch is only really visible in certain areas of World 1-2. It also only seems to appear 1/3rd of the time when the console is powered on. Once it's doing it, resetting won't make it stop but powering on/off will. Maybe it only happens on one of the CPU/PPU clock alignments? Uninitialized RAM? Who knows.

And as for why to be OCD about this, it's because the NES is a quirky system and this is a forum full of people who want to emulate those quirks.

User avatar
koitsu
Posts: 4216
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by koitsu » Thu May 16, 2013 8:47 pm

Grapeshot wrote:Well, I actually replicated this, with a completely different NES, TV, and cartridge in a different city. The glitch is only really visible in certain areas of World 1-2. It also only seems to appear 1/3rd of the time when the console is powered on. Once it's doing it, resetting won't make it stop but powering on/off will. Maybe it only happens on one of the CPU/PPU clock alignments? Uninitialized RAM? Who knows.
Taken from the OP's own statements:

http://www.youtube.com/watch?v=T1Ps1O6sZX4 -- ~01:10 -- happens in World 1-2
http://www.youtube.com/watch?v=T1Ps1O6sZX4 -- ~03:05 -- happens in World 8-1
http://www.nicovideo.jp/watch/sm17492296 -- ~06:45 -- happens in World 1-2
http://www.nicovideo.jp/watch/sm17492296 -- ~07:02 -- happens in World 1-2

I suppose another possibility is that it's purely something between the PPU and display (TV) that's happening, possibly at the voltage level or something relating to NTSC. My absolute firm belief is that it's something physical or electrical, and is not a "quirk" or "characteristic" of the CPU or PPU (thus cannot be emulated, but I've been wrong before) because what I see in those videos looks like brief "video signal noise", and it's something I've seen on consoles as well as some arcades. If there is a reliable way to reproduce it ("reproduce" means at least 90% reproducible as consistently as possible), someone with an oscilloscope could probe different spots of the video circuitry (this is not necessarily the PPU itself) and see if they can figure out what's happening.

User avatar
rainwarrior
Posts: 7680
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by rainwarrior » Thu May 16, 2013 9:07 pm

I've seen stuff like this occasionally. I don't think it's limited to SMB. I just think the PPU wigs out a little sometimes, nothing to do with anything going on in software.

Edit: I was completely wrong about that. Read on!
Last edited by rainwarrior on Thu May 30, 2013 11:14 am, edited 1 time in total.

LocalH
Posts: 172
Joined: Thu Mar 02, 2006 12:30 pm

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by LocalH » Thu May 16, 2013 9:33 pm

To make it a little easier to see, I downloaded the capture from NND and isolated the frames where the glitch occurs. Note: frame numbers may or may not be slightly inaccurate, as I merely threw the .mp4 file into a barebones Avisynth script using DirectShowSource and loaded it into Virtualdub, and I noticed that I didn't seem to seek accurately on my machine when scrubbing backwards then forwards again. Still, here you go:

Image
Frame 12172

Image
Frame 12238

Image
Frame 12657

Image
Frame 12797

I find it intriguing that the instances of the glitch in close succession seem to always be on the same scanline, and also seem to pull from the same tile data:

ImageImage

ImageImage

The glitching also seems to have both a vertical and horizontal offset, and once again even though it seems to be different between the two "sets" of frames, it seems to be the same within each "set", and it also seems to be bringing in the other half of the nametable, as with the first set I can easily tell that the righthand "floating" glitch is a sliver of the coins, and when sliding those pixels down to the coins in Photoshop, they don't line up with the normal tiles on the left hand of the screen, however as most of us probably know there are single-wide blocks approximately four blocks to the right of the edge of the screen, which are visible in the second glitch set (and in that set, the two-block-wide glitch to the left of Mario may either be the blocks he's right next to but at a different y-pos, or the two-block-wide column just off the right hand side of the screen that contains a multi-coin block).

Whether this visual analysis helps or not, I dunno. Seems like the glitching is at least a bit deterministic, however.

User avatar
ulfalizer
Posts: 349
Joined: Fri Mar 08, 2013 9:55 pm
Location: Linköping, Sweden

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by ulfalizer » Thu May 16, 2013 9:36 pm

Here's a screen grab of a glitchy line. It does seem to be patterned, which is interesting.

Perhaps the copying of the horizontal bits from t to v gets messed up for that line (http://wiki.nesdev.com/w/index.php/The_ ... _scrolling, dot 257). That's the kind of problem that would sort itself out automatically on the next line, provided the next attempt is successful.
Attachments
glitchy.jpg

LocalH
Posts: 172
Joined: Thu Mar 02, 2006 12:30 pm

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by LocalH » Thu May 16, 2013 9:54 pm

Is that a piece of pipe on that line inbetween the 3 and 2 pipes? Given that the rest of the line look like breakable block tiles, that must be from the very top-most row of blocks that you run across when going to the warp zone normally (the pipe tiles would be the ones that Mario's head goes through when doing the world 36-1 glitch).

OT: This is strangely similar to some analysis I did on some footage of the 80's game show Press Your Luck a few years ago (that is unfortunately no longer online), when trying to track down a pattern to slides that would stick as the board would shuffle from one set of projectors to the other. That was possibly even more deterministic than this, however.

User avatar
ulfalizer
Posts: 349
Joined: Fri Mar 08, 2013 9:55 pm
Location: Linköping, Sweden

Re: Random glitchy line in Super Mario Bros. on real hardwar

Post by ulfalizer » Thu May 16, 2013 9:59 pm

LocalH wrote:Is that a piece of pipe on that line inbetween the 3 and 2 pipes? Given that the rest of the line look like breakable block tiles, that must be from the very top-most row of blocks that you run across when going to the warp zone normally (the pipe tiles would be the ones that Mario's head goes through when doing the world 36-1 glitch).
Looks like it to me. A nametable dump at that point would be interesting.

Something wonky happening to the scrolling bits on that line seems like a decent guess at least. It's interesting that it apparently tends to be on the same line.

Post Reply