Update ReadSector and ReadSectors methods to include sector status output

This commit is contained in:
2025-10-22 14:28:58 +01:00
parent 1003088cc3
commit 0ac2a48fb6
238 changed files with 5881 additions and 5196 deletions

View File

@@ -51,7 +51,7 @@ public sealed partial class Anex86
if(stream.Length < Marshal.SizeOf<Header>()) return ErrorNumber.InvalidArgument;
byte[] hdrB = new byte[Marshal.SizeOf<Header>()];
var hdrB = new byte[Marshal.SizeOf<Header>()];
stream.EnsureRead(hdrB, 0, hdrB.Length);
_header = Marshal.SpanToStructureLittleEndian<Header>(hdrB);
@@ -81,16 +81,24 @@ public sealed partial class Anex86
}
/// <inheritdoc />
public ErrorNumber ReadSector(ulong sectorAddress, out byte[] buffer) => ReadSectors(sectorAddress, 1, out buffer);
public ErrorNumber ReadSector(ulong sectorAddress, out byte[] buffer, out SectorStatus sectorStatus)
{
sectorStatus = SectorStatus.Dumped;
return ReadSectors(sectorAddress, 1, out buffer, out _);
}
/// <inheritdoc />
public ErrorNumber ReadSectors(ulong sectorAddress, uint length, out byte[] buffer)
public ErrorNumber ReadSectors(ulong sectorAddress, uint length, out byte[] buffer, out SectorStatus[] sectorStatus)
{
buffer = null;
buffer = null;
sectorStatus = null;
if(sectorAddress > _imageInfo.Sectors - 1) return ErrorNumber.OutOfRange;
if(sectorAddress > _imageInfo.Sectors - 1 || sectorAddress + length > _imageInfo.Sectors)
return ErrorNumber.OutOfRange;
if(sectorAddress + length > _imageInfo.Sectors) return ErrorNumber.OutOfRange;
sectorStatus = new SectorStatus[length];
for(uint i = 0; i < length; i++) sectorStatus[i] = SectorStatus.Dumped;
buffer = new byte[length * _imageInfo.SectorSize];

View File

@@ -63,17 +63,20 @@ public sealed partial class Anex86
}
/// <inheritdoc />
public ErrorNumber ReadSectorLong(ulong sectorAddress, out byte[] buffer)
public ErrorNumber ReadSectorLong(ulong sectorAddress, out byte[] buffer, out SectorStatus sectorStatus)
{
buffer = null;
buffer = null;
sectorStatus = SectorStatus.NotDumped;
return ErrorNumber.NotSupported;
}
/// <inheritdoc />
public ErrorNumber ReadSectorsLong(ulong sectorAddress, uint length, out byte[] buffer)
public ErrorNumber ReadSectorsLong(ulong sectorAddress, uint length, out byte[] buffer,
out SectorStatus[] sectorStatus)
{
buffer = null;
buffer = null;
sectorStatus = null;
return ErrorNumber.NotSupported;
}