News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

### Author Topic: Super Mario Bros. - Other Ways to Start on Worlds 2-8?  (Read 996 times)

#### SMB2J-2Q

• Full Member
• Posts: 135
##### Super Mario Bros. - Other Ways to Start on Worlds 2-8?
« on: December 18, 2019, 01:54:09 am »
Regarding Super Mario Bros. for the NES, how do I change the code to make myself start on World 2, but not restart back at the world number I input into the GG?

World number assignments:
00 = World 1
01 = World 2
02 = World 3
03 = World 4
04 = World 5
05 = World 6
06 = World 7
07 = World 8

The Game Genie codes to start on a different world are...
YSAOPE+YEAOZA+PEAPYA for World 2
YSAOPE+YEAOZA+ZEAPYA for World 3
YSAOPE+YEAOZA+LEAPYA for World 4
YSAOPE+YEAOZA+GEAPYA for World 5
YSAOPE+YEAOZA+IEAPYA for World 6
YSAOPE+YEAOZA+TEAPYA for World 7
YSAOPE+YEAOZA+YEAPYA for World 8

or...
YSAOLO for World 2
YSAOLO + ZEAOPP for World 3
YSAOLO + LEAOPP for World 4
YSAOLO + GEAOPP for World 5
YSAOLO + IEAOPP for World 6
YSAOLO + TEAOPP for World 7
YSAOLO + YEAOPP for World 8

How it works...
Code: [Select]
`A9 XX    = LDA #\$XX (where "XX" is the world number; e.g., 01 for World 2)8D 5F 07 = STA \$075F (the absolute address that assigns the world number)`
What happens is this: after beating the world number you changed to using the GG, and going to the world after it, beating the first level of the world after the one you input (e.g. cleared World 3-1), then you start back at the second level of the world you just input (e.g. World 2-2). You also return to the world you input if you die in the next world, or go down a pipe.

Therefore, how could this be fixed? What GG codes would I use to start at a desired world, but not lose your place in the world after it when you die, go down a pipe or clear the first level of this next world? That is, what I want to do is start from World 2, but to have it progress all the way to World 8 normally and not revert back to World 2 when I clear the first level of the world after.

Would I change anything in this part of the code to get the result I want?
Code: [Select]
`StartWorld1: 00:82E6: 20 03 9C - JSR \$9C03 (\$9C03 = LoadAreaPointer)        00:82E9: EE 5D 07 - INC \$075D (\$075D = Hidden1UPFlag)         ;set hidden 1-UP flag for both players00:82EC: EE 64 07 - INC \$0764 (\$0764 = OffScr_Hidden1UPFlag)  00:82EF: EE 57 07 - INC \$0757 (\$0757 = FetchNewGameTimerFlag) ;set fetch new game timer flag00:82F2: EE 70 07 - INC \$0770 (\$0770 = OperMode)              ;set next game mode00:82F5: AD FC 07 - LDA \$07FC (\$07FC = WorldSelectEnableFlag) ;if world select mode is on, then primary00:82F8: 8D 6A 07 - STA \$076A (\$076A = PrimaryHardMode)       ;hard mode must be on as well00:82FB: A9 00    - LDA #\$0000:82FD: 8D 72 07 - STA \$0772 (\$0772 = OperMode_Task)         ;set game mode here, and clear demo timer00:8300: 8D A2 07 - STA \$07A2 (\$07A2 = DemoTimer)00:8303: A2 17    - LDX #\$1700:8305: A9 00    - LDA #\$00InitScores:00:8307: 9D DD 07 - STA \$07DD,X (\$07DD = ScoreandCoinDisplay) ;clear player scores and coin displays00:830A: CA       - DEX00:830B: 10 FA    - BPL \$8307                                 ExitMenu:00:830D: 60GoContinue:00:830E: 8D 5F 07 - STA \$075F (\$075F = WorldNumber)           ;start both players at the first area00:8311: 8D 66 07 - STA \$0766 (\$0766 = OffScr_WorldNumber)    ;of the previously saved world number00:8314: A2 00    - LDX #\$00                                  ;note that on power-up using this function00:8316: 8E 60 07 - STX \$0760 (\$0760 = AreaNumber)            ;will make no difference00:8319: 8E 67 07 - STX \$0767 (\$0767 = OffScr_AreaNumber)   00:831C: 60       - RTS`

Thank you!

~Ben

#### Cyneprepou4uk

• Hero Member
• Posts: 632
• I am the baldest romhacker
##### Re: Super Mario Bros. - Other Ways to Start on Worlds 2-8?
« Reply #1 on: December 18, 2019, 05:37:53 am »
For example, by sacrificing changing Mario name to Luigi, you can change this

Code: [Select]
` 00:885F: AD 7A 07  LDA \$077A 00:8862: F0 1D     BEQ \$8881 00:8864: AD 53 07  LDA \$0753 00:8867: CA        DEX 00:8868: D0 09     BNE \$8873 00:886A: AC 70 07  LDY \$0770 00:886D: C0 03     CPY #\$03 00:886F: F0 02     BEQ \$8873 00:8871: 49 01     EOR #\$01 00:8873: 4A        LSR 00:8874: 90 0B     BCC \$8881 00:8876: A0 04     LDY #\$04 00:8878: B9 ED 87  LDA \$87ED,Y 00:887B: 99 04 03  STA \$0304,Y 00:887E: 88        DEY 00:887F: 10 F7     BPL \$8878 00:8881: 60        RTS`
into this

Code: [Select]
` 00:885F: AD 5F 07  LDA \$075F 00:8862: D0 05     BNE \$8869 00:8864: A9 01     LDA #\$01 00:8866: 8D 5F 07  STA \$075F 00:8869: 60        RTS`
Unlike your current GG, this won't constantly overwrite world number. It will set wanted world number only once, when current world is #\$00

#### SMB2J-2Q

• Full Member
• Posts: 135
##### Re: Super Mario Bros. - Other Ways to Start on Worlds 2-8?
« Reply #2 on: December 18, 2019, 07:51:49 pm »
For example, by sacrificing changing Mario name to Luigi, you can change this

Code: [Select]
` 00:885F: AD 7A 07  LDA \$077A 00:8862: F0 1D     BEQ \$8881 00:8864: AD 53 07  LDA \$0753 00:8867: CA        DEX 00:8868: D0 09     BNE \$8873 00:886A: AC 70 07  LDY \$0770 00:886D: C0 03     CPY #\$03 00:886F: F0 02     BEQ \$8873 00:8871: 49 01     EOR #\$01 00:8873: 4A        LSR 00:8874: 90 0B     BCC \$8881 00:8876: A0 04     LDY #\$04 00:8878: B9 ED 87  LDA \$87ED,Y 00:887B: 99 04 03  STA \$0304,Y 00:887E: 88        DEY 00:887F: 10 F7     BPL \$8878 00:8881: 60        RTS`
into this

Code: [Select]
` 00:885F: AD 5F 07  LDA \$075F 00:8862: D0 05     BNE \$8869 00:8864: A9 01     LDA #\$01 00:8866: 8D 5F 07  STA \$075F 00:8869: 60        RTS`
Unlike your current GG, this won't constantly overwrite world number. It will set wanted world number only once, when current world is #\$00

What is really going on, that causes the present value to be overwritten in address \$9086, whenever I use such codes like YSAOPE+YEAOZA or YSAOLO to overwrite? Here's some more code for you...
Code: [Select]
`SecondaryGameSetup:00:9061: A9 01      LDA #\$0100:9063: 8D 57 07   STA \$075700:9066: 8D 54 07   STA \$075400:9069: A9 02      LDA #\$0200:906B: 8D 5A 07   STA \$075A00:906E: 8D 61 07   STA \$076100:9071: A9 00      LDA #\$0000:9073: 8D 74 07   STA \$077400:9076: A8         TAYClearVRLoop:00:9077: 99 00 03   STA \$0300,X00:907A: C8         INY00:907B: D0 FA      BNE \$907700:907D: 8D 59 07   STA \$075900:9080: 8D 69 07   STA \$076900:9083: 8D 28 07   STA \$072800:9086: A9 01      LDA #\$0100:9088: 8D 5F 07   STA \$075F00:908B: AD 1A 07   LDA \$071A 00:908E: 4E 78 07   LSR \$077800:9091: 29 01      AND #\$0100:9093: 6A         ROR00:9094: 2E 78 07   ROL \$077800:9097: 20 ED 90   JSR \$90ED00:909A: A9 38      LDA #\$3800:909C: 8D E3 06   STA \$06E300:909F: A9 48      LDA #\$4800:90A1: 8D E2 06   STA \$06E200:90A4: A9 58      LDA #\$5800:90A6: 8D E1 06   STA \$06E100:90A9: A2 0E      LDX #\$0E`
And (for when I use YSAOLO)...
Code: [Select]
`SetStPos:00:9165: B9 16 91   LDA \$9116,Y00:9168: 85 86      STA \$008600:916A: BD 1C 91   LDA \$911C,X00:916D: 85 CE      STA \$00CE00:916F: BD 25 91   LDA \$9125,X00:9172: 8D C4 03   STA \$03C400:9175: 20 F1 85   JSR \$85F100:9178: AC 15 07   LDY \$071500:917B: F0 1A      BEQ \$919700:917D: AD 57 07   STA \$075700:9180: F0 15      BEQ \$919700:9182: B9 2D 91   LDA \$912D,Y 00:9185: 8D F8 07   STA \$07F800:9188: A9 01      LDA #\$0100:918A: 8D 5F 07   STA \$075F00:918D: 4A         LSR00:918E: 8D F9 07   STA \$07F900:9191: 8D 57 07   STA \$075700:9194: 8D 9F 07   STA \$079F`

~Ben
« Last Edit: December 18, 2019, 08:39:52 pm by SMB2J-2Q »

#### Cyneprepou4uk

• Hero Member
• Posts: 632
• I am the baldest romhacker
##### Re: Super Mario Bros. - Other Ways to Start on Worlds 2-8?
« Reply #3 on: December 19, 2019, 01:23:13 am »
These two routines are executed every time the game loads a level. When you complete level 4 and go to the next world, game increases value in \$075F. But your code forces this value to always be #\$01. So as soon as the game will load a level, like after you die, go into pipe or complete a level - you are back at world 2.

Those GGs supposed to be deactivated once they were used to enter world 2.