
Portal 2 remains a masterpiece of puzzle-solving and storytelling, but a recent project by a modder known as PortalRunner elevates this classic to uncharted territory: running a Nintendo Entertainment System (NES) emulator inside the game itself.
Portal 2 has always been a modder’s paradise, its Squirrel scripting language acting like a digital sandbox where creators can bend the game’s rules to their will. PortalRunner’s project took this freedom and ran wild with it. The goal? To get Super Mario Bros. running on a fully coded NES emulator, all crafted in Squirrel and confined within the game’s virtual walls.
- Build an interactive, 1980s-style TV set displaying the classic Super Mario Bros. game & activate it with LEGO Mario figure (not included)
- Authentic details of the NES console are recreated in LEGO style, including a controller and an opening slot for the buildable Game Pak
- The TV has a handle-operated scrolling screen, Mario figure reacts to the on-screen enemies, obstacles and power-ups when placed on the top

Pulling this off meant wrestling with Portal 2’s hard limits. The game can only juggle so many in-game objects before it crashes, making it impossible to directly mimic the NES’s hardware, which would require thousands of virtual parts. PortalRunner’s clever workaround was to port smolnes, a lightweight emulator designed to sip resources, into Squirrel. By translating smolnes’ C-based code into Portal 2’s scripting language, the project dodged the object cap, using smart scripting tricks to replicate the NES’s behavior without sending the engine into a tailspin.

Porting smolnes was a beast of a challenge. Squirrel’s flexibility is great, but yet it still lags behind C’s raw speed, and the NES’s 6502 processor doesn’t exactly play nice with Portal 2’s scripting setup. PortalRunner had to bridge the gap between C’s memory management and Squirrel’s event-driven quirks, all while keeping the NES’s architecture focused. Every line of code was a balancing act, ensuring the emulator stayed true to the NES while keeping Portal 2 from buckling under the pressure.
The payoff is a working—if slightly hobbled—NES emulator. Super Mario Bros. chugs along inside Portal 2, its pixelated sprites and chiptune soundtrack rendered at a low-res, stuttering frame rate, thanks to Squirrel’s performance limits compared to native hardware or modern emulators. It’s a compromise, but a wildly impressive one.
For anyone itching to try this mod, you’ll need Portal 2 and a knack for tinkering. Getting the emulator up and running means loading PortalRunner’s Squirrel scripts into the game’s framework—a process that’ll feel like home to seasoned modders but might be a fun learning curve for newcomers.
[Source]





