TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Beating Super Mario Bros 3 in 19 frames (2021)

27 pointsby strebloover 2 years ago

5 comments

lupireover 2 years ago
Really quick summary:<p>A hardware bug causes the NES to misread inputs sometimes (losing 1bit), if music is playing.<p>To work around the bug, the game only accepts inputs if the same key is pressed for two consecutive input cycles (an input cycle is much shorter than one frame)<p>If the inputs don&#x27;t match, the game loops and tries again.<p>This loop has no hard coded limit, so if you spam changing inputs fast enough for long enough (using a computer; your fingers aren&#x27;t fast enough), the game keeps trying to read inputs until it&#x27;s time for next frame to be drawn to screen.<p>The NES clock sends an interrupt to prompt the drawing code to run.<p>The input code and the drawing code use overlapping areas of memory, and the game didn&#x27;t do what it needs to do (at a low level in memory) to be ready draw the frame properly, and ends up reading drawing instructions from input bytes instead of what the game was designed to put into that area of memory.<p>(This part is where the real dirty magic is; it requires understanding of assembler and interrupts to properly explain how it works. Basically one function interrupts another and starts running before the first one finished, and the functions use different invocation logic, so the second function ends up exiting &quot;the wrong way&quot; and the program jumps to a wrong return location when it&#x27;s done.)<p>Thus the attacker can write run semi-arbitrary code that makes the game jump to the instruction that starts playing the ending&#x2F;credits scenes.
评论 #33381335 未加载
CM30over 2 years ago
For those who want to see what those frames look like, Supper Mario Broth posted images of all 19 on Twitter:<p><a href="https:&#x2F;&#x2F;twitter.com&#x2F;MarioBrothBlog&#x2F;status&#x2F;1585644239073193984" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;MarioBrothBlog&#x2F;status&#x2F;158564423907319398...</a>
评论 #33420710 未加载
LocalHover 2 years ago
what in the fuck, literal assembly fu, amazing
评论 #33379534 未加载
wly_cdgrover 2 years ago
Not bad, but...aah, who am I kidding, this is some power level 9000 macromancer shit
评论 #33381187 未加载
bitwizeover 2 years ago
They should get like, a million P-Wings for this.
评论 #33420731 未加载