namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
///
/// Used for the sector CHRN structure
///
public class CHRN
{
///
/// Track
///
public byte C { get; set; }
///
/// Side
///
public byte H { get; set; }
///
/// Sector ID
///
public byte R { get; set; }
///
/// Sector Size
///
public byte N { get; set; }
///
/// Status register 1
///
private byte _flag1;
public byte Flag1
{
get { return _flag1; }
set { _flag1 = value; }
}
///
/// Status register 2
///
private byte _flag2;
public byte Flag2
{
get { return _flag2; }
set { _flag2 = value; }
}
///
/// Used to store the last transmitted/received data bytes
///
public byte[] DataBytes { get; set; }
///
/// ID for the read/write data command
///
public int DataID { get; set; }
#region Helper Methods
///
/// Missing Address Mark (Sector_ID or DAM not found)
///
public bool ST1MA
{
get { return NECUPD765.GetBit(0, _flag1); }
set
{
if (value) { NECUPD765.SetBit(0, ref _flag1); }
else { NECUPD765.UnSetBit(0, ref _flag1); }
}
}
///
/// No Data (Sector_ID not found, CRC fail in ID_field)
///
public bool ST1ND
{
get { return NECUPD765.GetBit(2, _flag1); }
set
{
if (value) { NECUPD765.SetBit(2, ref _flag1); }
else { NECUPD765.UnSetBit(2, ref _flag1); }
}
}
///
/// Data Error (CRC-fail in ID- or Data-Field)
///
public bool ST1DE
{
get { return NECUPD765.GetBit(5, _flag1); }
set
{
if (value) { NECUPD765.SetBit(5, ref _flag1); }
else { NECUPD765.UnSetBit(5, ref _flag1); }
}
}
///
/// End of Track (set past most read/write commands) (see IC)
///
public bool ST1EN
{
get { return NECUPD765.GetBit(7, _flag1); }
set
{
if (value) { NECUPD765.SetBit(7, ref _flag1); }
else { NECUPD765.UnSetBit(7, ref _flag1); }
}
}
///
/// Missing Address Mark in Data Field (DAM not found)
///
public bool ST2MD
{
get { return NECUPD765.GetBit(0, _flag2); }
set
{
if (value) { NECUPD765.SetBit(0, ref _flag2); }
else { NECUPD765.UnSetBit(0, ref _flag2); }
}
}
///
/// Bad Cylinder (read/programmed track-ID different and read-ID = FF)
///
public bool ST2BC
{
get { return NECUPD765.GetBit(1, _flag2); }
set
{
if (value) { NECUPD765.SetBit(1, ref _flag2); }
else { NECUPD765.UnSetBit(1, ref _flag2); }
}
}
///
/// Wrong Cylinder (read/programmed track-ID different) (see b1)
///
public bool ST2WC
{
get { return NECUPD765.GetBit(4, _flag2); }
set
{
if (value) { NECUPD765.SetBit(4, ref _flag2); }
else { NECUPD765.UnSetBit(4, ref _flag2); }
}
}
///
/// Data Error in Data Field (CRC-fail in data-field)
///
public bool ST2DD
{
get { return NECUPD765.GetBit(5, _flag2); }
set
{
if (value) { NECUPD765.SetBit(5, ref _flag2); }
else { NECUPD765.UnSetBit(5, ref _flag2); }
}
}
///
/// Control Mark (read/scan command found sector with deleted DAM)
///
public bool ST2CM
{
get { return NECUPD765.GetBit(6, _flag2); }
set
{
if (value) { NECUPD765.SetBit(6, ref _flag2); }
else { NECUPD765.UnSetBit(6, ref _flag2); }
}
}
#endregion
}
}