Files
ZXSpectrum48K/Core/Io/TzxBlocks.cs

55 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
namespace Core.Io
{
// The base class all future TZX blocks will inherit from
public abstract class TzxBlock
{
public abstract int BlockId { get; }
}
// ID 0x10: Standard Speed Data Block
public class StandardSpeedBlock : TzxBlock
{
public override int BlockId => 0x10;
// How long to pause the tape in milliseconds after this block loads
public ushort PauseAfterMs { get; set; }
public ushort DataLength { get; set; }
// The actual tape bytes
public byte[] Data { get; set; } = Array.Empty<byte>();
}
// ID 0x32: Archive Info Block (Metadata)
public class ArchiveInfoBlock : TzxBlock
{
public override int BlockId => 0x32;
// Key: Text ID (e.g., 0 = Full Title, 1 = Software House, 2 = Publisher, 4 = Year)
// Value: The actual text string
public Dictionary<byte, string> Metadata { get; set; } = new Dictionary<byte, string>();
}
// ID 0x11: Turbo Speed Data Block
public class TurboSpeedBlock : TzxBlock
{
public override int BlockId => 0x11;
public ushort PilotPulseLength { get; set; }
public ushort SyncFirstPulseLength { get; set; }
public ushort SyncSecondPulseLength { get; set; }
public ushort ZeroBitPulseLength { get; set; }
public ushort OneBitPulseLength { get; set; }
public ushort PilotToneLength { get; set; }
public byte UsedBitsInLastByte { get; set; }
public ushort PauseAfterMs { get; set; }
// This is a 24-bit integer in the file, so we store it in a standard 32-bit int
public int DataLength { get; set; }
public byte[] Data { get; set; } = Array.Empty<byte>();
}
}