Endgame (NIF.BIN) File Format
Table of Contents
As Natreg Dragon pointed out, "NIF" is actually the reverse of "FIN", which in some languages means "The End". This is quite fitting since NIF.BIN stores the Ultima 1 endgame text (as an image). This endgame appears as follows:
The cyan text at the bottom is not part of NIF.BIN, and is regular DOS text coming from MONDAIN.EXE. Because of this, the text in white (which is what is actually stored in NIF.BIN) takes less than the 320x200 pixels that make up the Ultima 1 game resolution.
In fact, NIF.BIN stores the endgame as a 320x168-pixel image in black and white, i.e. one bit per pixel. This endgame text is displayed progressively, one scanline (row of pixels) at a time, which is probably why it is stored as an image rather than as text.
The file format of NIF.BIN can be understood by taking a look at the first few bytes in a hex editor. The first 2 bytes are 30 hex, which are 00110000 in binary. As you can observe from the image above, this already maps directly to the first few pixels of the image, where the 1s correspond to the top of the 'A' character that starts off the endgame text. The next 1s are encountered at the dot of the 'i' character.
The image above shows the mapping between the first few pixels in the image (where white pixels are highlighted as yellow, and black pixels alternate between blue and purple for clarity). This shows that each bit in NIF.BIN represents a pixel, where 1 means white and 0 means black.