int SYNC2Pulse(ITZXDataBlock TZXDataBlock)
 {
     EarBit = EarBit ^ 64;
     TZXState.Next();
     PulseCounter = 2;
     usedBits     = 8;
     return(((TZXDataBlock[0] & 0x80) > 0) ? TZXDataBlock.OneLength : TZXDataBlock.ZeroLength);
 }
        int DataBytes(ITZXDataBlock TZXDataBlock)
        {
            EarBit = EarBit ^ 64;
            PulseCounter--;
            if (PulseCounter > 0)
            {
                return(((TZXCurrentByte & 0x80) == 0x80) ? TZXDataBlock.OneLength : TZXDataBlock.ZeroLength);
            }
            if (usedBits > 1)
            {
                usedBits--;
                PulseCounter     = 2;
                TZXCurrentByte <<= 1;
                return(((TZXCurrentByte & 0x80) == 0x80) ? TZXDataBlock.OneLength : TZXDataBlock.ZeroLength);
            }
            TZXDataBlock.Progress++;
            TZXTapeCounter++;

            if (TZXDataBlock.Progress >= TZXDataBlock.TAPBlock.Length)
            {
                if (TZXDataBlock.PauseLength > 0)
                {
                    TZXState.Next();
                    OnLoaded();
                    return(TZXDataBlock.PauseLength * 3500);
                }
                else
                {
                    if (TZXTapeCounter > TZXFile.TZXLength)
                    {
                        TZXState.Next();
                        OnLoaded();
                        return(TZXDataBlock.PauseLength * 3500);
                    }
                    if (TZXTapeCounter != TZXFile.TZXLength)
                    {
                        TZXState.Reset();
                        return(GetNextBlock());
                    }
                }
            }
            OnProgress(TZXFile, TZXDataBlock.TAPBlock.Length, TZXTapeCounter, TZXDataBlock.Progress, Percent(TZXFile.TZXLength, TZXTapeCounter), Percent(TZXDataBlock.TAPBlock.Length - 1, TZXDataBlock.Progress), TZXDataBlock.ToString(), TZXDataBlock);
            usedBits = TZXDataBlock.UsedBits;

            PulseCounter = 2;
            if (TZXDataBlock.Progress < TZXDataBlock.TAPBlock.Data.Length)
            {
                TZXCurrentByte = TZXDataBlock.TAPBlock.Data[TZXDataBlock.Progress];
            }
            return(((TZXCurrentByte & 0x80) == 0x80) ? TZXDataBlock.OneLength : TZXDataBlock.ZeroLength);
        }
 int PilotTone(ITZXDataBlock TZXDataBlock)
 {
     EarBit = EarBit ^ 64;
     if (TZXDataBlock.Progress < TZXDataBlock.PulseToneLength)
     {
         TZXDataBlock.Progress++;
         return(TZXDataBlock.PulseLength);
     }
     else
     {
         TZXDataBlock.Progress = 0;
         TZXState.Next();
         return(TZXDataBlock.Sync1Length);
     }
 }
 int SYNC1Pulse(ITZXDataBlock TZXDataBlock)
 {
     EarBit = EarBit ^ 64;
     TZXState.Next();
     return(TZXDataBlock.Sync2Length);
 }