"Super Mario Bros. 64"
April 20, 2019 2:35 AM   Subscribe

After seven years of work, a reasonably accurate port of Super Mario Bros. has been made for the Commodore 64. YouTube.
posted by JHarris (30 comments total) 15 users marked this as a favorite
This is a much greater technical feat than it may seem at first. The Commodore 64 was fundamentally ill-suited to scrolling platform games. The VIC-II chip, while not bad at what it was designed to do, had functionally only a single column's worth of scroll buffer, which the NES had one the size of the whole screen. This forced the system to use tricks like keeping a duplicate screen in memory to do scrolling -- and color memory was not relocatable, so the same trick couldn't be used for color data.

A trick was discovered a while ago that allowed the C64 to position the screen horizontally with a lot more flexibility, but at an unusual cost: the VIC-II chip is also in charge of refreshing RAM, and so monkeying with the chip's timing in just the wrong way could actually cause memory to become inconsistent! C64 SMB uses this trick, which is not known to work reliably on all C64s, to handle screen scrolling.

That's not all. The C64's legendary SID chip, while very capable, is fundamentally different from the NES' audio chip. Yet the music in the port sounds amazingly close to the original! The port also supports several different kinds of hardware enhancement, from running it with an add-on board to running it on a C128 to running it with two SID chips to running it in an emulator.

Famously, the C64 game The Great Giana Sisters was originally developed as a port of Super Mario Bros., and yet I doubt its prototype version was anywhere near this close to the original game.
posted by JHarris at 2:44 AM on April 20 [24 favorites]

The Commodore 64 was fundamentally ill-suited to scrolling platform games.

I had a bunch of side scrolling games for my C=64, the only name that immediately springs to mind is Snokie, but there were a lot more. I guess people were doing something extra hard on the machine way back when, but as a then-gamer, I never noticed. A lot of games went sideways, though.
posted by hippybear at 3:07 AM on April 20 [2 favorites]

Good work, team! Now let's port Mario 64 to the C64. Should be a snap, no?
posted by duffell at 3:09 AM on April 20 [1 favorite]

Ah, Snokie! I remember the frustration when you got a jump wrong by a pixel or two and had to watch that clumsy bird slide towards its inevitable doom.

I guess there must be something specific about Super Mario Bros' graphics that makes them difficult to reproduce accurately on the C64, because there were some really impressive-looking side-scrollers back then, e.g.: Armalyte, X-Out. I wonder what was so tricky?
posted by A Thousand Baited Hooks at 4:00 AM on April 20

I imagine Nintendo’s lawyers will nuke this from orbit shortly (suing for millions in punitive damages, with the settlement involving the certified destruction of all copies, source code and devices used in its development, or similar).
posted by acb at 4:02 AM on April 20 [1 favorite]

I'm floored by the original music coming through. I wouldn't have known this was played through a SID chip, if I wasn't told this was running on a C64.
posted by They sucked his brains out! at 4:28 AM on April 20 [2 favorites]

One of the links specifically talks about how it has an option to use two SID chips, so they might be cheating a tiny bit with twice as many voices as one would normally expect.
posted by hippybear at 4:33 AM on April 20

Also, does the download site show pro-Brexit gammon protests as its background photo to everyone?
posted by acb at 4:37 AM on April 20

Um, I'm not entirely sure which page you're talking about, but I didn't see any of that.
posted by hippybear at 4:43 AM on April 20 [1 favorite]

 The Commodore 64 was fundamentally ill-suited to scrolling platform games.

You should have seen its peers. Trying to scroll on a ZX Spectrum (no graphics hardware) or Amstrad CPC was painful.
posted by scruss at 5:42 AM on April 20 [2 favorites]

Pretty sure I used to play a version of the Great Giani Sisters where the sprites were modified to be Mario. The first level was near identical but then it began to drift. Arguably that was the pinnacle of side scrollers on the C64 at the time.
posted by furtive at 5:47 AM on April 20 [1 favorite]

One of the links specifically talks about how it has an option to use two SID chips, so they might be cheating a tiny bit with twice as many voices as one would normally expect.
In the video, the reviewer says he only has one SID, so the 2-SID option is turned off in the demo.

Interesting from the Forum post:
- This port emulates 4 channels of the NES APU (audio processing unit): 2 pulse channels, 1 triangle channel and 1 noise channel. The SID-chip has 3 voices, so this is handled by sharing 1 SID-voice for the triangle and noise channel.
- If a second SID-chip is configured, the program will instead dedicate 2 APU-channels to each SID-chip.
posted by MtDewd at 6:19 AM on April 20 [2 favorites]

The NES made scrolling easy-peasy, as long as you were going in one dominant direction like Super Mario. Some games like Metroid could switch directions, but only on a screen boundary. Later games like Gauntlet added extra screen RAM on the cartridge to do true omnidirectional scrolling.

Splitting the screen for a status bar is tricky, though, and some games just punted and used sprites for the scoreboard.
posted by RobotVoodooPower at 7:20 AM on April 20 [1 favorite]

God, as a kid who had an "educational" c64 but was not allowed a nintendo, I would have killed for this...
posted by ominous_paws at 7:23 AM on April 20 [4 favorites]

Some more details on VSP, the side-scrolling technique they use: Safe VSP, VSP-Fix, Why can't I understand VSP?, Variable Screen Placement: The VIC-II’s Forbidden Technique. I guess it was a well known hack on the C64 from the demo scene, but then also.. problematic since it did not work reliably.

From what I read it's a two-pronged hack. The desireable hack is you can alter some of the memory mapping just when the VIC is reading RAM to draw the screen, so that it draws from another part of RAM instead. That lets you do fast scrolling without having to copy data, it's more like a funky kind of unintended memory mapping. The problem is that as you hack around with the memory mapping it can also cause some other memory to be corrupted. The "Safe VSP" technique is either avoiding the corrupted RAM entirely or else have a good copy of the data that's in the corrupted RAM area and copy it in occasionally when needed.

The fun part about all this is it relies on microsecond timing so things like temperature and very specific details of how the motherboard traces are laid out can effect how reliable VSP is. What a hack.
posted by Nelson at 7:29 AM on April 20 [3 favorites]

Previously on Metafilter: Super Mario Bros. on the Atari VCS. Here's a more recent video of it. Shockingly, changing the name to "Princess Rescue" did not stop Nintendo from trying to destroy the game.
posted by Ampersand692 at 7:32 AM on April 20 [1 favorite]

Splitting the screen for a status bar is tricky, though, and some games just punted and used sprites for the scoreboard.

The Nintendo didn't have raster interrupts (i.e,, the means to set up an interrupt handler to be called when the raster beam reaches a specific scanline)? Those were essentially the C64's bread and butter.
posted by acb at 8:44 AM on April 20 [3 favorites]

Early carts didn't have raster interrupts, those came later with more sophisticated mappers. But you don't need interrupts for a split, you could do a sprite zero hit. The NES can detect a collision between the 0th sprite and the background, so you can wait for that flag and then immediately change scroll registers. The drawback is that you have to spin CPU cycles waiting for the flag, so interrupts let you do multiple splits without waiting.
posted by RobotVoodooPower at 9:04 AM on April 20 [2 favorites]

I stand by my statement about it's suitability to scrolling platform games, they're possible but require a lot of work and processor time that's simply not necessary on the NES. I'm very familiar with the C64's scrolling abilities. And yes I know the Spectrum is even worse, with no hardware scrolling support at all.

What else, besides scrolling and sound, is tricky for the C64 to reproduce from Super Mario Bros.? In particular, the VIC-II chip was only built to produce 16 colors compared to the NES' 56, its use of those colors was a lot less flexible, its processor was both clocked to a much lower speed and had to give up a portion of its time to allow the VIC-II to access system RAM, and hardware sprite support, without 2600-style raster-based repositioning, was limited to 8 large sprites, as opposed to the NES' 64 smaller ones. This may actually be better on the C64: the system doesn't flicker sprites if too many are on the same scanline, and large characters like Super Mario could be displayed with one (or more for extra colors) sprites instead of 8.
posted by JHarris at 10:20 AM on April 20 [2 favorites]

The NES made scrolling easy-peasy, as long as you were going in one dominant direction like Super Mario. Some games like Metroid could switch directions, but only on a screen boundary. Later games like Gauntlet added extra screen RAM on the cartridge to do true omnidirectional scrolling.

To my knowledge, two-directional scrolling wasn't hard if the game's implementation allowed for it. The NES by default has enough PPU RAM to hold two screens' worth of tiles, and the game can decide where the visible screen is within that. (For contrast, the C64 [when not using the VSP hack] let the programmer shorted the width of the screen from 25 columns to 24, and decide which of 8 pixel positions the text map would hold within that) Carts could supply more memory to scroll up to four screens' worth. This is kind of wasteful if you think about it, though: instead of including this hardware in the console where all games could access it, each cart had to supply extra hardware for use by that game alone. This may be regarded as a design flaw, especially when one remembers Nintendo having problems with "chip shortages" back when the NES was in production and cart games were selling extremely well. They weren't talking about mask ROM chips, they were more likely talking about the special mappers and extra RAM needed to make all those individual chips for advanced games.

The other issue with multi-directional scrolling has more to do with customary implementation on the NES. Few games stored their levels in ROM as a pure tilemap, it would have taken a prohibitively large amount of space. Instead a variety of tricks were used, as a form of data compression, to fit in more levels. Of course SMB outright reused a lot of level maps, but more than that is that things like the clouds and bushes, background elements, and giant trees and mushrooms in some levels were stored as entities consuming just a few bytes, that the level drawing routine would take care of the details of constructing in screen RAM. Other elements were in fact stored as pointers to a limited number of vertical stripes of tiles, and even things like the contents of Question Mark Blocks were partly determined by their X position within the level.

That works for Super Mario Bros. because, with its one-way scrolling, the level drawing routine never has to "rewind" through its processing, and can just draw new tiles ahead of the screen instead of possibly behind it as well. Metroid's compression system uses an entirely different system, one that has to do with the placement of multi-tile entities, better suited for dual scrolling.
posted by JHarris at 10:39 AM on April 20 [1 favorite]

BTW Brad Smith has a great post on NES scrolling, with examples. (The whole series is pretty great.)

Yeah, the RAM shortage of 1988 that delayed the Zelda sequel was due to a lack of static RAM, which was put on the cart for save games and for tile patterns. I've got to imagine it affected NES production too, since it included 4 KB of SRAM.

It probably made sense at the time the NES was being designed, because Nintendo was already worried about hardware shortages due to PC manufacturers gobbling up all the inventory -- which is one reason they went with Ricoh and a custom 6502.
posted by RobotVoodooPower at 11:32 AM on April 20 [2 favorites]

I'm sure there's a technical reason for the use of this VSP scroll, but it can't be speed, look at Mayhem In Monsterland, for example.
posted by GallonOfAlan at 12:26 PM on April 20

1. What we might perceive as fast often has no bearing on what a computer system would have trouble doing. The VSP trick does indeed substantially reduce the work the processor must do in updating the character layer of the screen by a great deal, though, weirdly, at the cost of a little RAM consistency, which is a huge price to pay.
2. Did you watch through to Level 2? The speed gets up quite fast there!
posted by JHarris at 2:13 PM on April 20 [1 favorite]

This is really amazing, will definitely pass around to similarly-appreciative friends during human hours tomorrow. I feel like I've seen SMB's World 1-1 recreated a lot on different platforms as a sort of proof-of-concept cross between "Hello, World!" and Doom, but the effort taken to recreate the whole damn game on a Commodore absolutely deserves saluting.

I love stuff like this, especially the love for the many 8-bit microcomputers of the '80s. I remain convinced that there must be many essentially-forgotten classics originally released in miniscule numbers for Dragon32s, Enterprise 128s, Orics and the like (not really relevant, but last night I had a dream all about writing an Atari 2600 emu for the ZX Spectrum and woke up to the disappointment of all the idea's impracticalities and impossibilities as a first proper retro project).

I've gone off on a bunch of tangents. This is really cool. Good conversions were and are Hard, and this is Cool.
posted by I'm always feeling, Blue at 8:04 PM on April 20 [1 favorite]

(No luck downloading, going by the YT video, sigh!)
posted by I'm always feeling, Blue at 8:10 PM on April 20

Oh, this is so good. As a kid who had a C64 because my parents considered it educational, but wasn't allowed a Nintendo, I had no idea WHY there wasn't a readily available port of Mario for my machine, but I certainly knew there wasn't... and wound up playing through a lot of terrible knock-offs, imitators, and badly programmed attempts at similar. Not any of the games mentioned upthread-- I'm talking about the sort of game you used to get in a send-a-random-fifty-games-on-diskette-to-a-penpal-and-get-back-fifty-more swap, possibly untitled, generally buggy as hell, and with the occasional gem among the debris. (I still fondly recall Krakout, which was decent as a block-destroying pinball game but had the catchiest damn music I ever encountered on the C64.)

So Mario actually being on the C64 soothes something aggravated in my memories of teenage gaming.
posted by Rush-That-Speaks at 8:29 PM on April 20 [4 favorites]

Is the lack of scrolling capability the reason that Giana Sisters looks so much worse than Mario Brothers? Obviously it’s a shameless knockoff, but in watching the gameplay I’m struck by how little else there seems to be to it, whereas SMB suggested a wider world.
posted by Countess Elena at 8:33 PM on April 20 [1 favorite]

Gamasutra article on the takedown. It's worth noting that it's not a "cease and desist" sent to Zeropaige this time, but notices sent to the file hosts, possibly as an attempt to keep this under the radar.

Once again, if you care about this kind of thing, make it a voting issue. Not, you know, to the extent of voting for Trump or anything crazy, but be cognizant of it. Ask questions of your representatives about it. It's easy to look at this and go "LOL geeks suing geeks," but this is part of why we can't have nice things.
posted by JHarris at 12:34 PM on April 23

This project getting taken down is an excellent example of everything that's wrong with modern copyright law. Nintendo's business interests were in no way threatened by this benign display of programming prowess, yet they still have the power to destroy it forever.
posted by Mr.Encyclopedia at 5:46 PM on April 23 [1 favorite]

« Older Daikon on Instagram   |   Looks good enough to eat... but don't. Newer »

This thread has been archived and is closed to new comments