Displaced Gamers on Mega Man 3 Glitches

A bit of scanline flickering is a fairly common problem on the NES. Even Super Mario Bros. 3 had it, and that game was made by Nintendo themselves.

Game graphics in the 8- and 16-bit ages often came down to tricky hardware manipulation. The art of doing raster effects, changing the registers in the video hardware so as to divide the screen into different sections, ultimately comes down to timing. On the Atari VCS/2600, nearly all the graphics had to be done that way, but it was still a useful technique for over a decade after that.

A lot depends on the specifics of the video chip, a custom-built piece of silicon developed for the express purpose of taking graphics defined in memory and folding it, like electronic origami, into a shape that the TV would perceive as a broadcast signal. At that time, while it might still have been possible with clever coding, CPUs weren’t nearly fast enough to do that job themselves and still produce acceptable graphic quality and run game logic. (If you want to see what it would be like, I refer readers interested in doing it the very hard way to the amazing Freespin demo, which runs on a 1541 disk drive, and no video hardware at all.)

Older NES games used a supported bit of hackery called the “Sprite 0 Hit,” a signal the PPU would send at the moment the first of the system’s 64 sprites began to be drawn. By watching for it, games could do rudimentary raster effects on a system not designed for them. The issue there was processor time: the Sprite 0 Hit feature wasn’t hooked up to an interrupt line, so the program had to continually watch for it, checking a memory location repetitively over and over until it changed. Some games spent large portions of their runtime in a tight loop checking for the Sprite 0 Hit. Since, from the program’s perspective, the signal might come at any time, the loop needed to be tight, meaning the game couldn’t spend that time doing other work or else it might be delayed in responding to the extremely time-sensitive signal.

The MMC3 mapper had a special function though that could time out when a programmable scanline was reached, and send the processor an interrupt request at that time, greatly freeing up the processor for doing other things with that time. But not all programmers understood the best way to use it, which is why Mega Man 3 has some scanline glitching in a couple of very visible places, in the pause window and on the level select screen.

Displaced Gamers’ Behind the Code series, which we’ve linked to multiple times in the past, has done an exposé looking into how Mega Man III’s glitches happen (28 minutes), and even wrote some code that erases all trace of them. As usual for Behind the Code, the explanation is fairly technical, especially of the fix, but the first half of it is fairly comprehensible. No one says you have to watch the whole thing. Or, indeed, any of it, but I always enjoy them!

Behind the Code: Why Does Nintendo’s Tetris Crash At Extremely High Levels?

Displaced Gamers’ excellent Being The Code series on Youtube looks into what causes Nintendo’s NES Tetris to crash at really really high levels, over level 150. In the process, it goes through how that game displays and adds scores together. Have a look (22 minutes)!

More From Displaced Gamers on Dr. Jekyll and Mr Hyde

We presented Displaced Gamers’/Behind the Code’s video on the jankiness of kusoge disgrace Dr. Jekyll and Mr. Hyde back on Saturday. They did another video on that game, that delves into why the game’s frame rate is so inconsistent. In summary, its engine throttles its framerate in a terrible way, using long delay loops. It’s a pretty awful idea! It’s 19 1/2 minutes long. The video claims it’s even geekier than their first video on the game, but I think it’s actually slightly less technical, at least it doesn’t fill the screen with as much 6502 assembly code.

Another fact about J&H: the Japanese version had two full levels that were cut from the U.S. version, which replaced them with replays of other levels. It made a bad game even worse!

Now, because of Behind The Code, you know more about the Dr. Jekyll and Mr. Hyde game than many much better NES titles. Congratulations!

Behind the Code: Dr Jekyll and Mr. Hyde

For some reason there’s been a lot of Youtube videos lately that fit our eclectic purview, so here’s a code-heavy dive into infamous NES disasterpiece Dr. Jekyll and Mr. Hyde.

It’s 19 minutes long, and is even geekier than is usual for us, going into a disassembly of the game’s machine code in its quest to make the game marginally less awful.

As long as we’re on the topic, here’s Jeremy Parish’s NES Works episode on Dr. J & Hyde, which is also 19 minutes, and also covers the somewhat better (but not hugely so) game Amagon:

While we’re on the subject, did you know that Jekyll & Hyde has a secret ending? Both endings are shown here (4 minutes):

The “bad” ending is the normal one, and shorter, but is arguably a happier conclusion to the story. To get it, all you have to do is get to the end of Stage 6 with Jekyll. That’s all.

To get the other ending, get to Stage 6 with Jekyll, then turn into Hyde and get to the end of his version of the stage. Usually, if Hyde gets as far into his level as Jekyll has gotten into his, he’s struck by lightning and dies. But in this level he’ll be allowed to reach the end of his version of the level for some reason, where there’s a boss! Beat it, and when you return to Jekyll’s world the enemies will be gone, and he’ll be free to finish the level without harassment. However, ending events will be different….

More on the Terribleness of NES Strider’s Programming

A while ago Displaced Gamers, as part of their great Behind The Code series, did a video about how awful NES Strider’s sprite updating was. Arcade Strider was huge hit and outright masterpiece, a great arcade platformer released right before fighting games took over game rooms around the world, but NES Strider was a wretched thing, full of big ideas but with code woefully unable to live up to them. Imagine a puppy trying to do your taxes. It might put up an adorable effort, but it’s just not going to get the job done.

We linked to their last video examining its malformed construction. Well, Strider is the well of crap that keeps on gushing, and so Displaced Gamers has another video on the subject of the flaws in its programming, this time about its player physics. Walking into walls causes Strider Hiryu to shudder in place; jumping beneath a low ceiling causes him to bump his head repeatedly as his jump continues even though there’s no room to ascent; and his infamous “triangle” wall jump is so wonky that it literally requires a frame-perfect input to pull off, and not even the right frame. You have to jump the frame before you contact the wall!

Here is the new video, which explicates the entire cruddy system. It goes into exquisite/excruciating detail, including tracing the code and examining Hiryu’s X and Y coordinates on a frame-by-frame basis. It’s the kind of deep geekery that I just know you love/hate! Enjoy/despair!

The Physics Nightmare and Bizarre Jumping of Strider (NES) – Behind The Code (19 minutes)

Behind the Code: About the NES’ Sprite Capabilities

Displaced GamersBehind the Code series doesn’t get new videos often, but they’re always great. This one is more technical than usual, but I don’t think it’s really all that technical. It’s about how the NES processes and renders its sprites, particularly explains why there’s a eight sprite per scanline limit, and even reveals a couple of games that use that limit to produce special effects!

The gist: while each scanline is being prepared for display, the NES’ PPU looks through the entries for the machine’s 64 hardware sprites in order, finds the first eight that will display on the current line, and copies their attribute data to a small area of internal RAM. There is only space there for eight sprites, so, the NES cannot display more than eight sprites in a single scan line. Any later sprites in the primary attribute data won’t have room to be copied, and so the PPU won’t be able to display them.

One thing it notably doesn’t cover, however, is how games implement priority shuffling to cause sprites to flicker instead of not display at all. The video suggests that that might be coming in a future video….

NES Sprites, OAM, and the Battle for Priority – Behind the Code (Youtube, 19 minutes)

The Issues With NES Teenage Mutant Ninja Turtles

The title refers to the original NES TMNT, not the arcade version or the NES game based on it. This is the version that Konami released under their Ultra label. It sold well (real well!) but is widely considered an inferior game for a number of reasons. Those reasons are the subject of these three videos, from Youtube channel Displaced Gamers. I recommend them, even if I think every place they say gamer it would be more proper to say player.

The first video:

In a long and difficult game, one of the hardest sections comes relatively early. The only swimming section in the entire game, players must maneuver their supposedly-aquatic surrogates through a difficult course that has imprecise movement, water currents, high damage, instant kill hazards, a strict time limit, and, as the video shows, buggy implementation. Many players in the NES era gave up at this point, which is rather a shame considering it’s only at the end of level two. This video examines the code and demonstrates why it’s so challenging, and how it could be made fairer.

The second video:

TMNT has notoriously floaty jumps, a low frame rate, and a fairly weird implementation of gravity. Any platform game that allows players to adjust their jump height according to how long the hold down the jump button is fudging its physics behind the scenes, but TMNT does it rather poorly.

The third video:

Displaced Gamers examines additional problems with the game’s timing, particular with that of its input reading and attack animation. Like the other two videos, they suggest code changes (sometimes in the form of Game Genie codes) that fix the problem, if you happen to have a fondness for 6502 assembly. (I do!)

If you’d like to try NES Teenage Mutant Turtles, it’s included in the “Cowabunga Collection” that was released for Switch, Xbox X/S and Playstations 4 and 5. Fortunately, it also includes twelve much more playable titles.