6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Jun 16, 2024 3:34 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Jul 02, 2015 7:46 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10827
Location: England
This is quite mind-boggling, but as it involves 65816 machine code I thought it might be of interest.

Glitching is the art of exploiting bugs in game programs to cause specific unarchitected actions - in this case, to skip direct to the end game credits after just under two minutes of extraordinary play. In this example, specific sprites have to be caused to spawn and despawn at very specific screen coordinates, such that the low bytes of a data table in RAM contain a short 65816 program.

To get this code to run, the game is manoeuvred into an unanticipated configuration, and it jumps into the void. The databus capacitance is now abused, such that fetches from unpopulated memory will read a series of specific useful values according to what was previously on the bus (data, stack values) and lead to jumping to the code placed in the data table. The code tweaks a vital game state variable, and must then return - but there are extra values on the stack - so it jumps to the tail end of a game loop which conveniently removes two values before (eventually) returning.

Here's the explanation:
Image

and here's the demonstration, in live play, without any machine assistance (a lot of pixel-perfect actions required)
Image

(via https://news.ycombinator.com/item?id=9792649)


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 03, 2015 8:36 am 
Offline

Joined: Wed Oct 06, 2010 9:05 am
Posts: 95
Location: Palma, Spain
That is insane! Thanks for that Ed, very interesting!


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 04, 2015 12:35 am 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 672
I've heard about writing code using gameplay, but didn't know quite exactly what that meant. That was a very clear explanation, and a great video!

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 30, 2016 6:17 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10827
Location: England
There's another (shorter and simpler) glitch in Legend of Zelda on the Famicom - 6502 code is written by naming the players appropriately, and is executed by arranging for a sprite table overflow at a precise point in the music...
https://www.youtube.com/watch?v=fj9u00PMkYU
via http://www.theregister.co.uk/2016/09/20 ... ge_glitch/
(It seems in this environment the BRK handler returns without effect.)


Top
 Profile  
Reply with quote  
PostPosted: Sat Dec 05, 2020 12:05 am 
Offline

Joined: Mon May 21, 2018 8:09 pm
Posts: 1462
It's an extreme speedrun technique. "Easy" is not the point; "fast" is.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: