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

Author Topic: Help With Zelda 2 (NES)  (Read 454 times)

MASKEDCHEATER

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Help With Zelda 2 (NES)
« on: January 09, 2018, 01:12:15 am »
Hi!
I'm working on changing the opening text for Zelda II: The Adventure of Link.  I changed the lettering good enough but one line of text has that green palette where I used to have the line "1987 Nintendo" (I moved it further down using the Zelda II NES ROM Text Editor).  I want to get rid of the palette so it is white like all the other letters, but I'm at a loss at finding the right line of code in the hex editor.  I don't want to accidentally erase code that could impact the rest of the game, so can anyone help me find the right coding that will change the green palette to white???  Thanks!

Psyklax

  • Hero Member
  • *****
  • Posts: 639
    • View Profile
    • Psyklax Translations
Re: Help With Zelda 2 (NES)
« Reply #1 on: January 24, 2018, 02:47:39 pm »
Can't believe nobody answered you on this since it's such a simple request (maybe the title was too vague) but I'll step in. ;)

TL;DR - change $16B29 in the ROM from 0B to 03.

Long version - let's learn how I did it. :D

The palette in NES games is controlled by 64 bytes at the end of each nametable in the PPU's memory - in the case of this green Nintendo text, $2BC0 to $2BFF. Each byte controls an area of 4x4 tiles, split further into four quadrants, so each square of four tiles has to share the same palette - one of the NES's limitations. Two bits in each byte choose which of four palettes to use, and the main text unsurprisingly uses the first palette for it: thus, before the Nintendo logo appears, each byte in the table says "00". When the logo comes along, part of it changes to "05" to reflect the new palette. We need to know where the game gets that "05" from.

I set a write breakpoint in FCEUX's debugger for the whole table ($2BC0-2BFF). Eventually I see the numbers are coming from around $305 in RAM. Now, this part of RAM is obviously used for lots of things, so I need to know where THAT address got its numbers from. Set a write breakpoint for $305, and look for when the previous instruction has "05" (because that's the number we need to change). Run, run, run... oh, $AB0B has "05" in it. Let's go there.

Okay, it has eight bytes that will go into the table, seven with "05" and one with "CC". But look before it: there's another eight bytes with "00" and "CC", at $AB03. Guess that's what's normally used for the text, then. Well, if we find the bit that tells the game to load from $AB0B, we can change it to load from $AB03, right? So where does it get that address from?

Look at the instruction in the debugger again (the one at $ACD9). Load from $02... okay, look up, cause such a low address probably only just got written to for this bit. Ooh, look at $ACBA: load from somewhere and store at $02 and $03. Bingo. So see where it gets the "0B" part from? That's right, $AB19. Go there in the hex editor and right-click, "go here in ROM file", takes us to $16B29. Looks like it's an odd one out in a sea of "03"s. Let's fix that!

Change that "0B" to "03" and reset. Your green text is now white. 8)

I hope that was educational. Assembly isn't nearly as hard to learn as it seems! Good luck with your hack! :D

MASKEDCHEATER

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: Help With Zelda 2 (NES)
« Reply #2 on: January 24, 2018, 03:19:00 pm »
Can't believe nobody answered you on this since it's such a simple request (maybe the title was too vague) but I'll step in. ;)

TL;DR - change $16B29 in the ROM from 0B to 03.

Long version - let's learn how I did it. :D

The palette in NES games is controlled by 64 bytes at the end of each nametable in the PPU's memory - in the case of this green Nintendo text, $2BC0 to $2BFF. Each byte controls an area of 4x4 tiles, split further into four quadrants, so each square of four tiles has to share the same palette - one of the NES's limitations. Two bits in each byte choose which of four palettes to use, and the main text unsurprisingly uses the first palette for it: thus, before the Nintendo logo appears, each byte in the table says "00". When the logo comes along, part of it changes to "05" to reflect the new palette. We need to know where the game gets that "05" from.

I set a write breakpoint in FCEUX's debugger for the whole table ($2BC0-2BFF). Eventually I see the numbers are coming from around $305 in RAM. Now, this part of RAM is obviously used for lots of things, so I need to know where THAT address got its numbers from. Set a write breakpoint for $305, and look for when the previous instruction has "05" (because that's the number we need to change). Run, run, run... oh, $AB0B has "05" in it. Let's go there.

Okay, it has eight bytes that will go into the table, seven with "05" and one with "CC". But look before it: there's another eight bytes with "00" and "CC", at $AB03. Guess that's what's normally used for the text, then. Well, if we find the bit that tells the game to load from $AB0B, we can change it to load from $AB03, right? So where does it get that address from?

Look at the instruction in the debugger again (the one at $ACD9). Load from $02... okay, look up, cause such a low address probably only just got written to for this bit. Ooh, look at $ACBA: load from somewhere and store at $02 and $03. Bingo. So see where it gets the "0B" part from? That's right, $AB19. Go there in the hex editor and right-click, "go here in ROM file", takes us to $16B29. Looks like it's an odd one out in a sea of "03"s. Let's fix that!

Change that "0B" to "03" and reset. Your green text is now white. 8)

I hope that was educational. Assembly isn't nearly as hard to learn as it seems! Good luck with your hack! :D

You, sir, are supremely awesome!!!  Thank you so much!!!  :D