Modern Mallard: a kit to make the NES game Duck Hunt work on an LCD TV - Page 1
Forum section: electronics / general

author: Teuobk
author_rank: Contributor
timestamp: June 28, 2018, 02:47:58 pm
content: 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 theModern 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.

author: agehall
author_rank: Frequent Contributor
timestamp: June 28, 2018, 04:56:10 pm
content: Did you figure out a way to source 2.5mm connectors? I'm interested in finding some for a project of my own...

author: Teuobk
author_rank: Contributor
timestamp: June 28, 2018, 04:58:02 pm
content: Quote from: agehall on June 28, 2018, 04:56:10 pmYup, I had them custom-made by a manufacturer in China.Here's the story about how I did that.

author: agehall
author_rank: Frequent Contributor
timestamp: June 28, 2018, 05:44:41 pm
content: Nice write up and good pointers for anyone else attempting the same thing!

author: aldolo
author_rank: Contributor
timestamp: July 05, 2018, 06:30:23 am
content: Great work but maybe you have overextimated the number of nes out of there

author: james_s
author_rank: Super Contributor
timestamp: July 05, 2018, 05:37:41 pm
content: 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.

author: cletusdabomb85
author_rank: Newbie
timestamp: November 23, 2018, 04:07:07 pm
content: Not only are there still a of functioning NES left out there, a few companies have developed clones of the NES and other old systems. I still have my old NES and I have a RetroN5. The RetroN5 accepts original controllers, and certain after market controllers. The RetroN5 is capable of patching games with IPS format patches using an SD card. That said, would it be possible to get the patch in the IPS format instead of on the Modern Mallard board, and just get the upgrade board for the zapper? With the IPS patch and the zapper upgrade I could slap my duck hunt cart into the RetroN5, patch the game and play on my lcd.

author: Mr. Scram
author_rank: Super Contributor
timestamp: November 23, 2018, 04:33:12 pm
content: Quote from: Teuobk on June 28, 2018, 04:58:02 pmVery nice, thanks for sharing that. Would you be willing to give us a ballpark figure on what something like that costs?