Skip to content

Commit

Permalink
[#64] Internal FDD improvements and bugfixes (Part 24: Added missing …
Browse files Browse the repository at this point in the history
…support for track unscanning/rescanning)
  • Loading branch information
tomas-nestorovic committed Oct 7, 2023
1 parent 2c4a907 commit 3708db0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Main/src/FDD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,22 @@ error: switch (const TStdWinError err=::GetLastError()){
return __getScannedTrack__(cyl,head)!=nullptr;
}

TStdWinError CFDD::UnscanTrack(TCylinder cyl,THead head){
// disposes internal representation of specified Track if possible (e.g. can't if Track already modified); returns Windows standard i/o error
EXCLUSIVELY_LOCK_THIS_IMAGE();
const PInternalTrack pit=__getScannedTrack__(cyl,head);
if (!pit) // Track not yet scanned?
return ERROR_SEEK;
for( TSector i=0; i<pit->nSectors; i++ )
if (pit->sectors[i].IsModified())
return ERROR_REQUEST_REFUSED;
if (const TStdWinError err=__super::UnscanTrack(cyl,head)) // base
return err;
delete pit;
internalTracks[cyl][head]=nullptr;
return ERROR_SUCCESS;
}

void CFDD::__setWaitingForIndex__() const{
// sets waiting for the index pulse before executing the next command
LOG_ACTION(_T("void CFDD::__setWaitingForIndex__"));
Expand Down
1 change: 1 addition & 0 deletions Main/src/FDD.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
TStdWinError SeekHeadsHome() const override;
TSector ScanTrack(TCylinder cyl,THead head,Codec::PType pCodec=nullptr,PSectorId bufferId=nullptr,PWORD bufferLength=nullptr,PLogTime startTimesNanoseconds=nullptr,PBYTE pAvgGap3=nullptr) const override;
bool IsTrackScanned(TCylinder cyl,THead head) const override;
TStdWinError UnscanTrack(TCylinder cyl,THead head) override;
void GetTrackData(TCylinder cyl,THead head,Revolution::TType rev,PCSectorId bufferId,PCBYTE bufferNumbersOfSectorsToSkip,TSector nSectors,PSectorData *outBufferData,PWORD outBufferLengths,TFdcStatus *outFdcStatuses,TLogTime *outDataStarts) override;
TDataStatus IsSectorDataReady(TCylinder cyl,THead head,RCSectorId id,BYTE nSectorsToSkip,Revolution::TType rev) const override;
TStdWinError MarkSectorAsDirty(RCPhysicalAddress chs,BYTE nSectorsToSkip,PCFdcStatus pFdcStatus) override;
Expand Down

0 comments on commit 3708db0

Please sign in to comment.