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

Author Topic: Legend Of Zelda Red Ring Bug  (Read 1167 times)


  • Newbie
  • *
  • Posts: 4
    • View Profile
Legend Of Zelda Red Ring Bug
« on: April 20, 2020, 11:52:25 pm »
Hi there. I noticed, while play-testing my own hack, that when Link picks up the Red Ring in Dungeon 9, sprite palette 03 gets reverted to the normal dungeon palette.

The bug is in the original game - it's not something that I introduced. But it's not noticeable because the color of the dungeon is exactly the same as the color of the lower dungeon where you pick up the special items - grey and grey.

The only clue I found was in Mesen's PPU editor. Sprite palette 03 gets changed from 0F 0F 10 30 to 0F 16 10 30.

I looked through the debugger and found where the game updates Link's tunic color, but I couldn't find anything that would change the palette when picking up the Red Ring. I'm new to ASM. Any ideas? Anyone noticed this before? Thanks!


  • Jr. Member
  • **
  • Posts: 14
    • View Profile
Re: Legend Of Zelda Red Ring Bug
« Reply #1 on: April 22, 2020, 01:53:30 am »
If you know what's changing, then it should be a trivial matter to discover where it's changing.

Mesen's debugger allows you to set breakpoints on memory changes - and in particular, it allows you  to set breakpoints in PPU memory in addition to CPU memory. So all you have to do is set a breakpoint on the range of PPU memory values that correspond to palettes ($3F00-$3F10 - or you can restrict the range down to the specific palette you're interested in), and then follow the call stack in the debugger to find what function is setting it (or else perhaps just step around in the code - or even just backstep the code, since Mesen has that excellent code-rewinding feature!).

That being said, I'm confused by something that you've said. First of all, you specifically refer to sprite palette 03 getting reverted, but not being noticeable because the dungeon color stays the same. A sprite palette change could never impact the dungeon color, because the dungeon colors would use the background palettes, rather than the sprite palettes. Did you mean background palette 03?

If you actually mean the sprite palette changed, then that's very likely not a bug. If I google "red ring color zelda" (without the quotes), the blurb at the top of the page points out that Link's tunic changes color to a reddish-brown with the ring. You mentioned a 0F changed to a 16, and sure enough 16 corresponds to a reddish, possibly-interpretable-as-brownish color (though the other palette items don't look like they'd correspond to a Link sprite to me...)

BTW this page seems to have information about how color works in LoZ. Hope something of that helps!


  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Legend Of Zelda Red Ring Bug
« Reply #2 on: April 24, 2020, 07:25:57 am »
Thank you so much, nattou. Everything you posted is helpful. I haven't had a chance, yet, to read the zelda classic link, but I will read it.

The color 16 value that I was referring to is PPU memory $3F0D, so you were right. It is a background palette, not a sprite palette.

So, making the breakpoint at PPU memory $3F0D, I saw a bit of what the game is doing wrong. The colors found in PPU $3F00 to $3F1F are taken from CPU memory $6B81 to $6BA0, which are the main dungeon colors, loaded when you first enter the dungeon.

I think what I want it to do is load the colors for the lower dungeon instead of the main dungeon. I don't know how to do that yet. I'll doing some more reading and figuring and post more questions here when I figure out what I need to ask :P

Thanks again!

April 25, 2020, 11:31:14 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
I'm back again. I tried to insert my code by adding it to a random subroutine ($E640) that came after the colors were updated, but it was the wrong subroutine because the game wouldn't load!

My subroutine looks like this:

A2 08      LDX #$08
BD 1A 6C   LDA $6C1A, X
9D 89 6B   STA $6B89, X
CA         DEX
D0 F7      BNE (backwards 7 bytes)
A9 00      LDA #$00
20 40 E6   JSR $E640

$6C1A to $6C21 are where the lower dungeon colors are located, so I just wanted to copy them into $6B89 to $6B90.

So my questions are: How do I know where I can add my code? Is there a better way of writing the subroutine? The A & X registers were zero before the subroutine, so I just made sure they were as I found them. Thanks!
« Last Edit: April 25, 2020, 11:31:14 pm by Hasmal »