natt wrote:
I recently added zapper emulation to Bizhawk. A few games that I've tried seem to be working, but I want response to be as similar as possible to how it was on real hardware. I tried zapruder, but the docs for it don't seem to give any indication of how hardware should respond.
Here's some numbers I pulled out from manually playing with a white LED, microcontroller, disassembled zapper, and oscilloscope:
- The notional period of a scanline inside the zapper is determined by an RC time constant, so can vary by up to 20% as a function of the parts used. Mine, however, does seem to be tuned to 16kHz to the precision that I can measure.
- The frequency selectiveness of the zapper is really lousy, barely providing 3dB of rejection within the adjacent decade of frequencies
- After the output has fired and no light is falling on the photodiode, the output will go false again after approximately 600-800µs.
- A single sufficiently bright light pulse (measured in terms of total amount of photocurrent, i.e. charge) will cause the light detect output to go true exactly three scanlines later.
- A single dimmer light pulse will still cause the output to go true, but it will randomly vary anywhere between four to sixteen scanlines later
- I was unable to usefully determine what the lower threshold for light detection was
- Periodic input will decrease the delay of the latter case: one of the pins of the IR3T07A rises in a tilted triangle wave (slow rise, fast fall, rising more than falling) after it's been triggered. Light input while the pin is rising causes it to rise faster; light input while the pin is falling has no effect.
- The final output (as seen by the NES) is a hysteretic buffer from the analog signal mentioned in the previous point, which is then inverted twice more before it is seen by the CPU.
The minimum trigger time is exactly determined by the 10kΩ pullup inside the NES and the 10µF capacitor inside the zapper.