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

Author Topic: Way to trace button presses? (NES)  (Read 1832 times)

The3Dude

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Way to trace button presses? (NES)
« on: May 09, 2019, 04:36:46 pm »
If anyone knows how please let me know. :-\

I'm looking to make a better saving feature for Zelda 1, so no more UP+A save trick.

Specifically trying to make pressing select on controller 1 while in subscreen cause save screen to appear, instead of up and A on controller 2.
« Last Edit: May 09, 2019, 04:45:48 pm by The3Dude »
~The3Dude~

nesrocks

  • Hero Member
  • *****
  • Posts: 570
    • View Profile
    • nesrocks.com
Re: Way to trace button presses? (NES)
« Reply #1 on: May 09, 2019, 04:38:07 pm »
So is this an ASM question?

The3Dude

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Way to trace button presses? (NES)
« Reply #2 on: May 09, 2019, 04:41:07 pm »
Maybe? Would you need ASM to go about doing so?
~The3Dude~

POWCo-op

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: Way to trace button presses? (NES)
« Reply #3 on: May 09, 2019, 05:30:04 pm »
I'm not enlightened as to what you mean by trace. Maybe replace?
Now you're playing in... three dimensions.

Psyklax

  • Hero Member
  • *****
  • Posts: 1002
    • View Profile
    • Psyklax Translations
Re: Way to trace button presses? (NES)
« Reply #4 on: May 09, 2019, 05:46:31 pm »
Well, it's not very hard if you know assembly and can read a trace log or debugger. Let me take a look...

Go to $140EA in the ROM and change A5 FB 29 88 C9 88 to A5 FA 29 20 C9 20. What this does (normally) is load the button presses on Controller 1, strip out any controller input that isn't Up+A and then checks if it's Up+A that's being pressed. By changing 88 to 20, it checks to see if Select is held instead of Up+A, and by changing FB to FA, it checks Controller 1 not 2.

How did I do it? Simple: I paused, started a trace log, held Up+A and went forward a few frames, stopped the trace log, searched for $4017 in the log (the register used to read Controller 2) and found the routine for checking controller input. Then I could see that $88 was what I pressed, so I searched for $88 and bam, there's the check. I could've searched for $FB since that's the RAM address where the buttons are stored, but whatever, it took me two minutes so whatevs. :D

If anyone has a Game Genie with a real copy of the game, here's your three codes:
XNSELEUN, AXSEIEEA, AXSEYEEA
Though if you have to type in all three codes every time you play, it kinda defeats the point. :)
« Last Edit: May 09, 2019, 05:54:14 pm by Psyklax »

The3Dude

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Way to trace button presses? (NES)
« Reply #5 on: May 09, 2019, 06:11:37 pm »
Thank you Psyklax! That was an extremely helpful explanation! It works perfectly, thank you!! :woot!: :D

Also the only thing I added when I edited the post was the line starting at "Specifically"

P.S I'm giving you credit for that in the credits. :thumbsup:

~The3Dude~