Reverse Engineering the 6502

This is a 52-minute talk from 2010, from the 27th Chaos Communication Congress in Berlin, Germany (the talk is in English), presented by Michael Steil of Visual 6502, which successfully reverse engineered the venerable 6502 microprocessor, a chip used, in one capacity or another, in one form, or another, in all the Apple, Commodore and Atari microcomputers, the BBC Micro, the Atari 5200, in a modified from the Atari 2600 the NES, and countless arcade games, as well as in other places.

The talk is intended for a technical audience… literally. When the speaker asks who in the audience has coded in assembly before, practically everyone raises their hands. It’s recognized that we at Set Side B veer wildly between the most surface-level populist material and in-depth treatments for those with gigantic capacities for technical discussion and the attention span of a Galapagos Giant Tortoise. We like to think this is charming, and will listen eagerly if you tell us that you agree.

Anyway, here is that talk. I already mentioned that it’s 53 minutes. If that’s too long, there’s a speed-up function on Youtube. If that’s too technical, well, I don’t know how to help there. Maybe a read through pagetable.com’s documentation on the 6502. Oops! I’ve made it worse, haven’t I. Well, if you like, you might console yourself that the 6502 is really a simple processor to learn to code in. I’ve done it myself! There’s no memory management, there’s only three general-purpose registers, the stack is fixed in place, and all opcodes are one byte. It’s so simple that an extremely motivated child could learn it. Guess how I know?

27c3: Reverse Engineering the MOS 6502 CPU (Youtube, 53 minutes)

Here’s a description of the talk from the conference web site.

Hardcore Gaming 101 Covers Snake’s Revenge

Hardcore Gaming 101 is one of the most important game history sites on the internet, and site creator Kurt Kalata writes on a wide variety of games for consoles and computers alike. Recently they’ve been on a Metal Gear kick, and that means covering the black sheep of the series, Snake’s Revenge.

Snake’s Revenge is the forgotten Metal Gear game, an NES sequel made without Hideo Kojima input, to the NES port of Metal Gear that he also had nothing to do with. It has a reputation for being terrible, but that’s really unmerited. As Kurt Kalata notes, while it has its flaws, is ignored by later Metal Gear games, and it has a story based on the manual scenario for Metal Gear written by Konami’s crazy American writing staff*, it’s technically proficient and has good music.

Yep, it’s the Metal Gear with side-view segments.

You can, and should read it for yourself, here.

* The American manual for NES Life Force says that the evil planet-eating monster Zelos was the proud progeny of “Ma and Pa Deltoid.” In the description of Dracula’s Heart in the manual for Castlevania II, it warns: “Careful! The heart attacks.” These were not means isolated occurrences from Konami’s US staff.

Sharopolis Looks Into NES Technical Feats

Youtuber Sharopolis has a 20-minute video up examining several specific NES games and how some unexpected tricks were pulled off in each: Rescue: The Embassy Mission, Crash and the Boys Street Challenge, Castlevania III and Jurassic Park. I love learning about how developers overcame hardware limitations, and if you’re reading this, I’d wager there’s a good chance you do too!

Sundry Sunday: Gyruss Themes

Sundry Sunday is our weekly feature of fun gaming culture finds and videos, from across the years and even decades.

While there are examples of excellent music from the classic era of arcades (Frogger comes immediately to mind), I don’t think there is much that can equal that of Gyruss’ arrangement of Bach’s Tocatta and Fugue in D Minor. Here it is, isolated from the rest of the game’s soundtrack, from Youtube uploader StyleK226 (1 1/2 minues):

Wikipedia tells us that the arcade arrangement is reminiscent of a version of the song from the British band Sky, titled just “Toccata” (4 1/2 minutes):

If you only know Gyruss from the NES port, you might be surprised that it’s an almost entirely different arrangement from the arcade version! Maybe it was changed because of the similarity to Sky’s version. Some people prefer that one, it’s got a bit more variety, although I think the arcade’s is a bit better. Judge for yourself (3 minutes):

The Toccata is only used for the intro and the first warp on each planet, which is a bit of a shame, the rest of the music isn’t bad, but it’s not Bach. In Japan, Gyruss was a Famicom Disk System game. The FDS had extra sound hardware, and the result is an upgraded version of the NES soundtrack (14 minutes in all):

There’s been a number of fan versions of the Gyruss soundtrack, although most of them seem to be inspired by the NES port rather than the arcade original. Here’s a metal medley of that particular musical mutation (3 minutes):

As commenter @Fordi says, “What I love is that Intro / Stage 1 is a genre cover (metal) of a game’s adaptation (Gyruss) of a genre cover (Sky – Toccata) of classical music (Toccata and Fugue in Dm).”

Chrontendo 64

Dr. Sparkle is back with the 64th installment (Youtube, 55 minutes) of his quest to review every NES and Famicom game. He’s pretty far in! In about ten episodes, he figures he’ll reach the launch of the Super Famicom, which won’t be the end of his journey but will probably mean he’s in the home stretch.

In the meantime, ten games from 1990 are in this episode. They are:

Puss ‘n’ Boots: Pero’s Great Adventure – Technically a retread of a previously-covered Japanese game, this version has substantial differences so Dr. Sparkle decided to cover its U.S. version separately. A very easy game until the last stage where it jumps in difficulty, and then the final boss is absurdly hard. Dr. S expresses confusion why a game made to be so easy that it’s obviously intended for young children would become nearly impossible right at the last second. Personally, I suspect it was done because NES game publishers were terrified of the game rental market.

Wit’s: A Japan-only release, this is basically a de-luxe version of Snake, where your enemies have special abilities that you have to account for. Suprisingly, it’s an arcade port!

Captain Tsubasa Vol. II: Super Striker: A weird RPG take on Soccer, published by Tecmo and based on a manga and anime series. Instead of controlling a player or players completely in real time, the action pauses frequently and asks you what to do. The main screen is mostly animations down on the soccer field. It’s a unique take on soccer, but it’s not the only one: this is the second game to play like this on the Famicom. The Captain Tsubasa game series continues even today: the most recent releases, Dr. Sparkle tells us, are on PS4 and Nintendo Switch, although I don’t know if they take the menu-based RPG approach.

Jyuouki: This is simply a licensed Famicom port of Sega’s Altered Beast, and a pretty bad one at that.

Mahjong G-Men: Nichibutsu Mahjong III: Yet another Mahjong game, although with some interesting features, if you’re into Mahjong. That’s not Mahjong Solitaire, a.k.a. Shanghai, the Activision (and formerly PLATO) computer game where you remove tiles in matching pairs from a tableaux, but the Chinese Rummy-like game using tiles instead of cards. It also has a weird Tetris-like subgame involving Mahjong tiles.

The Pennant League: Home Run Nighter ’90: Yet another Famicom baseball game.

Dr. Mario: The classic Nintendo puzzle game! I always thought it was a bit inferior to Tetris, but then most games are, and that didn’t stop me from playing a ton of it long ago.

Pictionary: Based on the board game, and coming from infamous American NES publisher LJN. Dr. Sparkle is a bit harsh on developer Software Creations, but I think this effort looks pretty well-made to me. It’s not a classic, and it’s actually not really so much Pictionary as a kind of variation on the theme, where players play mini-games to reveal parts of a drawing and then try to guess what the drawing is of. It looks much like one of Rare’s many game show and board game adaptations and creations, and in fact if it weren’t for the Software Creations credit I’d have assumed that Rare made it.

Bigfoot: From Acclaim and developed by Beam Software. It’s fairly well polished for a Beam Software title, but has some weird ideas to it, including a weird control scheme for the events that involves tapping left and right on the control pad. I think the idea has a bit of merit, but that it was probably the wrong place to use it. A Bigfoot game would mostly be bought or given to kids, who would be the absolute last demographic you should expect to master a non-standard control scheme. I’m not one of those people who thinks making a game that goes about its play differently than most other games is always a terrible idea (see: most of what I’ve ever written about roguelikes), and I can kind of see why they did it, trying to make a race game that’s more than just holding to the right. It probably could have used a bit more iteration though.

Snake Rattle ‘n’ Roll: A game from Rare that they actually put a lot of effort into, and it shows. And some people really like it, it’s definitely got a cult following. Dr. S isn’t part of it, due to the difficulty of getting used to SRnR’s isometric style. I think what happened was, they had these routines laying around that they used in implementing NES Marble Madness, and decided to do another game that controlled in that kind of way. I think the game was poorly suited to a digital control pad; if it were controlled with an analog stick, or at least a digital control where diagonal movement is easier, I think it’s possible that some people who hate Snake Rattle ‘n’ Roll might be able to enjoy it better.

Anyway, here is the whole episode, start to finish:

A Guided Tour of the NES

This tab has been open on my browser for literally months, so I’m finally excising it from the bar….

A while back the site HackADay did a teardown of the NES, going through how to take it apart and reassemble it, and going through some of the elements of its assembly. It doesn’t go into a lot of detail, but that lets it be fairly short, at only nine minutes.

NES Hardware Explained (HackADay post, Youtube video)

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….

Mega Man’s Score System

Looks like we’re on another Youtube binge, ayup ayup. This time it’s another hopeful video constructor asking us to consider the oddity of the score system in the original Mega Man (a.k.a. Rockman).

When you post as many Youtube videos as I do, it’s easy to form opinions about their style. That of “TheRetroDude,” as he styles himself, is interesting, it’s still hyper-edited in the way that so many Youtubers loathsomely adopt, but it’s not nearly as distracting as those. He keeps the volume down, as well as the number of swoopy objects tearing around the screen like a toddler newly introduced to Toblerone.

He has good points about how extraneous the game’s scoring system is too, although his misgivings could be laid against many other games. In Super Mario Bros, score is mostly a spacer before toppled turtles start giving extra lives. I think that score isn’t a bad addition to a game as long as it’s implemented thoughtfully, yet for too long it hasn’t been. Even in the NES days it was included to give players a short term goal to aim for, when they didn’t really need it.

What would a good scoring system look like, one that rewarded skill? Well–

  • Losing a life would reset score to that at the last passed checkpoint, eliminating point pressing from lives.
  • Extra lives at game end would be worth a bonus each.
  • Game timers are worth a small, yet substantial, award at level end, to prioritize fast play over slow.
  • Awards should be given for score, most typically extra lives, but others are possible too.
  • Replaying levels, and other means of “minting points,” earning arbitrary scores, should be ruthlessly eliminated. If the player can replay levels indefinitely then think about if your game really needs a score, and if it does, don’t allow players to earn more points from replaying them without costing them the points from that last pass.

Two games that come to mind that do scores well are:

  • ZANAC on the NES, being a scrolling shooter without checkpointing score is generally fair, although it is possible to warp backwards does break the no-replay rule, and
  • Star Fox 64, which only adds a level’s score to the player’s total at its end. SF64 is a game obviously designed around score attacks.

Where was I? Oh! Here is that video about Mega Man’s scoring system.

Mega Man 1’s Really Weird Score System (Youtube, 9 minutes)

Sundry Sunday: From AGDQ, A Dog Replaces R.O.B. in Gyromite

Sundry Sunday is our weekly feature of fun gaming culture finds and videos, from across the years and even decades.

This week’s fun video isn’t decades old, in fact it’s from just a few days ago, from AGDQ.

The NES title Gyromite, a.k.a. Robot Gyro, is a very interesting game from a design standpoint, possibly more interesting than it is to actually play (although I think its music is very catchy). It’s never been rereleased by Nintendo, for the probable reason that it relies on the accessory R.O.B. to play.

R.O.B: It’s not just that funky Smash Bros. character! (Image from Wikipedia, taken by Evan-Amos.)

R.O.B. was a motorized accessory that activated servos in its arms depending on light signals sent to it from the screen. No cords went from R.O.B. to the NES. It used photoreceptors in its “eyes” to detect the screen signals, which were ultimately caused by player input on the controller. A fairly roundabout means of control, honestly.

Only two official R.O.B. games were made, and Gyromite (Going by its Japanese name “Robot Gyro” according to the title screen) used the “gyro” accessory for play. A platform is placed in front of R.O.B., on which you place the controller for Player 2.

On the controller is a device that spins the “gyros,” colored weighted tops. By manipulating the arms with action on Player 1’s controller, making them swing around and opening and closing the claws at the right time, you can cause R.O.B. to lift the spinning gyros from their platform, then set them down on the NES controller’s buttons. In the game, this caused colored pillars to rise or fall according to the control signals.

R.O.B. with gyro setup. Image from the blog Nerdly Pleasures.

While manipulating all of this, you also have to watch out for the action of the game itself. Gyromite is a simple platformer, but one without a jump button. The difficulty comes from having to essentially play two games at once, the platforming on screen and manipulating R.O.B. to position pillars in the right places in space and time.

R.O.B.’s motions are not simple to command either. It takes time for the arms to pivot between their destinations, time that must be accounted for in the on-screen action, and while the tops spin for quite a while they will eventually have to be collected and set back on their pedestals so they can be spun back up to full speed, or else they’ll topple over on the button. This doesn’t produce a failure state in the game. It’s just left to you to pick the top up yourself and put it back on its stand to be spun again. R.O.B. isn’t capable of such feats of dexterity.

There’s a lot more to say about R.O.B., and how it was mostly distributed as part of the Nintendo Entertainment System’s “Deluxe Set” in the U.S., the more expensive version that didn’t come with Super Mario Bros. Instead of that, let’s talk about how, due to the fact that R.O.B. is just a fancy-shmancy way to press controller buttons, that you can replace it entirely with some other mechanism, or indeed, even animal.

That’s what happened Wednesday at AGDQ, where Peanut Butter the Dog, with coaching from JSR_, left R.O.B. gathering dust in the closet as they played through Gyromite Game B.

They didn’t make it all the way without running out of lives, but they picked back up and kept going. And that doesn’t detract at all from Peanut Butter’s skills, or amazing doggy focus. They are intent on reading those hand signals and getting those tasty treats. So while they didn’t earn a world record, for “Dog playing Gyromite Game B,” their accomplishment is of definite note.

There are around four minutes of introductions at the start of the video, so if you want to jump right in to the run, begin here.

Gyromite by Peanut Butter the Dog & JSR_ in 26:24 – Awesome Games Done Quick 2024 (Youtube, 33 minutes)

The 10th-Key NES Pac-Man Scatter Bug

I already shown it off on Mastodon, but I’m so pleased with getting this bug on video that I’m re-reporting it here! First, though, some background.

Still the definitive resource on the design internals of Pac-Man.

I’ve been looking into the various home computer ports of Pac-Man lately. One of the better ones is the one for Famicom/NES, probably because it was made in-house at Namco, which I presume because while it’s by no means perfect, it has ghost AI that much more closely matches Jamey Pittman’s definitive Pac-Man Dossier than the others. This is a bit more important than the other ports because, due to the relative familiarity (that is to say, inexpensiveness) of NES emulation at this point, Famicom Pac-Man is often put in compilations, especially in dedicated consoles, instead of the arcade game. In point of fact, the Namco Museum Archives Vol. 1 that’s available for various consoles uses the Famicom versions of all its games, not the arcade, and Pac-Man is one of the included games. To tell the difference: if the score, fruit tally and lives are to the right of the screen, instead of above and beneath it, and Pac-Man looks a little too big to fit in a maze passage, then what you have is an inferior home conversion.

How is it different? Well:

  • The sound of Pac-Man eating dots is much worse, for starters, it never fails to bother me.
  • More substantively, the ghosts have slightly different constants in their chase routines: it’s slightly harder to fake out the Pink ghost (Speedy/Pinky), and the Orange ghost (Pokey/Clyde) gives up the chase a little more reluctantly.
  • The timing for scatter periods, relative the speeds of the ghosts, is a little off. Scatter periods are usually slightly longer.
  • The speed of the game as difficulty increases is also a little off. In the arcade, the First Apple board (Level 5) marks a noticable increase in Pac-Man’s speed, but it seems to happen around the Second Orange (Level 4) on Famicom. Yes, that’s how much of arcade Pac-Man and its port that I’ve played-it could be subjective, but maybe it’s not.
  • The bug that affects Pink’s and Blue’s (Bashful/Inky) AI when Pac-Man’s facing up doesn’t exist here.
  • When ghosts enter Scatter mode, they don’t reverse direction. This makes the game easier (one less sudden reverse to throw you off) and harder (no obvious indication that the ghosts are scattering, and one less thing to throw them off from immediate pursuit).
  • As the game advances in difficulty, in the arcade, on the 4th Key board (level 17), the ghosts won’t turn blue and vulnerable when you eat an Energizer, and instead will just reverse direction. And from the 6th Key (level 19) on, the ghosts will never turn blue again! NES Pac-Man instead gives them a very tiny bit of blue time, about a half-second’s worth. It never reaches a state where the ghosts become completely invulnerable.

And at last, the bug which I have confirmed. On the 10th Key board (Level 22), and every level thereafter, the ghosts will start out in an unusually long Scatter period. Their usual habit is to emerge from the box in the center of the screen and move to a corner of the screen, and circle there for a few seconds. Pink goes to the upper-left, Red (Shadow/Blinky) to the upper-right, Orange to the lower-left, and Blue to the lower-right. This period is called a “Scatter Mode” in the Pac-Man Dossier.

In most levels, presuming you don’t lose a life, the ghosts will enter Scatter Mode at exactly set three times: from the start, about 25-or-so seconds in, and about 30 or so seconds after that. These periods are usually five seconds long. There are some minor details I won’t get into-you can read the Dossier for those. These periods are lifesavers for intermediate Pac-Man players playing without patterns, as they are the only really safe ways to access the bottom passages of the board without getting trapped or wasting an Energizer.

Each Scatter Mode is only supposed to last five-to-seven seconds, but on Level 22 and after, all of the Scatter Modes last around 20 seconds. Here is the bug in action, demonstrated in Namco Museum Archives Vol. 1:

Why would this board be different from the others? In the arcade, the 9th Key (Level 21) is the maximum difficulty the game reaches. Any pattern that works on the 9th Key level will work for the rest of the game, all the way up to the kill screen on Level 256. It seems that, on the Famicom/NES version, after that level the game may not have data for the level to follow? But I haven’t looked at its code to know for sure. Maybe I should make that a future project.

NES and Commodore 64 Games Compared

Greg’s Game Room on Youtube looked at 28 games with both NES and Commodore 64 versions. It’s not by any means all of them, but a good selection. Usually its the NES version that’s better, but there are some surprising upsets, especially if the game originated on a microcomputer platform.

The Commodore games that won out are Ballblazer, Castelian, Die Hard (but the C64 version’s really different), Ghostbusters, Ghosts ‘n’ Goblins, Q*Bert and (surprisingly) Smash T.V. Decent C64 games that nevertheless lost are Blades of Steel, Commando, Donkey Kong, Mighty Bomb Jack and Super Mario Bros. (rated were both the similar Great Giana Sisters and the recent fanmade version of SMB that uses advanced scrolling tricks). Gyruss, Mario Bros. and Pac-Man were rated at a tie.

Nintendo vs Commodore 64, 28 Games Compared (Youtube, 46 minutes)