You Can Now Run Doom Inside of Doom

The only thing left to port Doom to is a literal hell portal.
A screenshot from Ultimate Doom where a demon charges at the player, who holds a shotgun.
Screenshot by iD Software.

Humanity’s mastery over both black magic and technology has progressed to a dangerous point, evidenced by Doom modder kgsws’ mod which allows you to run Chocolate Doom, a source port of Doom, inside of the DOS version of Doom. I fear that things like this only bring us closer to producing our own Hell portals on Mars. Hackaday was the first to cover the mod.

Doom has been ported to just about everything, from trucks, to toasters, to, yes, other modified versions of Doom, now, not even the original game is safe from itself. The original Doom was coded by multiple people, which leads to a series of redundancies and otherwise inexplicable choices around spawning objects. There is, for example, a part of Doom’s code which spawns a player. In doing so, it stores their location in an index equivalent to the number in their name minus one, so the location of player one is stored in Index 0. Player zero’s location would be stored in Index -1, which just so happens to be used for setting the state of things in game—this allows you to overwrite whatever is supposed to be in the game’s memory for a given object.

This memory manipulation allows you to alter the state of an object, which governs things from appearance to, occasionally and inconsistently, function. States are primarily used for animating sprites, but some states have an associated action like finding and running a specific part of the game’s code—this includes other executables. For example, State 347 runs the code that makes a Revenant (which is just listed as “SKEL” in the list of sprites) scream. This happens before any other part of the state, so if you have an action that never ends, nothing else about the state actually matters. This exploit allows Doom to run other executables, including other versions of Doom like Chocolate Doom. Alternatively, it allows you to inject other pieces of code, like the ability to aim with your mouse, directly into the game. 

If you would like to do so, you can get the code and instructions on kgsws’ github.