(Link to video)

Game objectives

  • Emulator used: VBA-RR v24 svn391 (should work on latest svn)
  • Heavy glitch abuse
  • Genre: Platform

Comments by MUGG



Please watch the run first if you want to be surprised.

Step by step we get closer to beating every single game by magically warping to the end. This run is the result of intensively trying to find ways to make use of the Pause Glitch to finish the game even faster than the previous run. The previous run used the v1.0 exclusive Pipe Glitch to travel through ROM, VRAM and SRAM to destroy a block corresponding to address $A2D5. If this address is non-zero, the game will run the credits the next time you enter a level.
In this run, however, the Pipe Glitch is never used. Instead we use the Pause Glitch that was found in 2011. The game would reset itself or create blocks above Mario's head when pausing rapidly at the same time the game is lagging from having too many enemies onscreen. I didn't really understand why this glitch occurs but I went on and used a lot of trial-and-error to come up with some interesting results [dead link removed]. Later on, Spikeman would contact me to ask questions and investigate the glitch for me which I really appreciated. Please read this post to learn more about the Pause Glitch. It was thanks to his investigation that we found that the Pause Glitch sometimes executes code starting at $A201. Back then, I didn't really understand anything about opcodes, registers, and all that so I couldn't do much more than keep asking for help and keep using trial-and-error blindly.
In 2014, I became a bit more familiar with opcodes after I googled for this page. I tried to actively look into how different code causes different stuff to happen. The first idea was to set $A2D5 to nonzero or $FF9B to 12,13 or 23, which would trigger the credits. The former could be easily done by EA D5 A2 or 08 D5 A2 so I tried to make $A203~$A205 read this code.
($A2D5 is an address whose purpose I don't really know. It never changes throughout a playthrough, but if it is nonzero, it will start the credits the next time you enter a level. $FF9B tells the game what mode it is currently in. "01" for title screen, "0C" for being on the map, "04" for being in a level, "08" for when you paused the game, etc. "12", "13", "23" will trigger the credits immediately.)
$A203 depends on the screen X position in the level and can become 08 at the beginning of a level and EA at the end of some levels.
$A204 seems to depend on Mario's Y position and can become D4 which is sufficient to reach $A2D5.
$A205 was the trouble maker though because it cannot become A2 in the first level. This address changes when you hit a breakable block or touch a coin in a certain location in the level. Spelling A2 can only be done with a coin and there is no such coin in the first level. It took way too much time to go to another level to touch a certain coin, and then go to yet another level to get in the right position and make the game lag.
The next idea was to use the Demo Mode. On version 1.0, you can press certain button combinations on the title screen to start in a level immediately. Up+Select makes you start in the first level for example. While in this mode, there is no music and the game records input and input durations in $A300~$A3FF. This mode was probably used by the developers to create the title screen demo sequences and they might have forgotten to remove it for version 1.0. Being an ingame code, we always neglected using this in a TAS but this seemed to be the last resort to make Pause Glitch work for us. So what I tried was spelling a code in $A203~$A205 that jumps to anywhere after $A300 to execute any code we want. Unfortunately, I discovered later that the Pause Glitch doesn't work at all in Demo Mode, apparently due to the absence of the function that handles the music.
I didn't really expect much after this happened, but somehow I found later that jumping to certain parts of ROM (around $05C8 for example) can cause interesting stuff, like gameovers or instant level finishes. I found that $FF9B could be set to 12,13 or 23 and it was easy to spell code in $A203~$A205 that jumps to ROM but unfortunately the game would always reset or freeze after jumping. With help from Masterjun, who became interested in SML2 after I kept asking for help in IRC, it didn't take long to find the one good way to start the credits and keep the game from freezing. Masterjun was also the first one to accomplish this while testing.
C4 CZ 05 ... C0, where Z can be almost any value, was the code that managed to do what we wanted.
$A203 and $A204 were made to read C4 CZ easily. $A205 was made to read 05 by touching a certain coin in the underground in the first level. $A227 (Mario Xposition) was made to read C0 by standing in the correct pixel position. C0 would return to where the program counter left off. The game would then silently and slowly fade into a mute credits sequence. Success! :)
I used the Pixel Trick from the previous runs to improve my speed. I want to try to explain it here again. The game doesn't use subpixels but still uses speeds that are more precise than 1 pixel/frame or 2 pixels/frame. The game does this by using pixel oscillations. When running, Mario moves 1, 2, 1, 2, 1, 2... pixels. By switching between different oscillation sequences, you can squeeze out an additional 2 every 8th frame or so. I watched $A200 (oscillation pattern that is currently used. I think it points to a certain location in ROM somewhere) and $A202 (Mario's speed) to optimize it as best as I could.
I also want to show you the latest version of the lua script that I used. It is Spikeman's lua script that helps use the Pause Glitch, with amateurish additions by me (lol).

Special Thanks to

  • Spikeman for investigation the Pause Glitch and finding that it executes $A201 onwards
Honorable mention to
  • andymac although he hasn't been involved since 2011, I want to thank him for finding the best way to do the Pixel Trick and for the previous runs that we worked on together

Nach: After doing way more research than is sane, and speaking to some emulator authors, it looks like what this movie does has a reasonable chance at being possible. Since feedback is good, and it's a considerable improvement over the previous run, I'm accepting this as an improvement.
Fog: Publishing with an encode from sheela901...

Site Admin, Skilled player (1235)
Joined: 4/17/2010
Posts: 11264
Location: RU
That's why I said "doesn't sync" instead of "doesn't work".
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
sack_bot
He/Him
Player (111)
Joined: 11/27/2011
Posts: 394
Location: Massachusetts
Patashu wrote:
feos wrote:
Masterjun wrote:
Does anyone of you have a proof that this even works on console?
Not that it invalidates the run if it doesn't sync on console.
It's not invalidated if it doesn't sync on console, no. But if it's not possible to do the glitch on console, then the run is no good. It's not valid to do a TAS that exploits an emulator only glitch, because it's a flaw in the emulator, not in the game's programming.
OK, I don't get the split here. if it doesn't sync on console, then isn't there some emulation error?
Message me here for my discord. Current Project: Psycho Waluigi Project on wait list: None?
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
sack_bot wrote:
OK, I don't get the split here. if it doesn't sync on console, then isn't there some emulation error?
Not necessarily. Our emulators ensure initial state is consistent, consoles don't. This means you may need to reboot your console thousands of times till something syncs, as they're less deterministic as an emulator. There's also minor timing issues with lag involved that may mean the input is all good, but not necessarily being fed to the console at the correct rate. Bear in mind that no two consoles may even share the same timing, as there is variation in the timing crystals each individual console is manufactured with.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Warepire
He/Him
Editor
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
I shall point out that the GameBoy is not one of these consoles with a random starting state, the boot strap ROM inits all the clocks and RAM to a specific value.
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
Warepire wrote:
I shall point out that the GameBoy is not one of these consoles with a random starting state, the boot strap ROM inits all the clocks and RAM to a specific value.
That may be true regarding the base system, but I don't know if its true regarding RAM and registers existing in carts with extra hardware supplied.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Warepire
He/Him
Editor
Joined: 3/2/2010
Posts: 2174
Location: A little to the left of nowhere (Sweden)
Nach wrote:
Warepire wrote:
I shall point out that the GameBoy is not one of these consoles with a random starting state, the boot strap ROM inits all the clocks and RAM to a specific value.
That may be true regarding the base system, but I don't know if its true regarding RAM and registers existing in carts with extra hardware supplied.
I've read the boot strap assembly too long ago, all it did was zero VRAM, the rest of the RAM was left uninited. I need to remember to refresh my memory before posting. (Can send you the boot strap disassembly if you need it)
Post subject: Movie published
TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 14848
Location: 127.0.0.1
This movie has been published. The posts before this message apply to the submission, and posts after this message apply to the published movie. ---- [2651] GB Super Mario Land 2: 6 Golden Coins "game end glitch" by MUGG, Masterjun in 00:41.56
Patashu
He/Him
Joined: 10/2/2005
Posts: 4014
Congratulations to MUGG & Masterjun for (apparently) surviving the gauntlet!
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
Experienced player (629)
Joined: 11/23/2013
Posts: 2207
Location: Guatemala
Humm... why the publication says only MUGG?
Here, my YouTube channel: http://www.youtube.com/user/dekutony
Site Admin, Skilled player (1235)
Joined: 4/17/2010
Posts: 11264
Location: RU
Because player entry needs to be manually created/edited for 2 and more authors.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 2/21/2008
Posts: 255
If someone soldered in jumpers to a real gameboy and we hooked up a playback thingy, could we "console verify" this?
"The guy was fatally injured and wants to be covered by God's tears (rain) before he dies. God is too busy to bother because it wastes frames." Frames 16:26
Editor, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
xnamkcor wrote:
If someone soldered in jumpers to a real gameboy and we hooked up a playback thingy, could we "console verify" this?
I think we want to console verify the glitch itself even more than the behavior after the jump. In other words, we should try to verify that bytes really are executed as code at $A201 after the glitch occurs - which is only a 0.1% chance though. You'd need to test for a very long time and I don't want to waste my time on that.
Experienced player (512)
Joined: 7/23/2011
Posts: 108
Late to the party, but I actually feel like the entertainment value of tasvideos drops every time a new arbitrary code glitch movie obsoletes something that was actually interesting to watch :/
Joined: 2/21/2008
Posts: 255
Carl Sagan wrote:
Late to the party, but I actually feel like the entertainment value of tasvideos drops every time a new arbitrary code glitch movie obsoletes something that was actually interesting to watch :/
I feel the same way about most Sonic TASs, but unless it doesn't work on a console, it should be accepted. At most you'll get "unglitched" categories.
"The guy was fatally injured and wants to be covered by God's tears (rain) before he dies. God is too busy to bother because it wastes frames." Frames 16:26
Patashu
He/Him
Joined: 10/2/2005
Posts: 4014
Wasn't there a page being compiled that was a gallery of entertaining obsoleted movies? If so, [the one this obsoleted] should be added to it.
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu
Editor, Experienced player (608)
Joined: 11/8/2010
Posts: 4012
Patashu wrote:
Wasn't there a page being compiled that was a gallery of entertaining obsoleted movies? If so, [the one this obsoleted] should be added to it.
There is such a page, and the previous movie has been added to it. Thanks for your suggestion!
Joined: 1/18/2006
Posts: 27
Location: Samsara
I'm super late to this party, but man was I psyched when I found out this exists! I thought everyone had given up on this glitch, and was considering giving exploiting it another shot when I found this. Incredible job MUGG! Maybe a Total Control run is possible after all... --- Also, I'm pretty confident this glitch would work on an actual Gameboy, unless for some reason VBlank timing is implemented incorrectly in both VBA and BGB. (The glitch works in both emulators.)
Moderator, Senior Ambassador, Experienced player (898)
Joined: 9/14/2008
Posts: 1007
I am actively trying to console-verify this general movie via re-creating this in lsnes inside SGB. Unfortunately, this movie does not sync on VBA 480 (or at least not in CrossOver Linux / WINE) so I'll either need to go back to 391 where this movie was recorded or ignore the problem and try to go with Spikedstuff's suggestion of viewing it in TAS movie editor. I would not turn down help on this adventure; if I can get this to work I'd like to pitch it as a donation incentive for Summer Games Done Quick 2016, but I digress. If I am able to console verify this movie I will update here. I'll probably take further technical discussion to the Super Mario Land 2 thread.
I was laid off in May 2023 and could use support via Patreon or onetime donations as I work on TASBot Re: and TASBot HD. I'm dwangoAC, part of the senior staff of TASVideos as the Senior Ambassador and BDFL of the TASBot community; I post TAS content on YouTube.com/dwangoAC based on livestreams from Twitch.tv/dwangoAC.
Joined: 2/21/2008
Posts: 255
dwangoAC wrote:
I am actively trying to console-verify this general movie via re-creating this in lsnes inside SGB. Unfortunately, this movie does not sync on VBA 480 (or at least not in CrossOver Linux / WINE) so I'll either need to go back to 391 where this movie was recorded or ignore the problem and try to go with Spikedstuff's suggestion of viewing it in TAS movie editor. I would not turn down help on this adventure; if I can get this to work I'd like to pitch it as a donation incentive for Summer Games Done Quick 2016, but I digress. If I am able to console verify this movie I will update here. I'll probably take further technical discussion to the Super Mario Land 2 thread.
What if you bypassed the SGB completely and just tried to console verify on a GB, GBC, GBA, or DS?
"The guy was fatally injured and wants to be covered by God's tears (rain) before he dies. God is too busy to bother because it wastes frames." Frames 16:26
Editor, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
I tried to verify it at one point but I didn't find a suitable setup and if there was one it would take like 1000 attempts. Assuming the pause bug the way it happens in vba does not happen on console, I would have wasted hours and hours upon this so I stopped.
Joined: 2/21/2008
Posts: 255
MUGG wrote:
I tried to verify it at one point but I didn't find a suitable setup and if there was one it would take like 1000 attempts. Assuming the pause bug the way it happens in vba does not happen on console, I would have wasted hours and hours upon this so I stopped.
Because a console verification would have disqualified your work you stopped trying to make a console verified run?
"The guy was fatally injured and wants to be covered by God's tears (rain) before he dies. God is too busy to bother because it wastes frames." Frames 16:26
Editor, Experienced player (817)
Joined: 5/2/2015
Posts: 671
Location: France
Console verification isn't necessilary the end-be-all to make sure a TAS would be valid. In this case, because console verification would have not reliably synced, the legitimacy of this run was verified by other means by Nach, and it was verified that this would be possible on console. On top of that, we're at a point where there is either no need or no way to accurately verify runs, especially in this case, where a difficult to reproduce reliably glitch is hard to replicate on console, and I can understand why MUGG didn't bother with it.
Guga
He/Him
Joined: 1/17/2012
Posts: 838
Location: Chile
xnamkcor wrote:
Because a console verification would have disqualified your work you stopped trying to make a console verified run?
Such an ill-intentioned assumption...
Moderator, Senior Ambassador, Experienced player (898)
Joined: 9/14/2008
Posts: 1007
Whoa, this conversation unraveled a bit. A few points: - Console verification requires some method of pretending to be the controller for the device in question and supplying button presses. This would be rather a challenge on a real handheld because you would have to make internal modifications, which might not be viewed well. There are a few existing methods to work around this - Endrift's Game Boy Player Player for GameCube and the use of the Super Game Boy and a replay device that works with and SNES, of which there are now a couple. I plan to go the SGB route because I do not own a GBP. - If, for whatever reason, I fail to console verify this, the movie will *not* be suddenly rejected. There are a large number of console verification failures and in no way does that imply that the original movie is suddenly invalid. The only time this might happen is if it was widely known at the time of the submission that a game took advantage of an emulation inaccuracy or if the original submitter was acting in bad faith. - There is every possibility that the exact steps to reproduce this on hardware will be slightly different. It's a certainty that the resultant movie will be a different number of frames as I've already discovered that it's possible, for whatever reason, to start SML2 faster when using the Gambate core via SGB support in lsnes than it is with VBA (and because the existing movie doesn't even sync with the newest version of VBA this is not a surprise). - I'd love to work with MUGG, Masterjun, or plow forward on my own and make this particular run happen but if it turns out to not be console verifiable for some reason I'll revert to the earlier, memory traipsing method. I'd like to get both methods working because I'd like to have the movie in this submission for a donation incentive and use the other to explain how arbitrary code works. Since my goals don't really have much to do with this particular movie, I propose moving this discussion to the SGDQ 2016 (spoiler alert) thread or into the previously linked SML2 thread. Thanks for the discussion, though!
I was laid off in May 2023 and could use support via Patreon or onetime donations as I work on TASBot Re: and TASBot HD. I'm dwangoAC, part of the senior staff of TASVideos as the Senior Ambassador and BDFL of the TASBot community; I post TAS content on YouTube.com/dwangoAC based on livestreams from Twitch.tv/dwangoAC.
Editor, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
xnamkcor wrote:
Because a console verification would have disqualified your work you stopped trying to make a console verified run?
I didn't even think of that, tbh. But no, I stopped because I didn't want to try for 50 hours and probably not get it done. Maybe there is a good setup that you can try on console, but I didn't find it..