Makemask

Makemask is a tool that adds a few things to an already-compiled ROM. It has a few main purposes, all relating to make the ROM ready for mass-production.

What Makemask does

  • Embedding the CIC lockout chip version onto the ROM, allowing it to be played on a real console. Without this, it can only play properly on debugging devices.
  • Padding out the ROM so that it fills the entire space on the cartridge.
  • Adding the ROM Registration Data ‘headers’ for the game such as game title, game code and software version number.

Let’s go through each piece one at a time to see how they work.

Embedding CIC/CRC lockout data into the ROM

If you compile and link a ROM normally, you’ll get these error messages:

CIC error on a PJ64 Emulator.

CIC error on a PJ64 Emulator.

CIC error on an Everdrive 64 v2.

CIC error on an Everdrive 64 v2.

As you can see, the error lies with the ROM not having the lockout code embedded onto it. The makemask program adds CIC information to the file, fixing this error. Here you can see the output of the file when passed through Real N64 CRC Tool by RaO:

The first one has been through Makemask, the second one is a raw ROM.

The first one has been through Makemask, the second one is a raw ROM.

Note that the CIC number will depend on the version of Makemask. The one in the SDK we’re using adds the CIC-6102 lockout code by default, which is the one used for North America and Japan.

Padding the ROM

Another function that this program has is that it pads the file with blank text until it reaches the desired file size. This is determined by the -s setting on the mild n64 compiler, which is an integer value in megabits (minimum/default 8 megabits, or 1 megabyte).

The filler data is just a long string of 0xff so it provides no practical use beyond making sure that it takes up 100% of the the space in the destination cartridge.

Adding registration data

There’s also something a bit useless that Makemask does, and that is add registration information to the file. It was useful back in the day, since it allowed for a compact description of the file to anyone who was scanning through a libray of them. Nowadays, we don’t really concern ourselves with that so it’s not useful at all, unless someone makes a reader for that kind of thing.

For the sake of completion, let’s include it here anyway. Looking at the diagram below, it’s pretty clear what it does:

Makemask registration memory key

It’s a 32-byte section of the ROM’s memory that is used to hold the game’s header information.

The first 20 bytes hold ASCII text that is the name of the game. It is noted that the name should be similar to the release name of the game, not the production name. Then there’s the fixed value, which are 7 bytes that are ordered to be left blank for whatever reason (probably padding). The next four characters are a game code (to be provided by Nintendo). The last byte of data is supposed to be an integer showing the version number.

How to use Makemask

This part is actually very simple. All you have to do is perform the Makemask command right after the Mild command. In practice, it would look something like this:

$(TARGETS):	$(OBJECTS)
		$(MAKEROM) spec -s$(ROMSIZE) -I$(NUSYSINCDIR) -r $(TARGETS) -e $(APP)
		MAKEMASK $(TARGETS)

This is an example from the end of the nu0 Makefile, where $(TARGETS) is the name of the N64 ROM. That’s all there is to it!

An example in practice

I prepared a small example in case you want to check how your emulator or flash cart reacts to working with a pre/post Makemask N64 ROM file. You can download it with the password maskedsquid here:

Makemask Sample download

Search

Subscribe to the mailing list

Follow N64 Squid

  • RSS Feed
  • YouTube

Random featured posts