VS. Duck Hunt zapper not responding properly [SOLVED]

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
Quietust
Posts: 1557
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: VS. Duck Hunt zapper not responding properly

Post by Quietust » Fri Jun 24, 2016 4:42 am

zeroone wrote:@Quietust In the controller port write function below, does PPU::DrawArray contain prior frame pixel values within the region that has yet to be updated? Or, is PPU::DrawArray cleared between frames?
I don't remember whether it's cleared or not, but it is updated in real time, and the checks against PPU::SLnum and PPU::Clockticks ensure that it will never attempt to read data that has not yet been rendered.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.

User avatar
zeroone
Posts: 932
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: VS. Duck Hunt zapper not responding properly

Post by zeroone » Fri Jun 24, 2016 3:22 pm

Quietust wrote:I don't remember whether it's cleared or not, but it is updated in real time, and the checks against PPU::SLnum and PPU::Clockticks ensure that it will never attempt to read data that has not yet been rendered.
I see that check in the code. Thanks.

Do the VS Zapper games have some sort of copy protection that prevents them from advancing beyond the player select screens?

Edit: The VS Zapper works correctly in VS Freedom Force and VS Gumshoe in my emulator. It fails to work properly in VS Duck Hunt and VS Hogan's Alley.

User avatar
zeroone
Posts: 932
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: VS. Duck Hunt zapper not responding properly

Post by zeroone » Mon Jun 27, 2016 6:51 am

To get past the player-selection screen issue in my emulator, I started up the game in FCEUX and I copied CPU RAM $0000--$2000 from FCEUX to my emulator. Unfortunately, the VS Zapper still does not work during gameplay either. However, this suggests it is not a missing copy protection feature.

Since my VS Zapper implementation works in VS Freedom Force and VS Gumshoe, it could be some sort of timing issue in VS Duck Hunt. But, it's really strange that normal Duck Hunt works just fine.

I'm open to suggestions on things I can try. Thanks.

pc-10.com
Posts: 3
Joined: Mon Apr 11, 2016 8:12 pm

Re: VS. Duck Hunt zapper not responding properly

Post by pc-10.com » Mon Jun 27, 2016 1:50 pm

I'm not familiar with the nes side of stuff, I am familiar with the VS side of things.
If this stuff has already been covered then you can skip it.

Vs Hogans alley and vs duck hunt do the gun check, which is just a ground loop.
Freedom force and gumshoe dont look for it... They will work with or without the ground loop.

Vs gun is also connected to the player 1 controls on the real cab. Taking place of the joystick and ect.
So its programed differently.

Just like i can split up the nes rom of wildgunman and put it on an actual vs pcb, the game will physically run, but the gun does nothing. The code isnt the same for location of gun.

User avatar
zeroone
Posts: 932
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: VS. Duck Hunt zapper not responding properly

Post by zeroone » Mon Jun 27, 2016 2:33 pm

pc-10.com wrote:I'm not familiar with the nes side of stuff, I am familiar with the VS side of things.
If this stuff has already been covered then you can skip it.

Vs Hogans alley and vs duck hunt do the gun check, which is just a ground loop.
Freedom force and gumshoe dont look for it... They will work with or without the ground loop.

Vs gun is also connected to the player 1 controls on the real cab. Taking place of the joystick and ect.
So its programed differently.

Just like i can split up the nes rom of wildgunman and put it on an actual vs pcb, the game will physically run, but the gun does nothing. The code isnt the same for location of gun.
This is new to me. Can you describe the gun check in more detail? What does the ground loop mean in terms of data made available to the controller port?

lidnariq
Posts: 9403
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: VS. Duck Hunt zapper not responding properly

Post by lidnariq » Mon Jun 27, 2016 3:03 pm

Is it possible that the game is making sure that no light is being sensed on a black frame, and you're still turning the light sensed output on despite pointing at black pixels?

User avatar
zeroone
Posts: 932
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: VS. Duck Hunt zapper not responding properly

Post by zeroone » Mon Jun 27, 2016 3:16 pm

lidnariq wrote:Is it possible that the game is making sure that no light is being sensed on a black frame, and you're still turning the light sensed output on despite pointing at black pixels?
I added logging to my emulator to see when the game was probing the controller ports. On the black frame, it probes once per scanline (8 reads to transfer the byte serially). Each of those probes indicates no light sensed. On the successive white frame, it doesn't do any probing. If it wasn't satisfied with the black frame, why does it even display the white frame? The white frame is followed by a second black frame. No scanline probing takes place in that frame either.

Since the VS Zapper works perfectly in 2 of the 4 VS Zapper games, these 2 are doing some check that my emulator is failing to completely satisfy.

pc-10.com
Posts: 3
Joined: Mon Apr 11, 2016 8:12 pm

Re: VS. Duck Hunt zapper not responding properly

Post by pc-10.com » Mon Jun 27, 2016 3:21 pm

Its a literal ground. The "alarm" ties to ground. That wire would translate to player one up on joystick, in the wiring schematic of a vs cab. Right is trigger, left is hit.

pc-10.com
Posts: 3
Joined: Mon Apr 11, 2016 8:12 pm

Re: VS. Duck Hunt zapper not responding properly

Post by pc-10.com » Mon Jun 27, 2016 3:24 pm

I just checked on my cab, if no gun is installed, pressing up on the player 1 joystick closes the circuit and the gun alarm doesnt sound. As soon as i let it go the alarm sounds. So player 1 up needs to be tied to ground to shut down alarm.....

User avatar
zeroone
Posts: 932
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: VS. Duck Hunt zapper not responding properly

Post by zeroone » Mon Jun 27, 2016 3:29 pm

pc-10.com wrote:I just checked on my cab, if no gun is installed, pressing up on the player 1 joystick closes the circuit and the gun alarm doesnt sound. As soon as i let it go the alarm sounds. So player 1 up needs to be tied to ground to shut down alarm.....
This is mentioned on the wiki. I'll check if there is an audible alarm in my emulator if that bit is left unset...

Edit: VS Duck Hunt and VS Hogan's Alley make an annoying audible ringing tone on the title screen if the UP bit is not set. Apparently, the implementation is missing something else.

lidnariq
Posts: 9403
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: VS. Duck Hunt zapper not responding properly

Post by lidnariq » Tue Jun 28, 2016 2:07 pm

I made a tiny configuration file for clever-disasm to have a go at Vs. Duck Hunt:

Code: Select all

JumpTableRoutineWithAppendix $05B3
CertainlyCode $00A0
CertainlyCode $012B
CertainlyData $60F0
CertainlyCode $04D5 PollJoys
CertainlyCode $293C CheckLight
CertainlyCode $2938 CheckTrigger
[/size]

I find the following, three of the four times that CheckLight is called:

Code: Select all

-       $A80E  AD 02 20:    lda $2002
        $A811  29 40:       and #$40
        $A813  D0 09:       bne +               ; $A81E
        $A815  20 3C A9:    jsr CheckLight
How's your sprite 0 hits?

User avatar
zeroone
Posts: 932
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: VS. Duck Hunt zapper not responding properly

Post by zeroone » Tue Jun 28, 2016 3:58 pm

Debugging in my emulator reveals that it does reach $A81E when you pull the trigger on the player-selection screen; the sprite0 hit was detected. In fact, it breaks there twice when you pull the trigger, once on the black screen and once on the white screen.

Also, from debugging in FCEUX, the $A81E code does not appear to be used while the game is running. It's only used in the player-selection screen.

And, I put in some test code to force a sprite0 hit on the first scanline just in case my debugger was lying or something. That did not enable it to pass the player-selection screen.

Something else is going on. Thanks for your help lidnariq. I'm also trying to decipher the source.

lidnariq
Posts: 9403
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: VS. Duck Hunt zapper not responding properly

Post by lidnariq » Tue Jun 28, 2016 4:15 pm

zeroone wrote:And, I put in some test code to force a sprite0 hit on the first scanline just in case my debugger was lying or something. That did not enable it to pass the player-selection screen.
That's backwards ... at least I think it's backwards? It looks like it's only checking for light until the sprite 0 hit.

The other identical fragments are at $A82C and $A867. The last one is similar, now that I look at it more closely, just structured differently. And at $A886.

User avatar
zeroone
Posts: 932
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: VS. Duck Hunt zapper not responding properly

Post by zeroone » Tue Jun 28, 2016 4:33 pm

lidnariq wrote:That's backwards ... at least I think it's backwards? It looks like it's only checking for light until the sprite 0 hit.

The other identical fragments are at $A82C and $A867. The last one is similar, now that I look at it more closely, just structured differently. And at $A886.
It looks like it positions sprite0 in the middle of the first scanline. I assume that enables it to subsequently check each successive scanline for a light/dark hit.

I'm willing to run any test that you can propose. This one is a real mystery.

tepples
Posts: 21980
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: VS. Duck Hunt zapper not responding properly

Post by tepples » Tue Jun 28, 2016 4:50 pm

How well does your emulator handle Zap Ruder (which uses a normal D4/D3 Zapper, not the Vs. Zapper)? It also uses sprite 0 at the top and counts scanlines to determine. If I had a Zapper modified to also speak Vs. protocol, I might be able to help you by making a test ROM.

Post Reply