

Through the Warp Zone: Hacking Super Mario Brothers to unlock new worlds - emilyst
https://emily.st/p/AUg

======
namuol
Exploiting glitches in-game on real hardware is always cool, but not always
... convenient. ;)

This sorta reminds me of a story about Intellivision's hit game "ASTROSMASH!"
([http://en.wikipedia.org/wiki/Astrosmash](http://en.wikipedia.org/wiki/Astrosmash)).

The game was originally meant to be a clone of Asteroids called "Meteor!", but
Mattel cancelled the clone due to legal concerns. But there was still room on
the cart, which the developer had been using to develop his own unique game
called "Avalanche". This is what eventually became ASTROSMASH (my favorite
game as an 8 yearold who never got that NES...)

The legend was that the code for the original Asteroids clone was still on the
cart; people claimed that pressing the reset button on the console rapidly
would cause the game to glitch into Meteor instead of Astrosmash, but I could
never make it work as a kid.

Years later, I got my hands on an intellivision emulator that had really nice
disassembler/assembler included ([http://spatula-
city.org/~im14u2c/intv/](http://spatula-city.org/~im14u2c/intv/)). By then I
had also read online that the developer simply put a JMP instruction at the
beginning of the cart to skip over the original "Meteor" code.

Sure enough, I found a ROM for ASTROSMASH, disassembled it, found the JMP in
question and modified the assembly, reassembled, and suddenly I was playing
"Meteor!"

Either way, it's a good thing that Mattel trashed the Asteroids clone;
ASTROSMASH turned out to be a much better game!

------
devindotcom
If you're interested in doing this yourself, you don't need a separate hex
editor; FCEUX has one built in:

[http://www.fceux.com/web/home.html](http://www.fceux.com/web/home.html)

Hex value watching and editing is a valued tool in the time attack community.
If you advance frame by frame and watch certain values, you can see patterns
showing when an enemy will attack, an item will drop, etc. Time attackers use
it to minimize the time spent waiting for enemies, or finding which character
actions affect level or enemy patterns.

[http://tasvideos.org/Glossary.html#HexEdit](http://tasvideos.org/Glossary.html#HexEdit)

[http://tasvideos.org/InputFileEditing.html](http://tasvideos.org/InputFileEditing.html)

~~~
dmm
emacs also has a hex editor built in called hexl mode. To use it just use C-x
C-f to open a file and then use M-x hexl-mode.

[https://www.gnu.org/software/emacs/manual/html_node/emacs/Ed...](https://www.gnu.org/software/emacs/manual/html_node/emacs/Editing-
Binary-Files.html)

------
tjbarbour
For anyone dying to know what world 9 is like, found this on youtube:

[https://www.youtube.com/watch?v=FcDfPXsgqQ0](https://www.youtube.com/watch?v=FcDfPXsgqQ0)

Looks like someone game genie'd it back in 2008

~~~
crazygringo
That's crazy.

I'm so confused as to how an invalid level value would generate a level with
all sorts of bizarre, invalid combinations... yet still be completely
playable, without crashing or anything.

~~~
reginaldo
In 2011 I wrote an emulator for the LatticeMico32 processor [1]. After it was
written, I decided to play the chaos monkey game and change some instructions,
like reversing "less than" and "greater than", just for kicks. So the code I
was actually running would be the equivalent of taking a program and replacing
all > with < (and vice-versa). Much to my surprise, some emulated code still
worked. It mostly did the wrong thing, but the fact that the code worked,
printing stuff in the screen and all, still baffles me.

[1] [http://www.ubercomp.com/jslm32/src/](http://www.ubercomp.com/jslm32/src/)

------
TheZenPsycho
Of course, back then, in the 1980's, there was no publically available
internet.

Knowledge of minus world was spread purely through word of mouth. We used our
meat based networking protocols.

What barbaric times those were.

~~~
stormbrew
Well, there were magazines. Nintendo Power started pretty late in the 80s, but
it was also I think the first place I heard about the minus worlds.

~~~
TheZenPsycho
I heard about it _before_ nintendo power existed.

~~~
stormbrew
Ok. To be clear, there were video game magazines before Nintendo Power (C&VG,
for eg. Also, more obscure, but Nintendo's own predecessor the Nintendo Fun
Club newsletter) and they played a significant role in spreading this info.
The kid with the magazine sub was king of the playground, basically.

I was just stating my experience there.

------
jboggan
Coincidentally also on the front page right now - realtime hex editing with
NES hardware:

[https://news.ycombinator.com/item?id=7700990](https://news.ycombinator.com/item?id=7700990)

------
byuu
The Japanese Famicom didn't have a CIC lockout chip, which let you hotswap
games and then soft reset, preserving all of the RAM (a power cycle doesn't
decay all RAM instantly, but it deteriorates rapidly.)

People would play Mario, then swap in certain games (mostly Tennis), then swap
back to Mario, and then try the trick where you hold select or whatever to
resume at the level you last died at.

Depending upon the contents of RAM based on what the other game wrote there,
it would warp you to all of these corrupted worlds.

------
BorisMelnik
Love that people are still hacking NES. There are numerous other glitches in
the original NES, such as being able to jump on the turtle in 3-2 (or 3-1 I
forget) to get 99 lives (go over 100 and you die.

Also at this point, can't someone from Nintendo just open source the code for
nostalgic purposes :)

~~~
djur
What you get from disassembling a NES ROM (or, really, software for any 8-bit
computer) is not much different from what went in originally, except (maybe)
there were some comments.

It's very unlikely that the original assembly source exists anymore, or even
that it was kept much later than the game's release. It's not until very, very
recently that game companies started to think that the original source and
assets for a game would have enough value to be worth the cost of archiving.
Even games from the PlayStation 2 era routinely have to be rewritten from
scratch with new assets when re-released on later consoles.

In my experience, most of the game source code that survived from the early
years of personal computing is for games written in BASIC, which would have
been distributed as source. There's a few exceptions like for Jordan Mechner's
games, but that just goes hand-in-hand with his famously detailed records of
his development process.

~~~
b0b_d0e
While I agree that the original source code for the game is probably long
gone, I think we can settle for having a disassembled version of it. As you
pointed out, the game was most likely in handwritten assembly, so the assembly
output probably isn't much different. The most useful part would have been the
comments, which it turns out there were some very dedicated people that went
through the entire disassembly and annotated the source code like this one by
doppleganger
[http://www.romhacking.net/documents/344/](http://www.romhacking.net/documents/344/)
and this one where movax tried to make the assembly more natural
[http://www.romhacking.net/documents/635/](http://www.romhacking.net/documents/635/)

There are several really cool things you can find on here about older games
including a detailed explaination of the minus one world
[http://www.romhacking.net/documents/343/](http://www.romhacking.net/documents/343/)
where doppelganger covers exactly why the game does what it does.

------
techtalsky
This was really sweet. A somewhat inconsequential hack but incredibly touching
writing about it. I love this kind of video game writing.

------
infectoid
Very awesome. Thanks for that. I really want to get this running on my big
tele and start exploring!

------
staticsafe
That font is honestly nearly unreadable on Firefox. Font is too thin.

~~~
freshyill
I can believe it, but reading on a retina iPad mini, I was actually struck by
how nice it looked!

I think now that A-grade browsers are generally equal in most basic respects,
we often forget to test things that might seem inconsequential and not worth
testing, like font-weights.

~~~
emilyst
I actually did a bit of testing, including grabbing VMs of various versions of
Windows to see how things looked on XP, 7, and 8.1. It remained quite readable
in my testing.

~~~
freshyill
Now that I'm back on a desktop computer, I'm looking and it does look pretty
good to my eyes, but I could see how it might be too thin for some people.

~~~
emilyst
I tweaked the weights a bit. Hopefully it's a little easier now.

