signed char ioman_directSectorWrite(IOManager *ioman,unsigned long address, unsigned char* buf) { unsigned char* ibuf; signed short bp; if((bp=ioman_findSectorInCache(ioman,address))!=-1){ ibuf=ioman_getPtr(ioman,bp); memCpy(buf,ibuf,512); ioman_setWritable(bp); return(0); } if((bp=ioman_findFreeSpot(ioman))!=-1){ ibuf=ioman_getPtr(ioman,bp); memCpy(buf,ibuf,512); ioman_resetCacheItem(ioman,bp); ioman->sector[bp]=address; ioman_setWritable(bp); ioman_setValid(bp); return(0); } if(ioman_writeSector(ioman,address,buf)){ return(-1); } return(0); }
esint8 ioman_directSectorWrite(IOManager *ioman,euint32 address, euint8* buf) { euint8* ibuf; esint16 bp; if((bp=ioman_findSectorInCache(ioman,address))!=-1){ ibuf=ioman_getPtr(ioman,bp); memCpy(buf,ibuf,512); ioman_setWritable(bp); return(0); } if((bp=ioman_findFreeSpot(ioman))!=-1){ ibuf=ioman_getPtr(ioman,bp); memCpy(buf,ibuf,512); ioman_resetCacheItem(ioman,bp); ioman->sector[bp]=address; ioman_setWritable(bp); ioman_setValid(bp); return(0); } if(ioman_writeSector(ioman,address,buf)){ return(-1); } return(0); }
esint8 ioman_putSectorInCache(IOManager *ioman, euint32 address, euint16 bufplace) { euint8* buf; if((buf = ioman_getPtr(ioman,bufplace))==0)return(-1); if((ioman_readSector(ioman,address,buf)))return(-1); ioman_setValid(bufplace); ioman->sector[bufplace]=address; return(0); }
signed char ioman_putSectorInCache(IOManager *ioman, unsigned long address, unsigned short bufplace) { unsigned char* buf; if((buf = ioman_getPtr(ioman,bufplace))==0){ ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE); return(-1); } if((ioman_readSector(ioman,address,buf))){ ioman_setError(ioman,IOMAN_ERR_READFAIL); return(-1); } ioman_setValid(bufplace); ioman->sector[bufplace]=address; return(0); }
esint8 ioman_putSectorInCache(IOManager *ioman, euint32 address, euint16 bufplace) { euint8* buf; if((buf = ioman_getPtr(ioman,bufplace))==0){ ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE); return(-1); } if((ioman_readSector(ioman,address,buf))){ ioman_setError(ioman,IOMAN_ERR_READFAIL); return(-1); } ioman_setValid(bufplace); ioman->sector[bufplace]=address; return(0); }