Emulation is 100% legal as long as the BIOS for the emulated system and any game ROMs are sourced from legal systems/copies iirc
Depending on the Google/Oracle trial fallout, it could become illegal to implement system APIs because of API copyright. So while CPU instruction set emulation is fine, depending on how system emulators work, they could be deemed “illegal”.
There's longstanding emulators for every other Nintendo console