| Home CBM ASCII-X BASIC C128 D64plus Disk File Sector Escape Codes Hardware PCxface PETSCII Pet2asc Futurama IBM PC-AT Contact Games Glossary Hall of fame Hall of shame Miscellaneous Privacy policy Programming Twisty puzzles |
A standard Commodore ("CBM") file consists of 1 or more blocks of data. A "block" is a carefully referenced area of 256 (logical) bytes of data somewhere on the storage media ("disk"). There are seven (7) types of files:
Note 1: it is the responsibility of CBM DOS to remember which block(s) are assigned to files, such that new file(s) do not destroy saved data and that existing files can be read/written. Although a logical block holds 256 bytes, the first 2 are "meta-bytes" which (normally [not last block]) point to the next track/sector of the file (link); in particular, each block can only hold 254 data bytes! The last block does not contain a link; instead the first byte is 0 (an invalid track) and the second byte tells which is the last valid byte in the block. Note 2: most files only contain a single stream of data, but REL files (classic Commodore) contain two streams of data, while GEOS files contain two or (often) more streams of data. Below are details on these more complex file types.
This file-type holds 2 data streams. One is the raw data; it is very much like a SEQ file. The second is an index file... often called "side-sector(s)" in Commodore literature. The index file is usually 1 to 6 blocks. Each "side-sector" block can reference (index) 120 data sectors. Most CBM disks only allow a maximum of 6 side-sectors... thus a maximum of 6 * 120 = 720 data blocks (which is 720 * 254 = 182 880 bytes of data). However, the 1581 and CMD disk formats add an extra block known as "super side-sector". On these disks, up to 126 "groups" of 6-block side-sectors are indexed... thus a maximum of 120 * 6 * 126 = 90 720 blocks can be indexed (this is overkill... REL allows 65 535 blocks max).
All GEOS files have (at least) two data streams. GEOS Sequential files have exactly two!
In theory, the Info Header could contain multiple blocks, but GEOS has a strict limit of 1 block.
Most GEOS files are VLIR files. In the directory, they hold 2 data streams:
The VLIR table lists, essentially, a set of SEQ/PRG-type files (up to 127; in theory it could hold more, but GEOS has a strict limit). So conceptually a VLIR file has 2+ data streams:
A VLIR file must have at least 1 "data entry" (which points to SEQ/PRG-type file), and it almost always has fewer than 127 entries (data forks). A single VLIR entry is simply a two-byte track/sector "link" to the first block in a SEQ/PRG type of file. The only difference (see above) is that a PRG begins with a 2-byte "load address"... this is used to load program code into GEOS; SEQ type is raw data without any "load address". The file system does not distinguish between them! The software author must know which VLIR stream is program (PRG) or raw data (SEQ). © H2Obsession, 2015 |