A few days ago I made these to test my zapper. Thought I'd post them in case they're useful to anyone else.
zapper_light.nes
Displays a white square in the middle of the screen. Generates 60hz buzz on any frame the zapper detects light. (Polls continually through frame until it finds light.) Trigger is irrelevant. Zapper on controller port 2.
zapper_trigger.nes
Generates 60hz buzz on any frame the trigger signals. Light is irrelevant. Zapper on controller port 2.
zapper_stream.nes
Reads the trigger once per frame and displays a stream of data on the screen. Zapper on controller port 2.
zapper_flip.nes
Same as zapper_light.nes except pulling the trigger will black the screen, in order to test black to white transitions.
I don't have a CRT. I thought I'd see if there's any hope of the zapper picking up an LCD TV but I figure it's just way too dim compared to the momentary brightness of a CRT? Maybe there are other factors. I can get a light signal by sticking it right up against a lightbulb, at least. I also managed to get a 1-frame blip by shining an LED flashlight into it, and during the moment it switches on or off I get a signal on that frame, but not while it's just shining in.
The trigger is kind of interesting. I can get a constant signal if I squeeze to a point just before the click. If I click it down, it tends to signal for a few frames then stops. I notice Duck Hunt has a software de-bounce filter about 5 frames long, which seems like a good idea.
Edit: added source code.
Edit: added zapper_stream test.
Edit: added zapper_flip test.
zapper_light.nes
Displays a white square in the middle of the screen. Generates 60hz buzz on any frame the zapper detects light. (Polls continually through frame until it finds light.) Trigger is irrelevant. Zapper on controller port 2.
zapper_trigger.nes
Generates 60hz buzz on any frame the trigger signals. Light is irrelevant. Zapper on controller port 2.
zapper_stream.nes
Reads the trigger once per frame and displays a stream of data on the screen. Zapper on controller port 2.
zapper_flip.nes
Same as zapper_light.nes except pulling the trigger will black the screen, in order to test black to white transitions.
I don't have a CRT. I thought I'd see if there's any hope of the zapper picking up an LCD TV but I figure it's just way too dim compared to the momentary brightness of a CRT? Maybe there are other factors. I can get a light signal by sticking it right up against a lightbulb, at least. I also managed to get a 1-frame blip by shining an LED flashlight into it, and during the moment it switches on or off I get a signal on that frame, but not while it's just shining in.
The trigger is kind of interesting. I can get a constant signal if I squeeze to a point just before the click. If I click it down, it tends to signal for a few frames then stops. I notice Duck Hunt has a software de-bounce filter about 5 frames long, which seems like a good idea.
Edit: added source code.
Edit: added zapper_stream test.
Edit: added zapper_flip test.