Author Topic: Modern Mallard: a kit to make the NES game Duck Hunt work on an LCD TV  (Read 1201 times)

0 Members and 1 Guest are viewing this topic.

Offline Teuobk

  • Contributor
  • Posts: 26
  • Country: us
I'm happy to announce (and flog) my kit that makes the NES game Duck Hunt work on modern LCD TVs: Modern Mallard.

The problem was that Duck Hunt and the Zapper light gun only work with CRT (tube) TVs, not modern TVs with LCD or OLED screens. Modern Mallard fixes that. The kit consists of a replacement board for the Zapper and a patch board for the game.

The Zapper replacement board was necessary because the original Zapper had a bandpass filter around 15 kHz, corresponding to the horizontal refresh rate of a CRT TV. My replacement board, among other things, is responsive to light all the way down to a DC (i.e., no) modulation frequency, which is what you'd see coming from a "flicker free" LCD TV. It also includes logic to filter out the effects of room lighting, even fluorescent and LED room lights. It has four main blocks: a photodiode, a transimpedance amplifier, a gain stage with servo support to keep the signal from clipping, and a microcontroller. The microcontroller, a PIC16F18313, samples the amplified signal with its ADC, performs various types of filtering, adjusts the servo level on the gain stage as needed, and emits a binary signal to the NES over the standard NES controller port.

Photo of the replacement Zapper board:



The second piece, the game patch board, is necessary because modern TVs have considerably more latency on their video inputs than did old CRT TVs. Whereas CRT TVs would display whatever signal was being sent to them virtually instantly, LCD TVs typically add somewhere between 16 and 100 ms of lag between when the signal is received and when the resulting picture is displayed on the screen. Duck Hunt assumes that there will be basically zero lag, but when there is lag, the game is already well past its shot-handling and hit-detection code before the relevant special images are even displayed on the LCD screen.

I patched the game to accommodate a variable amount of delay, effectively rewriting the entire shot-handling and hit-detection modules of the game and adding an auto-calibration feature -- about 10% of the game code overall. The emulator FCEUX was invaluable for this, since I obviously was just patching the binary (no source code). Once the patched game was debugged on the emulator, I moved it to a EverDrive flash cart, and finished up debugging on a real NES with a real LCD TV.

I knew I couldn't distribute the game itself, so I created a board that would go between the existing Duck Hunt game cartridge and the NES and would apply the patch on the fly. Kind of like a Game Genie, but much more advanced. Although the obvious path for that would be an FPGA, I chose to go with a fast ARM Cortex-M4-core 5 V microcontroller made by NXP. That microcontroller is fast enough to check the address on the cartridge (or really, the NES system) address bus, determine whether a patch should be applied, and present (or not) the patched data on the NES data bus in considerably less than 1 NES CPU cycle. Since I could execute only a few dozen instructions in that time window, I had to be very careful about programming, and most of it was written in ARM Thumb-2 assembly.

The other big challenge with the patch board was procuring the requisite 72-pin female card edge connector, since Nintendo used a 2.50 mm pin pitch on their game cartridges instead of the standard 2.54 mm pitch, and the cumulative error would cause pin shorts.

Here's a photo of the patch board, which fits inside the original game cartridge along with the original game PCB:



How does it work? Great! There's a video of it working over on the Modern Mallard Kickstarter page.

The game plays like normal. The only obvious difference is that you must start the game by "zapping" the menu screen with the Zapper so that the patched game can calibrate to the delay in your TV. After that, it's business as usual: just point the Zapper at a duck and pull the trigger. The modified Zapper board technically requires a view of the TV screen for at least 64 ms prior to the shot in order to set its slicer level correctly, but that's basically imperceptible.

As for the Kickstarter, I figured I'd do a production run of these in case any other Duck Hunt enthusiasts out there were interested. I'm not planning to make it into a long-term thing, since the market is pretty small. If there's enough interest, then great -- I can start production immediately. If there isn't enough interest, then hey, at least I can still play Duck Hunt on my LCD TV.  :D
 
The following users thanked this post: ajb

Offline agehall

  • Regular Contributor
  • *
  • Posts: 177
  • Country: se
Did you figure out a way to source 2.5mm connectors? I'm interested in finding some for a project of my own...
 

Offline Teuobk

  • Contributor
  • Posts: 26
  • Country: us
Did you figure out a way to source 2.5mm connectors? I'm interested in finding some for a project of my own...

Yup, I had them custom-made by a manufacturer in China. Here's the story about how I did that.
 
The following users thanked this post: thm_w, larsdenmark, laneboysrc, ebastler, knapik

Offline agehall

  • Regular Contributor
  • *
  • Posts: 177
  • Country: se
Nice write up and good pointers for anyone else attempting the same thing!
 
The following users thanked this post: Teuobk

Offline aldolo

  • Contributor
  • Posts: 12
  • Country: it
Great work but maybe you have overextimated the number of nes out of there
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 6390
  • Country: us
There are a lot of NES units out there, I still have mine I got when I was a kid, although I have it connected to a real CRT TV.

For the game cartridge I think it would have been easier to supply one of the various clone cartridges out there and allow users to supply their own ROM. Legal or not, there doesn't seem to be much stopping people from cloning cartridges and sharing ROM images.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf