I started writing code for SNES joypad emulation within NES. As the real SNES pad is a slight extension of the NES one, it could have been done with a few lines of code extending the existing joypad. But with a tiny bit more elbow work setting up the connection I was able to just reuse the existing SNES joypad device by emulating an adapter that connects the relevant pins—just like a real adapter. And now the real payoff: I don't have to write SNES mouse emulation! God, I love MAME.
Edit: Nice. It turns out the NesDev competition compilation carts have mouse games/demos if anybody wants to try it out. In the NES software list set a53vol1 has a game called Thwaite (like Missile Command), and a53vol2 has the game Sliding Blaster and a Theremin demo (for annoying your coworkers).