Introduction
UEF, the Universal Emulator Format, is a tape image for the BBC Micro and its relatives. It stores a cassette as a list of chunks: the data bytes, the stretches of carrier tone and silence between them, and notes such as where the tape came from. Emulators of the BBC Micro and of the Acorn Electron load it as if it were a tape in a cassette recorder.
A .uef file is normally gzip-compressed (it starts $1F $8B); the same
bytes uncompressed are also a valid UEF. What the gzip data inflates to starts with the ten bytes
UEF File! and a zero.
Structure
0SignatureUEF File!and$0010 bytes10Minor and major version one byte each:$0A $00is version 0.102 bytes12Chunks to the end of the data: a 16-bit type, a 32-bit length (both little-endian) and that many bytesthe rest
The chunks that can be sourced are listed on their page, with where that list ends. The data chunks hold the bytes the tape carries; those bytes are BBC cassette blocks, which hold the files: a name, a load and an execution address, and up to 256 bytes of data each with a CRC.
The gzip layer
A UEF is usually stored as a gzip file, the file name still ending .uef. A gzip file may be several
members one after another, which unpack to the bytes joined together; BeebEm writes a .uef with one
member for each chunk (the real tape Test.uef in the BeebEm folder, 1,405 bytes, has 17 members for 17 chunks and
inflates to 1,660 bytes). The explorer reads the layer with the same gzip reader as the .gz
pages, which inflates every member and checks each one's CRC-32 and length against its trailer. The compressed file shows as
one node whose Open button opens the inflated UEF as a file of its own, with the full chunk tree; the tape's tables
(files, blocks, chunks) are built from the inflated bytes in both cases.
In the explorer
Drop a .uef file on the explorer to see:
- the tape: the version, whether it is compressed, the chunks by type, the text of the origin chunk, the number of blocks and files, and whether every CRC agrees;
- the files on the tape as a table, each with an Open button: a BASIC program as a listing, machine code disassembled at its load address, text as text. They are opened just as the files of an .ssd or .dsd disc are;
- the blocks (name, number, length, addresses, flag, and whether the header and data CRCs agree) and the chunks (type, name, length, contents), each a table;
- for an uncompressed UEF, or the inflated one, the tree: the header and every chunk with its type, length and data;
- the problems found, listed: a chunk cut short by the end of the file, a block whose CRC is wrong, a file with no last block, a tape with no data chunk.
Only the data chunks that carry whole bytes are read as blocks: &0100, and &0104 when it states 8 data bits and no parity. The tape's tones and gaps are listed but not played.
Not described
Known, not yet covered
- Reference: the multiplexing documents: the specification says a separate document on bit multiplexing was in preparation, and chunks &0006, &0101, &0103, &0202, &0301, &0411 and &0412 depend on it; the layout of the multiplexed data inside them is not described anywhere this site has read.
- Reference: the 20 or so chunks of the specification (draft 28) the chunks page now lists have no real file on this Mac using them except &0000, &0100 and &0110; their descriptions rest on the specification's text alone and the viewer's decoding of them on built chunks.
- Viewer: chunks &0101, &0102 and &0210 (bits), the multiplexed chunks, the ROM chunk &0300, the disc chunks &0201 and &0202 and the state chunks &0401, &0410 are shown with a decoded header and their length, but their data is not turned into bytes, a disc or a ROM; &0104 with other than 8 data bits and no parity is not turned into bytes either.
- Viewer: the tape is not played or timed: tone, gap and baud-rate chunks are shown as values, and no duration is worked out. Tapes of other formats (CSW, TZX) are not read.
- Viewer: only the BBC cassette block format is read (an Acorn Electron tape is believed to use the same blocks, which is not checked); a UEF holding some other tape format shows chunks and no files.
Unknown
- Viewer: only one real tape exists on the Mac (
Test.uef, one BASIC program of six blocks); no tape with a machine code file, a text file, several files, a protected tape or a UEF version above 0.10 was available, so those are checked on built tapes only. There is no tape loader on the Mac to compare with: the second routes were node's own gzip, the CRCs of the tape itself, and a reader of the same chunks in the EmWare BBC Micro emulator's source.
Links
Software
Reference
- UEF File Format Specification – version 0.10, document draft 28 (revised 10/1/2006): the specification of every chunk; the chunks page is written from its raw text
- UEF File Format Specification (mdfs.net copy) – an older copy, document draft 25 (revised 6/7/2005); not used for these pages
- Example UEF file – BeebWiki: a byte-by-byte dissection of a short uncompressed UEF