Legend of Zelda NES - 2nd Quest Screen Layout Changes

Started by WileyHacker, May 15, 2022, 07:49:02 PM

Previous topic - Next topic

WileyHacker

I can't figure out which ROM offsets determine which screen layouts change.
Does anyone know which ROM offsets these are?
Thanks.


WileyHacker

#2
QuoteC - - - - - 0x01805D 06:804D: B9 2D 06  LDA ram_current_quest,Y

Could you explain? I don't know assembly too well.

Cyneprepou4uk

#3
This routine loads pointers from tbl_8000 (1nd quest) or tbl_802A (2nd quest). You can find these tables in this file. There are 10 pointers inside each table (overworld (00) + 9 dungeons (01-09)), which also point to data inside this file. Then another subroutine copies 300h bytes of data from there into RAM. ROM offsets are written at the beginning of each line.

There are around 16 locations in the code where it reads current quest, and this particular code does the most impact on the game depending on current quest, in my opinion, so I figured it's probably what you're looking for.

WileyHacker

Unfortunately, this doesn't help me. Thanks, though!

Cyneprepou4uk

Quote2nd Quest Screen Layout Changes

Can you show pictures with differences between both quests?

PowerPanda

Can you describe what you're hoping to do? LoZ has editors that can help a lot with layout changes.

WileyHacker

#7
you know how the entrance to Lvl 3 in Q1 changes to a different screen in Q2? like the spot where the entrance used to be is a different layout? my goal here is to change which screen changes it's layout. the editor I'm using lets me change what it becomes, but not which screen changes. any help?

Cyneprepou4uk

This code triggers when you play flute, locations list are in tbl_EF66
https://github.com/cyneprepou4uk/NES-Games-Disassembly/blob/main/The%20Legend%20of%20Zelda/bank_FF.asm#L1950

If you play it while being in map location 3C in 2nd quest, game will unlock stairs to dungeon 3.

WileyHacker

#9
the editor I'm using lets me easily change that. but in Q1 that screen doesn't have a pond. I don't know how to change which screen changes. I know how to make that screen (3C I guess) something else other than a pond in q2, but I don't know how to change the screen that changes.

In Q2 these screens change layout: 0B 3C and 74. but I don't know where in the rom these values are set.

gzip

It sounds like this is what you're looking for. It patches the attribute table directly in memory. You should be able to figure out which bytes you want to change.

Change Overworld for 2nd Quest

1812D: A0 07 LDY #$07 ; Y = 07

1812F: BE 5F81 LDX $815F,Y
18132: B9 6781 LDA $8167,Y
18135: 9D FE68 STA $68FE,X ; Screen Attributes Table 1
18138: 88 DEY
18139: 10 F4 BPL $1812F

1813B: A9 7B LDA #$7B ; A = 7B
1813D: 8D 096A STA $6A09 ; Screen Attributes Table 3
18140: A9 7B LDA #$7B ; A = 7B
18142: 8D 3A6A STA $6A3A ; Screen Attributes Table 3
18145: A9 5A LDA #$5A ; A = 5A
18147: 8D 726A STA $6A72 ; Screen Attributes Table 3
1814A: A9 72 LDA #$72 ; A = 72
1814C: 8D BA68 STA $68BA ; Screen Attributes Table 1
1814F: A9 72 LDA #$72 ; A = 72
18151: 8D F268 STA $68F2 ; Screen Attributes Table 1
18154: A9 01 LDA #$01 ; A = 01
18156: 8D 3A6B STA $6B3A ; Screen Attributes Table 5
18159: A9 00 LDA #$00 ; A = 00
1815B: 8D 726B STA $6B72 ; Screen Attributes Table 5

1815E: 60 RTS

WileyHacker

#11
I think that's already logged here. I'm trying to change the screen values (0B 3C and 74) that change to 7B 7B 5A in the original.

Quote1813B: A9 7B   LDA #$7B   ; A = 7B
1813D: 8D 096A   STA $6A09   ; Screen Attributes Table 3
18140: A9 7B   LDA #$7B   ; A = 7B
18142: 8D 3A6A   STA $6A3A   ; Screen Attributes Table 3
18145: A9 5A   LDA #$5A   ; A = 5A
18147: 8D 726A   STA $6A72   ; Screen Attributes Table 3

gzip

The $6A09 etc correspond to the screens data in memory. One or more of those values will need to change. The data that gets put into memory comes from ROM bank 6 (search for "Tables for Overworld Screens Attributes"). All 6 tables get stored in memory starting at $687E. The second quest just overwrites a few places to make the corresponding changes (screen id, cave destination, cave exit location, etc.)

According to the code snippet I posted before, it's overwriting data in tables 1, 3, and 5. Study the tables and then look at the bytes that are being overwritten to understand why they're being overwritten. Then make your changes based on what you learned.



WileyHacker

#13
THANKS! :D
I figured it out!

1813C The screen to use in 2nd quest for 0B. (1st quest's Level 5) default 7B
1813E The screen (minus 2) that changes to 7B. default 09
18141 The screen to use in 2nd quest for 3C. (1st quest's Level 2) default 7B
18143 The screen (minus 2) that changes to 7B. default 3A
18146 The screen to use in 2nd quest for 74. (1st quest's Level 3) default 5A
18148 The screen (minus 2) that changes to 5A. default 72


And I added it to Datacrystal