Introduction
A G64 file is a copy of a Commodore 1541 disk at the level of what the drive head reads: not the 256-byte sectors of a D64, but each track as the GCR-coded bit stream of its sync marks, sector headers, gaps and data blocks. It was made for the VICE emulator so that copy-protected disks, whose protection lives in the gaps, the sync lengths, the half tracks or deliberately damaged blocks, can be kept as they are.
A G64 is larger than a D64: about 330,000 bytes for a 35-track disk (the manual gives a minimum of about 333,744 bytes for the full 84 half-track table).
Structure
A 12-byte header, a table with the file offset of every half-track, a table with every half-track’s speed zone, then the track blocks anywhere in the file, each a 2-byte length and the bit stream. See Header and track tables and GCR tracks and sectors.
0Header “GCR-1541”, version, half-track count, largest track size12 bytes12Track offsets one u32 per half-track4 × count12 + 4nSpeed zones one u32 per half-track4 × count12 + 8nTrack blocks length, then the GCR bit streamusually 7,928 each
In the explorer
Drop a .g64 file on the explorer to see:
- the tree: the header and its fields, the two tables with an entry per half-track, and every track block;
- a table of the tracks (offset, size, speed zone, sectors decoded) and of every sector found by decoding the bit streams, with its header and data checksums;
- when all 35 tracks of a 1541 disk decode, the disk as a .D64 that opens in the D64 viewer; sectors that did not decode are zero with an error byte;
- the problems found: an offset beyond the file, a track longer than the declared maximum, blocks that overlap, a track with the wrong number of sector headers.
Not described
Known, not yet covered
- Reference: the per-byte speed-zone blocks that a speed table entry above 3 points to, and the SPS “EXT” extra-information block (the manual mentions it; its fields are not described here).
- Viewer: half tracks are shown as blocks but not decoded; speed zones are shown but not used (all tracks are decoded at the bit level without regard to the speed); GCR-1571 files are decoded track by track and not converted to a D71; the data of a sector is not shown as bytes inside the G64 (the converted D64 does).
- Viewer: non-standard or copy-protected tracks (long syncs, unusual headers, custom blocks) are listed as “other” blocks by the decoder but not described.
Unknown
- Reference: the header and data block layouts are the standard description of the 1541 format, written from it; they were not re-fetched from a second source on the day, and the 1571’s second-side header differences are not checked.
- Viewer: no real G64 file is on this Mac and none was found to download, so the decoder is tested on files made by an encoder written for the test, not on a drive’s real dump.
Links
Software
- VICE – Commodore emulator that reads and writes G64 files (Windows, macOS, Linux)
Reference
- VICE manual, chapter 17 – the G64 section is the main source of the header and tables (read through a summarising fetch, so the numbers are “our words”)
- Group coded recording (Wikipedia) – the Commodore GCR table, checked against ours