Exemple #1
0
void disc_poll()
{
	if (drives[curdrive].poll)
		drives[curdrive].poll();
	if (disc_notfound)
	{
		disc_notfound--;
		if (!disc_notfound)
			fdcnotfound();
	}
}
Exemple #2
0
void adf_poll()
{
        int c;
        adftime++;
        if (adftime<16) return;
        adftime=0;

        if (adfnotfound)
        {
                adfnotfound--;
                if (!adfnotfound)
                {
//                        rpclog("Not found!\n");
                        fdcnotfound();
                }
        }
        if (adfread && adff[adfdrive])
        {
//                if (!adfreadpos) rpclog("%i\n",adfsector*adfsize[adfdrive]);
                fdcdata(trackinfoa[adfdrive][adfside][(adfsector*adfsize[adfdrive])+adfreadpos]);
                adfreadpos++;
                if (adfreadpos==adfsize[adfdrive])
                {
//                        rpclog("Read %i bytes\n",adfreadpos);
                        adfread=0;
                        fdcfinishread();
                }
        }
        if (adfwrite && adff[adfdrive])
        {
                if (writeprot[adfdrive])
                {
                        fdcwriteprotect();
                        adfwrite=0;
                        return;
                }
//                printf("Write data %i\n",adfreadpos);
                c=fdcgetdata(adfreadpos==255);
                if (c==-1)
                {
                        return; /*Hack - wait until data is available*/
//                        printf("Data overflow!\n");
//                        exit(-1);
                }
                trackinfoa[adfdrive][adfside][(adfsector*adfsize[adfdrive])+adfreadpos]=c;
                adfreadpos++;
                if (adfreadpos==adfsize[adfdrive])
                {
                        adfwrite=0;
                        fdcfinishread();
                        adf_writeback(adfdrive,adftrack);
                }
        }
        if (adfreadaddr && adff[adfdrive])
        {
                switch (adfreadpos)
                {
                        case 0: /*if (adfdblstep[adfdrive]) fdcdata(adftrack/2); else */fdcdata(adftrack); break;
                        case 1: fdcdata(adfside); break;
                        case 2: fdcdata(adfrsector+(adfsize[adfdrive]!=256)?1:0); break;
                        case 3: fdcdata((adfsize[adfdrive]==256)?1:((adfsize[adfdrive]==512)?2:3)); break;
                        case 4: fdcdata(0); break;
                        case 5: fdcdata(0); break;
                        case 6:
                        adfreadaddr=0;
                        fdcfinishread();
//                        rpclog("Read addr - %i %i %i %i 1 0 0\n",adfdrive,adftrack,adfside,adfsector);
                        adfrsector++;
                        if (adfrsector==adfsectors[adfdrive]) adfrsector=0;
                        break;
                }
                adfreadpos++;
        }
        if (adfformat && adff[adfdrive])
        {
                if (writeprot[adfdrive])
                {
                        fdcwriteprotect();
                        adfformat=0;
                        return;
                }
                trackinfoa[adfdrive][adfside][(adfsector*adfsize[adfdrive])+adfreadpos]=0;
                adfreadpos++;
                if (adfreadpos==adfsize[adfdrive])
                {
                        adfreadpos=0;
                        adfsector++;
                        if (adfsector==adfsectors[adfdrive])
                        {
                                adfformat=0;
                                fdcfinishread();
                                adf_writeback(adfdrive,adftrack);
                        }
                }
        }
}