D71.java

package libsidplay.components.c1541;

import java.io.RandomAccessFile;

/**
 * 1571 sector image: two 35-track GCR surfaces, optionally followed by 1366 error bytes.
 */
public final class D71 extends D64 {
    /**
     * Create a two-sided sector image.
     *
     * @param gcr      GCR surface data
     * @param name     image file name
     * @param file     open image file
     * @param readOnly true for a read-only attachment
     */
    public D71(GCR gcr, String name, RandomAccessFile file, boolean readOnly) {
        super(gcr, name, file, readOnly);
    }

    @Override
    public Format getFormat() {
        return Format.D71;
    }

    @Override
    protected int speedZone(int track) {
        return SPEED_MAP_1541[(track - 1) % 35];
    }

    // Keep each surface in its own 42-track bank, including unrecorded outer tracks.
    @Override
    protected int gcrTrack(int track) {
        return track <= 35 ? track : track + 7;
    }

    @Override
    protected int headerTrack(int track) {
        return twoSingleSides && track > 35 ? track - 35 : track;
    }
}