News: 11 March 2016 - Forum Rules

Author Topic: Legend of Zelda NES - 2nd Quest Screen Layout Changes  (Read 1583 times)

WileyHacker

  • Jr. Member
  • **
  • Posts: 12
  • Hey there, buddy chum pal...
    • View Profile
Legend of Zelda NES - 2nd Quest Screen Layout Changes
« on: May 15, 2022, 07:49:02 pm »
I can't figure out which ROM offsets determine which screen layouts change.
Does anyone know which ROM offsets these are?
Thanks.
« Last Edit: May 17, 2022, 11:19:00 pm by WileyHacker »


WileyHacker

  • Jr. Member
  • **
  • Posts: 12
  • Hey there, buddy chum pal...
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #2 on: May 16, 2022, 05:49:12 pm »
Quote
C - - - - - 0x01805D 06:804D: B9 2D 06  LDA ram_current_quest,Y

Could you explain? I don't know assembly too well.
« Last Edit: May 17, 2022, 11:19:06 pm by WileyHacker »

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #3 on: May 16, 2022, 06:15:45 pm »
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.
« Last Edit: May 16, 2022, 06:24:19 pm by Cyneprepou4uk »

WileyHacker

  • Jr. Member
  • **
  • Posts: 12
  • Hey there, buddy chum pal...
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #4 on: May 16, 2022, 06:29:17 pm »
Unfortunately, this doesn't help me. Thanks, though!

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #5 on: May 16, 2022, 06:32:37 pm »
Quote
2nd Quest Screen Layout Changes

Can you show pictures with differences between both quests?

PowerPanda

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #6 on: May 17, 2022, 02:42:48 pm »
Can you describe what you're hoping to do? LoZ has editors that can help a lot with layout changes.

WileyHacker

  • Jr. Member
  • **
  • Posts: 12
  • Hey there, buddy chum pal...
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #7 on: May 17, 2022, 03:28:16 pm »
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?
« Last Edit: May 17, 2022, 11:19:22 pm by WileyHacker »

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 895
  • I am the baldest romhacker
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #8 on: May 17, 2022, 03:42:53 pm »
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

  • Jr. Member
  • **
  • Posts: 12
  • Hey there, buddy chum pal...
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #9 on: May 17, 2022, 11:13:46 pm »
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.
« Last Edit: May 20, 2022, 05:23:06 pm by WileyHacker »

gzip

  • RHDN Supporter
  • Jr. Member
  • *****
  • Posts: 87
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #10 on: May 18, 2022, 06:33:06 pm »
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.

Code: [Select]
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

  • Jr. Member
  • **
  • Posts: 12
  • Hey there, buddy chum pal...
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #11 on: May 19, 2022, 12:03:38 pm »
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.

Quote
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
« Last Edit: May 20, 2022, 05:24:10 pm by WileyHacker »

gzip

  • RHDN Supporter
  • Jr. Member
  • *****
  • Posts: 87
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #12 on: May 19, 2022, 01:19:28 pm »
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

  • Jr. Member
  • **
  • Posts: 12
  • Hey there, buddy chum pal...
    • View Profile
Re: Legend of Zelda NES - 2nd Quest Screen Layout Changes
« Reply #13 on: May 20, 2022, 05:18:51 pm »
THANKS! :D
I figured it out!

Code: [Select]
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
« Last Edit: May 20, 2022, 05:24:16 pm by WileyHacker »