News: 11 March 2016 - Forum Rules

Author Topic: Clu Clu Land P1 PPU adress editing  (Read 1706 times)

szemigi

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
Clu Clu Land P1 PPU adress editing
« on: March 06, 2019, 09:48:56 am »
Help me!
I want to edit the PPU of the first player palette (which is red) to be blue. But in the PPU memory I can't even edit the P1 palette as it changes back to red again.

Debugger needed? ASM coding? Help me.

Psyklax

  • Hero Member
  • *****
  • Posts: 1112
    • View Profile
    • Psyklax Translations
Re: Clu Clu Land P1 PPU adress editing
« Reply #1 on: March 06, 2019, 01:28:54 pm »
Come on, dude, I helped you with Mortal Kombat, I was hoping you'd have learnt from it. :)

First of all, the player is a sprite, and sprites aren't modified in the PPU's VRAM, it's in the OAM:

http://wiki.nesdev.com/w/index.php/PPU_OAM

Debugger needed? ASM coding? Help me.

Yes and yes. :) Of course it changes back to red, the game updates it every frame. What you need to do is set a write breakpoint for one of the four sprites, which are located in OAM around $200.

So after a quick trace log, I see the desired number comes from $9, which comes from $408. A write breakpoint to $408 sees it originates from $CC3A ($C4A in ROM), and around there you can see some other similar numbers, which are probably also used for the player 1 sprite.

Now we can just change $408 from $40 to $42, but for reasons which I can't be bothered to explain, the game does an AND #$C0 to that number, so it still ends up being $40. So what do we do? We go to $F639 ($3649 in ROM) and change 29 C0 to 29 C2. Woo, when you start the game, you're blue (da-ba-dee da-ba-daa).

Now we just need to change the other numbers around $C4A accordingly (00 to 02, 40 to 42) and we're done. You might need to do some more breakpoint setting and trace logging to figure out precisely which bytes apply to the player 1 sprites (up down left right, holding out an arm etc).

So, in short: change $364A to C2, then add 2 to every byte from $C48 to $C57. After further checking I discovered you also need to add 2 to every byte from $2438 to $2447, as well: this is for the turning sprites.

Unfortunately the end of level sprite uses a different routine (EOR #$40) to flip the sprite left and right, and I can't think how to make it start off with $02 so that it flips between $02 and $42. So never mind. Still, it's a start! :)

szemigi

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
Re: Clu Clu Land P1 PPU adress editing
« Reply #2 on: March 07, 2019, 06:12:36 am »
I checked for the values and it worked, but what about the palette, when P1 and P2 standing? (You know, light red-dark red colors.)

Psyklax

  • Hero Member
  • *****
  • Posts: 1112
    • View Profile
    • Psyklax Translations
Re: Clu Clu Land P1 PPU adress editing
« Reply #3 on: March 07, 2019, 07:31:45 am »
I checked for the values and it worked, but what about the palette, when P1 and P2 standing? (You know, light red-dark red colors.)

You could say 'thank you'... ::)

But I looked again at the routine and noticed something I could do differently: change $188 from 00 to 02 and P1 on the end level screen is now blue. :) You still need to go through all the other stuff for the main game, but at least that part is easy.

Any more questions? Maybe you could try doing what I mentioned and learn to do it by yourself? ;) It's not as hard as you think! :)

szemigi

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
Re: Clu Clu Land P1 PPU adress editing
« Reply #4 on: March 07, 2019, 08:06:45 am »
I say thank you. Sure. I don't even know what else to say as a lots of people (respect for the exception) just don't care of my problem(s).