Dumping Commodore 64/1541 Disks with Errors

Many old Commodore 64/1541 disks have read errors, but this doesn’t mean the data isn’t recoverable – with the right nibtools settings and some cleaning.

ZoomFloppy and nibtools

The ZoomFloppy adapter is the de-facto standard for connecting Commodore disk drives to modern computers, using a USB connection.

There are two ways to read a disk image:

  • d64copy (opencbm) will read the contents of a disk sector by sector and create a .d64 image file. This works with all Commodore drives through the serial cable.
  • nibread (nibtools) will read the raw bits of each track without any interpretation and create a .nib/.nbz file (which can be converted into a standard .g64 file). This requires a 1541 with a parallel port mod or a 1570/1571 with just a serial connection.

The main use for .g64 files is to preserve copy-protected games, which often use custom on-disk structures that would not be or sometimes cannot even be preserved in a .d64 image. In the context of reading disks that may have read errors, “nibbling” into .nbz/.g64 preserves all the information that could be read, which gives us better insight into what happened, and may allow us to recover more data.

This article covers reading the raw data using nibread, but most of the information translates to reading the decoded data using d64copy.

Error-free Dump

Let’s first look at the output of nibread for an error-free disk. The command nibread disk123 will create disk123.nbz and print this:

   1.0: (3) 7818 [CBM OK] (weakgcr:3)
   2.0: (3) 7819 [CBM OK] (weakgcr:6)
   3.0: (3) 7819 [CBM OK] (weakgcr:4)
   4.0: (3) 7819 [CBM OK] (weakgcr:9)
   5.0: (3) 7819 [CBM OK] (weakgcr:5)
   6.0: (3) 7819 [CBM OK] (weakgcr:4)
   7.0: (3) 7819 [CBM OK] (weakgcr:3)
   8.0: (3) 7819 [CBM OK] (weakgcr:6)
   9.0: (3) 7819 [CBM OK] (weakgcr:1)
  10.0: (3) 7819 [CBM OK] (weakgcr:3)
  11.0: (3) 7819 [CBM OK] (weakgcr:4)
  12.0: (3) 7819 [CBM OK] (weakgcr:5)
  13.0: (3) 7819 [CBM OK] (weakgcr:3)
  14.0: (3) 7819 [CBM OK] (weakgcr:9)
  15.0: (3) 7819 [CBM OK] (weakgcr:5)
  16.0: (3) 7819 [CBM OK] (weakgcr:3)
  17.0: (3) 7819 [CBM OK] (weakgcr:4)
  18.0: (2) 7148 [CBM OK] (weakgcr:2)
  19.0: (2) 7148 [CBM OK] (weakgcr:8)
  20.0: (2) 7148 [CBM OK] (weakgcr:4)
  21.0: (2) 7148 [CBM OK] (weakgcr:5)
  22.0: (2) 7148 [CBM OK] (weakgcr:2)
  23.0: (2) 7149 [CBM OK] (weakgcr:6)
  24.0: (2) 7148 [CBM OK] (weakgcr:1)
  25.0: (1) 6673 [CBM OK] (weakgcr:4)
  26.0: (1) 6673 [CBM OK] (weakgcr:3)
  27.0: (1) 6673 [CBM OK] (weakgcr:1)
  28.0: (1) 6673 [CBM OK] (weakgcr:6)
  29.0: (1) 6673 [CBM OK] (weakgcr:5)
  30.0: (1) 6673 [CBM OK] (weakgcr:4)
  31.0: (0) 6255 [CBM OK]
  32.0: (0) 6255 [CBM OK]
  33.0: (0) 6255 [CBM OK] (weakgcr:2)
  34.0: (0) 6255 [CBM OK] (weakgcr:4)
  35.0: (0) 6255 [CBM OK] (weakgcr:2)
  36.0: (1!=2 NOSYNC!) 0 [Unformatted Track]
  37.0: (1!=2 NOSYNC!) 0 [Unformatted Track]
  38.0: (1!=2 NOSYNC!) 0 [Unformatted Track]
  39.0: (1!=2 NOSYNC!) 0 [Unformatted Track]
  40.0: (1!=2 NOSYNC!) 0 [Unformatted Track]
  41.0: (1!=2 NOSYNC!) 0 [Unformatted Track]

Tracks 1 to 35 show “CBM OK’, which means that there are no errors. Tracks 36 to 41 are unformatted, which is the usual case for data disks. You can pass -E35 to nibread to save a few seconds on each disk if you are certain it doesn’t use the extra tracks.

“weakgcr” means that there is data on the track that does not consist of legal GCR-encoded bit combinations. This is normal for the gaps, especially the tail gap, i.e. the unused areas of a track.

You can then use nibconvert to create a standard .g64 image – or, if there are no errors and no copy protection, a .d64 image.

Error Codes

Errors are shown like this:

  10.0: (3) 7898 [E5S16]

E5S16 means there was an error 5 when decoding sector 16. Here is the full list of error codes:

Controller Code Description DOS Code
2 Header not found 20
4 Data not found 22
5 Data checksum error 23
9 Header checkum error 27

The nibtools error codes are the same as the 1541 “controller” error codes. The DOS codes are the “READ ERROR” codes returned by the 1541 status channel.

  • The most common error is number 5: About 90% of a track consists of the actual sector data, and any incorrectly read bit will cause an error 5.
  • Tracks with more serious read problems often show an error 2 or 4: This usually means that large chunks of the track were unreadable, so that the header/data markers (“SYNC”) could not be found.

For a description of the on-disk format of sectors and more information on common errors, have a look at this article.

Checksums

The on-disk format of 1541 disks uses 8-bit checksums to protect the integrity of headers and data sections. It is calculcated as an XOR of all data bytes.

nibread will flag an error if any of the checksums is incorrect, and retry reading up to the specified retry count (default 10).

An 8 bit checksum is not very strong: The probability of an undetected read error is 1:256. In practice, it is good enough that it should be trusted for most cases. But if a disk has dozens of read errors, it is not a solution to set the number of retries to 1000 and leave it running overnight!

Weak Sector

The most common case is an error that goes away after a few retries:

  10.0: (3) 7898 [E5S16]
        (3) 7898 [E5S16]
        (3) 7898 [CBM OK] (weakgcr:3)

In this example, the second retry was successful. The incorrect read was either caused by dirt that rubbed off easily, or by a weak bit.

Bad sector

But sometimes an error does not go away. Here is an error 2 that persists after 10 retries, the nibread default:

   1.0: (3) 7692 [E2S9]
        (3) 7691 [E2S9]
        (3) 7690 [E2S9]
        (3) 7691 [E2S9]
        (3) 7691 [E2S9]
        (3) 7692 [E2S9]
        (3) 7692 [E2S9]
        (3) 7691 [E2S9]
        (3) 7691 [E2S9]
        (3) 7692 [E2S9]
        (3) 7691 [E2S9] (weakgcr:34)

As always, the error could be caused by weak bits, or by dirt1.

You could increase the number of retries, which works in some cases, but if the error does not go away after maybe 20 retries, it is best to first cleaned the disk.

Cleaning the Disk

The most common reason thirty year old disks have read errors is that some of their surface material became loose and is now a thin layer of dust that interferes with the read head.

An alcohol-based cleaning wipe is the easiest method to clean the disk. For this, you need to remove the top of the drive’s case. It’s good practice to keep it unscrewed on the device you are using for dumping disks anyway.

The read head is on the bottom, and there is a spring-loaded counter-weight on the top, which can be easily lifted, so that the cloth can be put between it and the disk’s surface:

Note that this always cleans the side of the disk that is opposite of what is expected based on the orientation of the disk on the drive. In other words, to clean side A, you have to put in the disk as if you wanted to read side B.

A 1571 has a read head on both sides, and the top one cannot be lifted very far, so you have to be careful not to break anything.

Then, instruct nibread to do one pass across all tracks, ignoring errors:

  nibread -e0 /tmp/x

You should do this several times, so that the cloth gets rubbed over every track multiple times.

These cleaning cloths dry out very quickly. Instead of using new cloths every time, you can use an alcohol-based disinfection spray to add moisture to them again.

Trying Again

Before trying again, you should make sure that the disk’s surface has dried. Otherwise, you will get something like this, possibly on a track that was fine before:

  12.0: (3) 7882 [E5S0]
        (3) 7882 [E5S5]
        (3) 7880 [E5S8]
        (3) 7881 [E5S0][E5S5][E5S8][E5S11]
        (3) 7880 [E5S2][E5S5][E5S8][E5S10][E5S12][E5S16]
        (3) 7882 [E5S1][E5S2][E2S7][E5S11]
        (3) 7882 [E5S1][E5S8][E5S9][E5S10][E5S12][E5S16]
        (3) 7882 [E5S2][E5S3][E5S5][E5S10][E5S11][E5S13][E5S15]
        (3) 7881 [E5S2][E5S10][E5S11][E5S13][E5S14][E2S18]
        (3) 7882 [E5S4][E5S5][E5S9][E5S10][E5S11][E5S12][E5S13][E5S14][E5S16]
        (3) 7881 [E5S1][E5S2][E5S4][E5S5][E5S8][E5S10][E5S11][E5S12][E5S13][E5S14][E5S16] (weakgcr:11)

On every read, there were different errors, which indicates that the errors aren’t caused by the contents of the disk. Let it dry, then try again. (It could also indicate a dirty read head – see below.)

If you are lucky, the track will read without any errors after cleaning:

   1.0: (3) 7691 [CBM OK] (weakgcr:37)

Or maybe it just reads a little better, because it was a combination of dirt and weak bits.

In any case, now is the time that you can increase the number of retries with the -e argument. Numbers up to 100 are reasonable; in practice, there is rarely a good read after 30 retries.

And here is an example of a track with multiple errors that, after cleaning, read correctly after 26 retries:

  28.0: (1) 6638 [E5S5][E2S6]
        (1) 6639 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6639 [E5S5][E2S6]
        (1) 6638 [E5S5][E9S6]
        (1) 6638 [E5S5][E9S6]
        (1) 6638 [E2S6]
        (1) 6638 [E5S5][E9S6]
        (1) 6638 [E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E2S6]
        (1) 6638 [E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6638 [E5S5][E2S6]
        (1) 6639 [E5S5][E2S6]
        (1) 6638 [CBM OK] (weakgcr:5)

Dirty Read Head

The dirt on a disk can stick to the read head, which will interfere with all reads. Here is an example of a disk dump with a dirty head:

   1.0: (3) 7801 [CBM OK] (weakgcr:21)
   2.0: (3) 7882 [CBM OK] (weakgcr:2)
   3.0: (3) 7882 [CBM OK] (weakgcr:5)
   4.0: (3) 7775 [CBM OK] (weakgcr:21)
   5.0: (3) 7694 [CBM OK] (weakgcr:29)
   6.0: (3) 7693 [CBM OK] (weakgcr:27)
   7.0: (3) 7693 [CBM OK] (weakgcr:27)
   8.0: (3) 7695 [E5S2][E9S13]
        (3) 7694 [CBM OK] (weakgcr:23)
   9.0: (3) 7696 [E5S3][E9S5][E9S7][E2S10][E5S18][E2S20]
        (3) 7696 [E9S7][E2S10]
        (3) 7696 [E9S6][E9S7][E5S8][E2S10][E2S15][E2S20]
        (3) 7695 [E5S0][E2S2][E9S4][E9S6][E9S7][E9S8][E9S9][E5S10][E9S20]
        (3) 7696 [E5S2][E5S4][E9S6][E2S7][E9S8][E9S9][E2S10][E2S11][E2S12][E9S18][E5S19][E9S20]
        (3) 7695 [E9S0][E9S1][E9S2][E9S3][E9S4][E9S5][E9S6][E9S7][E2S8][E9S9][E2S10][E2S11][E5S13][E5S14][E2S15][E2S16][E9S17][E2S18][E5S19][E9S20]
        (3) 7693 [E9S0][E9S2][E5S3][E2S4][E2S5][E5S6][E9S7][E9S8][E2S9][E2S10][E2S11][E5S12][E9S13][E2S15][E2S16][E2S17][E9S18][E5S19][E9S20]
        (3) 7694 [E5S1][E9S2][E2S3][E9S4][E2S5][E9S6][E2S7][E2S8][E2S9][E2S10][E9S11][E2S12][E9S14][E5S15][E5S16][E5S17][E5S18][E9S19][E2S20]
        (3) 7691 [E5S0][E2S1][E2S2][E9S3][E2S4][E2S5][E9S6][E2S7][E2S8][E2S9][E2S10][E2S11][E2S12][E5S13][E9S15][E2S16][E2S17][E9S18][E2S20]
        (3) 7690 [NDOS]  (weakgcr:29)
  [...]

Again, if the errors are radically different between retries, it cannot be an issue of the disk’s surface.

A clean read head looks like this:

And a dirty one like this:

You can use the same alcohol-based wipes to clean the read head.

Conclusion

In my experience, more than half of old disks with read errors can be read correctly again after cleaning them.

If the errors don’t go away, and it is a commercial disk, there is of course usually the possibility of buying another copy, and even if that one has errors as well, the data can be spliced together.

Otherwise, the tool g64conv can help: It converts .g64 files into a textual representation, which allows you to inspect what exactly went wrong, and may give you the opportunity to extract some information from sections with errors.


  1. Errors can also be cause by incorrectly written on-disk data structures, e.g. because of a buggy driver, or an error when duplicating the disk. We will ignore these kinds of errors in this article.

6 thoughts on “Dumping Commodore 64/1541 Disks with Errors”

  1. As I recall, some of the C64 game developers intentionally put disk errors onto the floppy as a crude form of copy protection. The idea being that if the disk errors were not detected during startup then the installer would fail.

    Don’t know if this is actually true or not, but I do remember the heads hitting their stops quite a few times during loading of certain games.

    Reply
    • That’s true.

      I remember trying to make a, ummm… “backup”, of the GI Joe game and it would copy properly, but never got past the loading animation when run.

      When I discovered the original disk had a 23 error on one sector, and I used a copy program that was able to recreate that error, the backup copy started working.

      Reply
  2. Do you or anyone you know (person/company) know how to transfer data off of a 5.25 floppy disc onto say a word perfect document for Windows 7? I have 10 from the 1990’s. I would really like to find out what’s on them. Can you help?

    Reply
    • Hi Laurence, build a FluxEngine (pretty easy) and buy a 5.25″ PC floppy drive from eBay to dump the disks yourself.

      Reply
  3. Wow! I bought a ZoomFloppy in 2013 but due to a random combination of bad serial cables, weak power supplies, a stock “breadbin” 1541, difficulty installing OpenCBM on the Linux box I had at the time, etc. – I was never able to get it to do a thing… and yet I’ve had a 1000 or 2000 or so aging floppies in climate-controlled storage waiting to be whole-disk copied or nibbled if necessary into disk images. I finally figured it all out last week and got started with all better hardware and software. 1541s, 1571s, 1581s… all working nicely for me now except about 10% of my disks won’t fully read. I wasn’t able to determine if they’re bad – or just dusty dirty – or intentionally that way from copy-protection… who knew? But this little trick of using Lens Wipes has made *all* the difference in the *world*! Thank you so much for this *excellent* superb tutorial. I’m about to run to my storage unit today and bring home 3-4 boxes full of floppies… and I don’t know what I would have done had I not seen and read this page first!

    Reply

Leave a Comment