[Toturial]: Access the 256W of SMB on real hardware

Started by MasterDisk, March 30, 2010, 03:57:55 am

Previous topic - Next topic

Jedi Master Baiter

I remember reading that Tennis trick on Tips & Tricks.

satoshi_matrix

Uglyjoe, can this be done in GameGenie format as well?

UglyJoe

March 30, 2010, 06:45:23 pm #17 Last Edit: March 30, 2010, 09:00:30 pm by UglyJoe
It *can* be, but you have to keep modifying the third code in order to change the world:

OXVAAXSX, XVVAZZYE => always need these two
AEVAPXSY => "continue" at world 1, if you change the first two letters and the last letter you should get different worlds:
     The first letter can be anything.
     The second letter can be E,O,X,U,K,S,V,N
     The last letter can be Y,N

-----

Even better:
NNXAZZYE + KAVETZYA
Press B on the title screen to choose the world you want.

satoshi_matrix

That's great and all, but why not simply use the modifed .nes ROM that allows you to change on the fly?

Maybe I'm being lazy here, but its a heck of a lot easier than using Tennis, Gamegenie, Famicom BASIC or Gecko.

All you need is either a Powerpak and the 256 World .nes ROM or your emulator of choice. Everything from the Xbox to Dreamcast to Wii will play the rom completely fine.

That said, I'm curious as to what exactly is going on here. Can someone please explain the 256 World concept? Why does this occur? Why 256 Worlds and not say 999? How was this even found? Do other platformers have this phenomenon as well? I'd like to know more about it.

133MHz

UglyJoe can probably explain this a whole lot better than I can, but here's my take on it:

Quote from: satoshi_matrix on March 31, 2010, 01:03:20 pm
Can someone please explain the 256 World concept? Why does this occur?


The game has only 8 worlds and the level data for those is stored somewhere in the program ROM. The memory addresses for the levels are most likely algorithmically generated from the world number. When you tell the program to enter a world higher than 8, the level parser falls outside of the range of normal level data, into the rest of the program memory, and interprets whatever it finds as a valid level. Depending on what's there, you might get a valid level, a seemingly playable mess, a completely unplayable mess, or even a plain system crash. Because the ROM data is always the same across all SMB cartridges, the results can be consistently replayed. If you know how the Missingno. trick works, this is quite similar.

Machines can't think for themselves, they will do exactly what you tell them to even if it seems counterproductive, utterly pointless, or even destructive. It's up to the programmer to introduce "sanity checks" and "error traps" into the program to prevent extraneous situations. In SMB this would be something like refusing to start or start always at world 1 if the starting world variable is higher than 8 or less than 1. The developers didn't include such a check probably because there's no known means to trigger such a condition in normal gameplay circumstances.

Quote from: satoshi_matrix on March 31, 2010, 01:03:20 pm
Why 256 Worlds and not say 999?


The Famicom is an 8 bit system. It uses an 8 bit microprocessor. With 8 bits of data you can represent numbers between 0 and 255, hence 256 possible combinations. The game stores most of its environment variables (lives left, current level, coins collected, etc) as single 8 bit integers. If you add one to 255 (hex FF, binary 11111111), it rolls back to zero.

16 bits let you represent numbers between 0 and 65535, or 65536 possible combinations. 2^16 ;)

Quote from: satoshi_matrix on March 31, 2010, 01:03:20 pm
How was this even found?


Beats me how the Tennis trick was discovered back in the 80s. Today we have emulators and debuggers, but back then it was either someone with access to really expensive debugging equipment or somebody with tons of spare time. ::)

Quote from: satoshi_matrix on March 31, 2010, 01:03:20 pm
Do other platformers have this phenomenon as well? I'd like to know more about it.


With the aid of a debugger or a cheat device you can produce "Glitch Worlds" in most games, by forcing the game to start in nonexistent levels. Doing this in normal gameplay circumstances is a lot harder, but proven to be possible. The Missingno. trick in the Pokémon games is a great example of this.

UglyJoe

Quote from: satoshi_matrix on March 31, 2010, 01:03:20 pm
Maybe I'm being lazy here, but its a heck of a lot easier than using Tennis, Gamegenie, Famicom BASIC or Gecko.

You're the one who asked for the Gamegenie codes :P

Quote from: satoshi_matrix on March 31, 2010, 01:03:20 pm
That said, I'm curious as to what exactly is going on here. Can someone please explain the 256 World concept? Why does this occur? Why 256 Worlds and not say 999? How was this even found? Do other platformers have this phenomenon as well? I'd like to know more about it.


133Mhz beat me to it this time, but I'll keep my explanation here for prosperity's sake:
Spoiler

I might have the specifics wrong, but the concept is like this: 

Basically, the world data is laid out in chunks, one following the next.  Like:

0000 (world one):
level data level data level data...
1000 (world two):
level data level data level data...
2000 (world three):
level data level data level data...

and so on for all eight worlds. 

It's accessing the level data using offsets (0000 in this example) and an index (world number - 1 in this example).  So for world one, the game says "gimme the level data at 0000 + (0 * 1000) = 0000" and for world three it says "gimme the level data at 0000 + (2 * 1000) = 2000".

Now, beyond the level data for world eight there is more data.  It's not level data, but it is accessible data.  What these "extra worlds" are doing is using a world index that is greater than 7.  This makes the game say something like "gimme the level data at 0000 + (42 * 1000) = 42000".  There is no level data at 42000, but it reads whatever data is there and interprets it as a level.  Because the data is not intended to be used for level data, you get a lot of worlds that do nothing but crash the game rather quickly.

You are limited to 256 worlds because one byte can't be bigger than 255.  0 through 255 is 256 values.  It'll loop around back to 0 if you try to make it any bigger than that (the same thing happens if you get too many one-ups from that trick in 3-1).  Really, whenever you see a value in a game that maxes out at 255 or 256 (like rupees in Zelda), it's for the same reason.

The trick itself is pretty simple, but I have no idea how anyone figured it out without having some access to a debugger or RAM dumper.  I explained earlier in the thread why the Tennis trick specifically works.
[close]

133MHz


satoshi_matrix

Super Mario Bros. is identical on the NES and Famicom so it will work on both. The real question is if it works with All Night Nippon Super Mario Bros. or the FDS Super Mario Bros.

And now that I think of it, is this triggerable in Super Mario Bros. 2 (FDS or hacks) ?

ericj

You can't load multiple disks into an FDS using reset. You have to cycle the power on & off to load different games. But, it may work with a fds to cart converted game.

DaGameNerd

Can this be done on an NES? I don't have a Famicom but I do have a Famicom adapter and the Famicom version of Super Mario Bros. 1, the closest I have to a Famicom system is my Famiclone console that looks like a Famicom.

If it'll work on my NES or if there's a chance it'll work on my Famiclone then I'll buy the Famicom version of Tennis.

UglyJoe

Quote from: DaGameNerd on June 07, 2015, 09:02:18 pm
Can this be done on an NES?


I've done it on an NES with the NES versions of SMB and Tennis.  You need to use the plain SMB cart, though.  Multicarts (like SMB/Duck Hunt) won't work.  It would probably work with the FC versions of the games on the NES with an adapter, as the NES and FC versions of these two games are identical.

mario_bro2065

September 30, 2015, 11:11:58 am #26 Last Edit: October 04, 2015, 01:06:48 pm by mario_bro2065
I did it on the NES with a Game Genie  :o. Basically you put in a code (I will post if I remember it) then you press B multiple times and the world number on the title should change just like what you can do if you beat the game once. Except now you can go beyond world 8 and to 9, 10, 11 etc. One slight problem. After beating 9-1 once whenever I tried the code again the game would crash half-way through 9-1 (ONLY on 9-1. All the other worlds work fine and they are fun to explore!).

CODE : NNXAZZYE+AANAAXZG

Enjoy exploring!

Plus here is a good quality screenshot of 9-1. I couldn't find any on the internet before so I guess here ya go

aguerrero810

Can confirm this works. ;D
I used an FDS copy of Tennis and it worked with the ram adapter. It went like this:
1. Play a little bit of Mario
2. Take out Mario (without turning off power)
3. Put in RAM Adapter with FDS Tennis loaded.
4. Reset
5. Play a couple points of Tennis
6. Take out RAM Adapter (without turning off power)
7. Put in Mario
8. Reset
9. Press A + Start
10. Some fun world is loaded!