コード例 #1
0
void
SoftSectoredDisk::getControlInfo(unsigned long pos,
                                 bool&         hole,
                                 bool&         writeProtect)
{
    if (initialized_m)
    {
        hole         = defaultHoleStatus(pos);
        writeProtect = checkWriteProtect();
    }
    else
    {
        hole         = true;
        writeProtect = false;
    }

    debugss(ssFloppyDisk, INFO, "init: %d hole: %d wp: %d\n", initialized_m, hole, writeProtect);
}
コード例 #2
0
void
HardSectoredDisk::getControlInfo(unsigned long pos,
                                 bool&         hole,
                                 bool&         writeProtect)
{
    if (initialized_m)
    {
        hole         = defaultHoleStatus(pos);
        writeProtect = checkWriteProtect();
    }
    else
    {
        // No disk in drive so hole light is on.
        hole         = true;

        // write protect sensor is not blocked.
        writeProtect = false;
    }
}
コード例 #3
0
bool
SectorFloppyImage::writeData(BYTE track, BYTE side, BYTE sector, int inSector,
                             BYTE data, bool dataReady, int& result)
{
    if (checkWriteProtect())
    {
        debugss(ssSectorFloppyImage, ERROR, "write protect\n");
        return false;
    }

    if (trackWrite_m)
    {
        debugss(ssSectorFloppyImage, ERROR, "track write\n");
        return false;
    }

    if (inSector < 0)
    {
        if (sector == 0xff || sector == 0xfe)
        {
            result = GenericFloppyFormat::ERROR;
            return true;
        }

        else if (cacheSector(side, track, sector))
        {
            dataPos_m = 0;
            dataLen_m = dataPos_m + secSize_m;
            result    = GenericFloppyFormat::DATA_AM;
            return true;
        }

        result = GenericFloppyFormat::NO_DATA;
        return true;
    }


    debugss(ssSectorFloppyImage, INFO, "writeData pos=%d data=%02x\n", inSector, data);

    if (dataPos_m < dataLen_m)
    {
        if (!dataReady)
        {
            result = GenericFloppyFormat::NO_DATA;
        }

        else
        {
            secBuf_m[dataPos_m++] = data;
            bufferDirty_m         = true;
            result                = data;
        }
    }

    else
    {
        result = GenericFloppyFormat::CRC;
    }

    return true;
}