In fact, all transition zones are the same object. The game determines which zone to load based on the value at $ 06D6. By default, this value is 00, that is, it does not correspond to any zone. Super Mario Bros Rom But this is normal because most of the time we are not near the transition zones. It is created when we are horizontal in this place.
This object executes code upon creation, which also increases the value at the address $ 06D6 by one, creating pipes in the transition zone. Usually, we get into the transition zone by running along the top of the screen, while this creates another scrolling lock object, and that creates the correct transition zone value.
Here’s how it works:
- First, the game loads the value 04 at the address of $ 06D6. This means that the first transition zone will be used.
- Then she checks at what level the player is. If the player in the world is 1, she uses 04 and saves that value to $ 06D6, and then skips all subsequent code.
- If the player is in a different world, she loads the value 05. Then the game checks what type of level the player is at. If the player is at the underground, underwater or castle level, then she saves the value 05 in $ 06D6.
As stated above, if we are at level 1-2, this saving is not performed, because the game skips these instructions and the value remains 04. Super Mario Bros Rom If the player is above ground, the game writes the value 06 to the address $ 06D6.
As a result, for the zone of level 1-2 the value will be 04, for the underground zone of level 4-2 – 05, and for the aboveground zone – 06. The game displays the message WELCOME TO WARP ZONE if the value at the address $ 06D6 is 04.05 or 06, which is always true when we create transition zones in normal gameplay. When we go through the transition zone creation object, the game creates a transition zone greeting text.
After the text is output, the procedure determines which transition zone to load by subtracting 04 from the value of $ 06D6. So if the value is 04, we get 00, if 05, then 01, and if 06 – 02. But since we created the scrolling lock object and then entered the wall, the value of $ 06D6 is still 01.
This value 01 corresponds to the transition zone of level 4-2, so the game thinks that we are in the zone of level 4-2, not 1-2. Super Mario Bros Rom Download We can verify this by going into the second pipe, which takes us to world 5. If we go into the left or right pipe, we go to world 36, or world −1. This explains how we get into the world of −1.
Why is this world an endlessly looped copy of world 7-2? First, let’s see why the world −1 is similar to 7-2. When we go into the pipe, the game runs an algorithm that determines which room Mario should be placed in. If the value at the address $ 06D6 is 00, which happens in most cases, the game skips this code and sends Mario to the area defined in the address $ 0650.
This means that when we pass through a bent pipe at level 1-2, the value of $ 06D6 is 00, which is possible only when breaking, we go to where the offset with a value of 25 sends us, which corresponds to the end of the level. This happens when Mario enters a bent pipe. But if the value is not 00 and this is not the case of the −1 world, because the scrolling lock sets the value to 01, then the game uses the world number to search for the corresponding offset of the area in the search table in order to understand what level data needs to be loaded.
If you set $ 24 as the level number, the transition zone code that defines the location for the transition uses $ 24 to offset the world and gets a value of $ 33, which tells the game to look for an offset of $ 33 (51) bytes from the beginning of the lookup table, which has a value of 01, corresponding to the world 7-2. Super Mario Bros Rom Download The search table consists of only 34 bytes, because usually, this is enough for the game, so the shift of 51 bytes is outside the area of the search table, in the area of the enemy data table. We take this data from a table that the search table should not really have access to. And other worlds bugs also work. So, the game loads what it considers level 36-1, but containing data of level 7-2.
Now let’s find out why the levels are looped. This is because the game changes objects in these enemies. Let’s see how it works. The scope change object is 3 bytes long. The first byte is the location of the object in the game, the second is the offset of the address of the area, telling the game where to send the player when he goes down the pipe or goes up the vine. The third byte is divided into two parts. The important part is the first three bits: the world number.
The current world number does not match the number in the object. The area offset is not updated, so it loads a clone of level 7-2, which is designed to change the area object, but since the area offset is set to $ 25, we move to world 7. When we are actually at level 7-2, the area offset is set to $ 25, because the world number corresponds to the current world number of the object.
However, world −1, which reads data from 7-2, is not in world 7, so the game does not load the offset of the $ 25 region into the offset variable, which would allow us to leave the level. Instead, it still contains the value 01, set at 1-2. Since the displacement never changes, instead of reaching the surface, the level is loaded first. Therefore, the world −1 is infinitely looped.
So we solved the riddle of the −1 bug in Super Mario Bros.! Now we know what world −1 is and how it appears, and most importantly, how we manage to get there. I hope you were interested in.