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

Author Topic: NES Arkanoid / Chase HQ - Help Needed!  (Read 2215 times)

uXe

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
NES Arkanoid / Chase HQ - Help Needed!
« on: November 30, 2013, 06:15:47 pm »
I am working on an Arduino-based project to basically connect a Wii Nunchuk controller to a NES as if it were a NES control pad. I thought it would also be fun to have the Nunchuk be able to act as if it were an Arkanoid paddle as well! The problem is that the project is wired up to send input as a NES control pad on controller port 2 (bit 0 of $4017) but these Famicom ROMs read the paddle position from bit 1 of $4017 :(

So I was wondering how difficult it would be to hack the Arkanoid and Chase HQ ROMs to read the paddle position from bit 0 instead of bit 1? and I guess also making sure that those ROMs are not also trying to read a control pad on bit 0 of $4017 which could cause unwanted confusion!!

Thank you for any help you can offer! :)

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7086
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: NES Arkanoid / Chase HQ - Help Needed!
« Reply #1 on: November 30, 2013, 08:45:48 pm »
But bit 0 is used for standard controller input on the NES.

As to hacking the ROM (building the controller, well I'm going to assume you know more about that), it's probably very simple if you find the controller input routine (and by finding, I mean use a debugger to see a breakpoint for reads on 4016/4017 and you'll find it instantly) to switch it from bit 1 to bit 0. Games usually just read $4016/4017 then lsr/ror the bit into the Carry bit then ror/rol the Carry bit into some RAM address that stores the push/hold status for the entire controller.
So, NOP one of those shifts that moves bit 1 to carry through bit 0. (and probably NOP the part that stores the original bit 0 data)
A normal controller will no longer function correctly, but there's probably no way to make it not function at all.
"My watch says 30 chickens" Google, 2018

uXe

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: NES Arkanoid / Chase HQ - Help Needed!
« Reply #2 on: November 30, 2013, 09:11:28 pm »
But bit 0 is used for standard controller input on the NES.

My thought was that I could leave the reading of bit 0 intact on port 1 ($4016) for standard controller input, and only disable it on port 2 ($4017) if it exists, to avoid any conflicts.

As to hacking the ROM (building the controller, well I'm going to assume you know more about that), it's probably very simple if you find the controller input routine (and by finding, I mean use a debugger to see a breakpoint for reads on 4016/4017 and you'll find it instantly) to switch it from bit 1 to bit 0. Games usually just read $4016/4017 then lsr/ror the bit into the Carry bit then ror/rol the Carry bit into some RAM address that stores the push/hold status for the entire controller.
So, NOP one of those shifts that moves bit 1 to carry through bit 0. (and probably NOP the part that stores the original bit 0 data)
A normal controller will no longer function correctly, but there's probably no way to make it not function at all.

Thank you for the explanation! I have to admit it is a little 'greek' to me at the moment, but at least I know where to start digging now - cheers! :D

uXe

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: NES Arkanoid / Chase HQ - Help Needed!
« Reply #3 on: December 19, 2013, 12:19:16 am »
Just wanted to check back and say that I managed to get Arkanoid to behave the way I needed it to - thank you again for pointing me in the right direction! :)

I've just put up a video for the project:

http://www.youtube.com/watch?v=6SIU_qhdpek