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

Author Topic: smb3 help thread regarding PPU  (Read 635 times)

zacmario

  • Jr. Member
  • **
  • Posts: 40
    • View Profile
smb3 help thread regarding PPU
« on: September 12, 2017, 09:43:31 am »
I am trying to help a friend with an smb 3 hack. But I can't seem to understand how the PPU talks with the CPU.
We want to change the formation of the flashing tile A9 after you collect 3 of the same level cards i.e. 3 stars makes the big star on the screen. I found the area in ppu ram around 2040 the top left visible screen. I logged code while this happened I can't see A9 even mentioned other the fact it's an op code LDA. I read on the internet but was left more confused. Seems the PPU might pull from ram? But I can't find where the cpu stored to ram in the trace log.
Any info would be great.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6174
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: smb3 help thread regarding PPU
« Reply #1 on: September 12, 2017, 04:39:31 pm »
PPU RAM data is (usually) not contained in the CPU RAM.

The CPU can only send data to the PPU RAM by writing the PPU address (2 bytes) to (CPU) $2006 and then writing the data one byte at a time to $2007.
Since PPU can only reliably be written to during Vblank, games are often set up so that they will have a section of RAM set up for PPU write codes and then set up a flag to tell the Vblank routine when it should copy data to the PPU (by reading that data block, which can be however the game programmers want).
Quote
Sir Howard Stringer, chief executive of Sony, on Christmas sales of the PS3:
"It's a little fortuitous that the Wii is running out of hardware."

zacmario

  • Jr. Member
  • **
  • Posts: 40
    • View Profile
Re: smb3 help thread regarding PPU
« Reply #2 on: September 13, 2017, 08:56:30 am »
ok how/where does the ppu get it's information? I went all through the rom , looking for some kind of table with alot of $a9 and found nothing.

Psyklax

  • Sr. Member
  • ****
  • Posts: 412
    • View Profile
    • Psyklax Translations
Re: smb3 help thread regarding PPU
« Reply #3 on: September 13, 2017, 09:48:52 am »
You need to use the debugger in FCEUX to find that out. Generally you follow a trail. For example, you see the pattern appear in PPU RAM, so you make a breakpoint for that to see where it's getting it from. Often it comes from somewhere in the CPU RAM, so you breakpoint THAT to see where THAT came from. Eventually you'll find something where the Accumulator is loaded from somewhere $8000 or more - that is, the ROM. FCEUX let's you go to that point in ROM and Bob's your uncle. :)

This is how I find everything in NES games, FCEUX makes things so much easier. The more you understand how the assembly works, the easier it becomes.

zacmario

  • Jr. Member
  • **
  • Posts: 40
    • View Profile
Re: smb3 help thread regarding PPU
« Reply #4 on: September 14, 2017, 06:41:10 am »
These are really good instructions, but I still don't understand what I'm missing.I put a breakpoint On $2000 ppu. It's the start of that routine. It did stop at a ram address,which  led me to so code that I tried modifying in the hex editor. so objects got messed up and ow map had some spots.
When it breaks do I look at the first address shown or last one?