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 chunk types of the specification beyond those listed on the chunks page (the disc, ROM and machine-state chunks from &0200 up, and several tape chunks whose contents this site has not sourced); the viewer shows them as a type number with their bytes.
- Viewer: chunk &0102 (explicit bits), &0114 (security cycles) and &0130 are listed with their length only; &0104 with other than 8 data bits and no parity is not turned into bytes.
- 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
- Reference: bit 6 of the block flag. It is read here as "the block holds no data", the way a block of length 0 is written, but no block on the real tape sets it.
- 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 – the specification of the chunks (not read for these pages: it was not downloaded)