This Working NES ROM Has A Secret ZIP File Inside It

When’s a NES ROM not a NES ROM? When it’s a ZIP file. But it doesn’t have to be one or the other; you can have your ROM and uh, eat it too? Coder Vi Grey created a completely valid ROM for the Nintendo Entertainment System that you can also unzip using your archiving application of choice.

To accomplish this feat, Grey took advantage of the fact that the iNES file format, used by ROMs, includes some padding between data sections that isn’t interpreted by the console.

On the ZIP side, it’s possible to mark data as a comment, which is also ignored (usually). With somewhere in both formats to store information without corrupting the other type of file, all Grey had to do was blend them together:

If we find enough padding space in the PRG data, we can just replace the padding data with the ZIP file. For this NES ROM, I counted padding bytes from the end of the PRG data until I had enough space to embed the ZIP file, then I made note of how far into the NES ROM I started embedding the ZIP file.

I then updated all of the offsets of the ZIP file data by adding how far into the NES ROM the ZIP file started. After that, I set the ZIP File Comment Length to be the size of the rest of the NES ROM data, which is the end of the PRG data and all of the CHR data.

As for the contents of the ZIP, it’s the source code for the ROM… which you may have guessed by looking at the lead image.

So, what are the practical implications? Well, nothing really. But it’s super interesting. If you’d like to look at the source code, Grey has made it available on GitHub.

This NES ROM is Also a ZIP File [Vi Grey, via Reddit]


The Cheapest NBN 1000 Plans

Looking to bump up your internet connection and save a few bucks? Here are the cheapest plans available.

At Kotaku, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments


One response to “This Working NES ROM Has A Secret ZIP File Inside It”

Leave a Reply

Your email address will not be published. Required fields are marked *