Port Test Cart - How does this work?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
Skrybe
Posts: 33
Joined: Sun Jun 11, 2006 2:52 pm

Port Test Cart - How does this work?

Post by Skrybe »

Copying something here that I posted over at Lost Levels. I'm curious how this thing works, and what it's looking at in that initial test that fails in emulators. It may very well have a simple explanation, but I'm not exactly technically inclined! I dunno if it's ok to post the rom here, but there's a link in the thread I started at Lost Levels. The original post is below:

---

I'm sure some of you have messed around with the Port Test Cart before. It's been dumped for ages, but it doesn't do much of anything in emulators. When you load it up, it just stops with this error message:

Image

On a real system, the cart needs a special peripheral to complete its tests. This peripheral, as far as I know, isn't supported in any emulator, so it's impossible for the test to pass on an emulated system.

I've owned one of these dual controller setups for a while, and using it with a copy of the test cart rom loaded on a Powerpak, I was able to get video of the test cart running to completion. I admit it's not the most thrilling thing to watch, but it's an interesting little bit of NES trivia that was relatively unknown, and completely undocumented.

Here's a closeup of the board inside the controller. This is all that differentiates the peripheral from a pair of regular controllers.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Post by lidnariq »

I don't suppose you could take a picture of the underside of the PCB? It'd be easier to RE what's going on given the traces that connect things.

Here's a few random guesses, mostly just wild speculation:
* Maybe it does something to D3 and D4 (normally only used by the light gun and power pad) to make sure those are ok.
* Maybe the sense of the buttons is inverted (rather than 0V=button pressed instead 5V=button pressed)
Skrybe
Posts: 33
Joined: Sun Jun 11, 2006 2:52 pm

Post by Skrybe »

lidnariq wrote:I don't suppose you could take a picture of the underside of the PCB?
Sure thing.
lidnariq wrote:Maybe it does something to D3 and D4 (normally only used by the light gun and power pad) to make sure those are ok.
I think it may be something along these lines. If you emulate certain accessories, like the Power Pad, it'll change the numbers displayed below that error message in the screenshot. Still doesn't pass, though.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Post by lidnariq »

I confused left and right in the pictures, which slowed me down a bit. Looks like what this does is provide specific magic numbers to D3 and D4, a different one for each controller.

The 4021 in both the top and bottom halves has some of its pins tied high and low, and two of its outputs go to D3 and D4. (I don't know which. red/orange/yellow on the captive NES controller go to red/yellow/green respectively on the other side.)

(The '367 is just serving as a buffer, both of its enables are tied true)

I can't read the entire magic number from the pictures — some of the connections are hidden by the socket.

We could either figure out the exact magic numbers by disassembling the program, or by figuring out which of the black and white wires go to D3 and D4 as well as which pins on the 4021 are tied high or low.
Skrybe
Posts: 33
Joined: Sun Jun 11, 2006 2:52 pm

Post by Skrybe »

lidnariq wrote:Looks like what this does is provide specific magic numbers to D3 and D4, a different one for each controller.
Cool, thanks! That's all I really wanted to know, no need to dig into it any further. That said, if someone does want to figure out the specifics, for emulator support or something, I'm willing to help out however I can.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Post by lidnariq »

Just had a thought: The fastest way to figure out the magic numbers is probably to pull one of the 4021s at a time out of its socket and run the test program. The numbers displayed at the bottom should be two magic numbers and two zeros or FFs. Then swap which 4021 is still socketed and you should be able to get the other two.

You almost certainly already know this, but to be paranoid, when you put a 4021 back, make sure it's in the same orientation as originally, and turn the NES off or unplug the test box when you're reseating/pulling the ICs.
Fiskbit
Posts: 891
Joined: Sat Nov 18, 2017 9:15 pm

Re: Port Test Cart - How does this work?

Post by Fiskbit »

I've documented this controller on the wiki. The images are no longer online, so I've attached them below. Credit to lidnariq for doing most of the work reverse engineering this device.
Attachments
port1.jpg
port2.jpg
port3.jpg
Post Reply