NBF is a standalone indexed image format used for top-screen backgrounds. The documented display size is 256 × 192; the file itself does not encode the dimensions, so the caller supplies that context. The first four bytes are UGAR, followed by a section count and lengths for palette and image sections. [1]
Colour and pixels
Palette entries use 16-bit RGB555 values. Image pixels are eight-bit palette indices, ordered left to right across a row and then top to bottom. The published format notes padding of sections to power-of-two lengths; a reader should use the header lengths and known image dimensions to distinguish pixel data from padding. [1]
Where it appears
The online client can reference NBF from HTML pages or UGO menus. A menu title or page layout determines how the image is placed; the image file alone cannot specify a screen coordinate. Do not try to decode an embedded PPM thumbnail as NBF merely because both are shown as a preview. [1][2]
Reader checks
Check UGAR, section count, section bounds and enough bytes for 256 × 192 indices. Reject indices beyond the available palette rather than reading past it. Keep colour conversion separate from byte parsing so the same decoded palette can be tested against a known image. [1]
Section sizing
The palette and image data follow the 16-byte UGAR header with no gap. The wiki specifies power-of-two padding for both section lengths. Palette entries are RGB555 halfwords and pixels are eight-bit indices in raster order. NBF does not store its dimensions; the caller supplies them. A 256 × 192 top-screen image therefore needs 49,152 pixel indices before padding. Check both declared lengths against the file, and reject pixel indices outside the palette. [3]
NBF header offsets and section padding
The NBF header occupies sixteen bytes. The length fields give the palette-section size first, then the indexed-image size. The NPF reference specifies little-endian integers for the same UGAR layout. The NBF table gives the integer widths, but does not state their byte order separately. [3] [4]
| Offset | Bytes | Meaning |
|---|---|---|
| 0x00 | 4 | ASCII UGAR |
| 0x04 | 4 | Section count; the documented form is 2 |
| 0x08 | 4 | First section's byte length |
| 0x0C | 4 | Second section's byte length |
Palette bytes follow the header; image bytes follow the entire declared palette section, including its padding. Keep the two section lengths independent. With a complete 256-colour RGB555 palette, the colour words occupy 512 bytes. The 256 × 192 pixel indices occupy 49,152 bytes, which rounds up to 65,536 when that section is padded to a power of two. The remaining 16,384 bytes are padding after the image. The displayed height stays the same. The wiki does not specify the value of the padding bytes. [3]
The same background can be selected by an HTML document or a UGO menu. Neither use adds width or height fields to NBF; 256 × 192 comes from the top-screen context. [3]
