Re: Pet 8088 coprocessor board for sale on Ebay

From: Rhialto <rhialto_at_falu.nl>
Date: Tue, 18 Jan 2011 09:37:37 +0100
Message-ID: <20110118083737.GA21544@falu.nl>
On Mon 17 Jan 2011 at 21:23:37 +0100, Micha? Pleban wrote:
> I really don't see any regularity in that.

Maybe the file simply doesn't use contiguous clusters. You'll have to
analyze the FAT. On floppies it is usually one with 12 bits per entry.
Here is some code that I wrote for MSH: on the Amiga:

/*-
 *  The FAT consists of 12-bits entries for each cluster,
 *  indicating the next cluster in the chain, or FFF for EOF.
 *
 *  Every two entries are packed in three bytes, like this:
 *
 *  Two entries         abc  123 (for one cluster and the next)
 *  are packed as       bc 3a 12
-*/

cluster_t
GetFatEntry(cluster)
cluster_t               cluster;
{
    if (!Fat && !GetFat())
        return FAT_EOF;

    switch (Disk.fatbits) {
#if 0
    case 32:
        return OtherEndianLong(((ulong *)Fat)[cluster]);
#endif
    case 16:
        return OtherEndianWord(((word *)Fat)[cluster]);
    default: {
            int offset = 3 * (cluster / 2);
            word        twoentries;

            if (cluster & 1) {
                twoentries = Fat[offset + 1] >> 4;
                twoentries |= Fat[offset + 2] << 4;
            } else {
                twoentries = Fat[offset];
                twoentries |= (Fat[offset + 1] & 0x0F) << 8;
            }

            /*
             * Convert the special values 0xFF7 .. 0xFFF to 16 bits so they
             * can be checked consistently.
             */
            if (twoentries >= 0xFF7)
                twoentries |= 0xF000;

            return twoentries;
        }
    }
}

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert  -- There's no point being grown-up if you 
\X/ rhialto/at/xs4all.nl    -- can't be childish sometimes. -The 4th Doctor
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

       Message was sent through the cbm-hackers mailing list
Received on 2011-01-18 09:00:04

Archive generated by hypermail 2.2.0.